Skip to content

Releases: antoineboquet/greek-conversion

0.14.0 (March 26, 2024)

26 Mar 11:21
ad5da32
Compare
Choose a tag to compare

This release contains new features & fixes, including breaking changes.

Design changes

Note

As the library matures, some aspects need to be polished. Consider that the points below are now fixed.

  • (Presets naming) To be more accurate, the BNF preset has been renamed BNF_ADAPTED and the MODERN_BC preset has been renamed SIMPLE_BC ('BC' stands for 'beta code').
  • (Better defaults) The beta variant is now disabled by default as (a) most standards don't use it; (b) Greek typefaces don't support it as commonly as they should (in this sens, option disableBetaVariant has been replaced by useBetaVariant).

Features

ALA-LC Modern transliteration

This release adds support for the ALA-LC standard variant for Modern Greek (the standard describes Greek texts written after 1453 as modern). The corresponding preset is Preset.ALA_LC_MODERN:

import { KeyType, toTransliteration } from 'greek-conversion'

toTransliteration('Ορθόδοξος Αυτοκέφαλος Εκκλησία της Αλβανίας', KeyType.GREEK, Preset.ALA_LC_MODERN)
// Outputs: Orthodoxos Autokephalos Ekklēsia tēs Alvanias

toTransliteration('Λασκαρίνα Μπουμπουλίνα', KeyType.GREEK, Preset.ALA_LC_MODERN)
// Outputs: Laskarina Boumpoulina

toTransliteration('Ντμίτρι Ιβάνοβιτς Μεντελέγιεφ', KeyType.GREEK, Preset.ALA_LC_MODERN)
// Outputs: D̲mitri Ivanovits Mentelegieph

This new preset brings two additional transliterationStyle options, muPi_b and nuTau_d:

  • muPi_b transliterates 'μπ' as 'b' at the beginning of a word;
  • nuTau_d transliterates 'ντ' as 'd̲' at the beginning of a word.

These rules are defined by the ALA-LC standard.

Beta code normalization

This release normalizes beta code inputs to ensure that the resulting string is correct. Release v0.13.0 has already brought diacritics order normalization. This release adds:

  • the prevention of multiple identical diacritics;
  • the removal of non-beta code characters.

If the non-beta code characters are to be preserved, you can opt-in the new betaCodeStyle option skipSanitization.

Other changes

  • The default greek output now uses oxiai (#3).
  • A new greekStyle option useMonotonicOrthography allows you to only output monotonic accents (tonos, diaeresis), forcing the use of tonoi rather than oxiai.

Fixes

  • The GreekString object didn't support KeyType.TLG_BETA_CODE.
  • GreekString: enabling the option betaCodeStyle.useTLGStyle accidentally produced uppercase strings for greek/transliterated outputs.

0.13.1 (March 15, 2024)

15 Mar 18:02
23a00f3
Compare
Choose a tag to compare

This release contains some changes & fixes.

Changes

  • Add a new transliterationStyle option gammaNasal_n to conditionally transliterate gamma nasals as 'n'.
  • Silently enable AdditionalChar.LUNATE_SIGMA if related options are enabled (namely, greekStyle.useLunateSigma and transliterationStyle.lunatesigma_s).
  • GreekString now converts strings to the other representations using the self-converted source, not the source itself.

Fixes

  • Presets BNF and ISO mustn't transliterate gamma nasals as 'n'.
  • Prevent a beta code string to reproduce a gamma nasal transliterated as 'n'.
  • Transliteration (self-conversion): fix a typo that produced an inappropriate behavior when applying breathings to a pair of rhos (transliterationStyle.rho_rh).

0.13.0 (March 10, 2024)

10 Mar 12:55
cfba815
Compare
Choose a tag to compare

This release contains new features & fixes, including breaking changes.

Design changes

Note

As the library matures, some aspects need to be polished. Consider that the points below are now fixed.

Shorter names, saved bytes: some names among the conversion options have been shorten — without sacrificing meaning:

  1. useGreekStyle -> greekStyle;
  2. useTransliterationStyle -> transliterationStyle;
  3. useAdditionalChars -> additionalChars.

Features

ISO 843 (1997) transliteration

This release adds support for the ISO 843 (1997) norm as a new preset named Preset.ISO:

import { KeyType, toTransliteration } from 'greek-conversion'

const greekStr =
  'Ὧν ἡ σοφία παρασκευάζεται εἰς τὴν ' +
  'τοῦ ὅλου βίου μακαριότητα πολὺ μέγιστόν ' +
  'ἐστιν ἡ τῆς φιλίας κτῆσις.'

toTransliteration(
  greekStr,         // Hō̃n hī sofía paraskeuázetai eis tī̀n
  KeyType.GREEK,    // toũ hólou víou makariótīta polỳ mégistón
  Preset.ISO        // estin hī tī̃s filías ktī̃sis.
)

Thesaurus Linguae Graecae beta code

It also adds support for the classical Thesaurus Linguae Graecae beta code:

  1. input: by adding a new input type (KeyType.TLG_BETA_CODE);
  2. output: by extending the IConversionOptions interface with a betaCodeStyle.useTLGStyle option.
Input TLG beta code
import { KeyType, toGreek } from 'greek-conversion'
toGreek('*)/AI+DA', KeyType.TLG_BETA_CODE) // Ἄϊδα
Ouput TLG beta code
betaCodeStyle?: {
  useTLGStyle?: boolean // use the Thesaurus Linguae Graecae style. e.g. 'Ἄϊδι' → '*)/AI+DI'
}

Moreover, you can use the new preset Preset.TLG that acts as a shortcut to use this style, alongside Preset.MODERN_BC which is the default 'modernized' beta code provided by the previous versions of the library.

import { KeyType, Preset, toBetaCode } from 'greek-conversion'

toBetaCode('Ἄϊδα', KeyType.GREEK, Preset.MODERN_BC)  // A)/i+da
toBetaCode('Ἄϊδα', KeyType.GREEK, Preset.TLG)        // *)/AI+DA

Transliterated coronis style

A transliterationStyle.setCoronisStyle option has been added. It accepts a Coronis enum whose values ​​are PSILI | APOSTROPHE | NO. Default value is Coronis.PSILI ('psili' is the unicode name for smooth breathings).

import { Coronis, KeyType, toTransliteration } from 'greek-conversion'

toTransliteration('κἀγώ', KeyType.GREEK) // ka̓gṓ (defaults to Coronis.PSILI )
toTransliteration('κἀγώ', KeyType.GREEK, { transliterationStyle: { setCoronisStyle: Coronis.APOSTROPHE } }) // ka’gṓ
toTransliteration('κἀγώ', KeyType.GREEK, { transliterationStyle: { setCoronisStyle: Coronis.NO } }) // kagṓ

Other changes

  • A number of new options has been added to transliterationStyle in order to enable alternative transliterated letters: beta_v, eta_i & phi_f.
  • Beta code diacritics order is now fully normalized, input & output.
  • A greekStyle.useGreekQuestionMark option has been added and is enabled for Preset.BNF only (the default question mark is now a regular semicolon [U+003B]).
  • transliterationStyle.upsilon_y has a new value Preset.ISO. This value applies 'y' everywhere except for diphthongs 'au', 'eu', 'ou' (the default behavior preserves diphthongs 'au', 'eu', 'ēu', 'ou', 'ui', 'ōu').
  • Build: parcel settings have been revised.
  • NPM package: ship minified files only & better ESM/CommonJS handling.

Fixes

  • Transliteration (self conversion): case checking for xi_ks & chi_kh options was wrong.
  • Preset.BNF should use the upsilon_y option (with the new value Preset.ISO).

0.12.3 (March 5, 2024)

05 Mar 17:24
Compare
Choose a tag to compare

This release contains some changes & fixes.

Changes

  • AdditionalChar, KeyType & Preset are numeric enums now. Using previously defined string literals, like 'beta-code' for KeyType.BETA_CODE, don't work anymore. Where string literals were useful, use this construct instead: KeyType['ENUM_KEY'].
  • A removeLunateSigma optional parameter has been added to utils/removeGreekVariants().
  • Some work has been made to optimize the bundle size (note that the actual size depends on how you install and use the library). For example, greek-conversion.min.js is 15.7 kB in this release, compared to 17 kB in the previous release.

Fixes

  • A lowercase archaic koppa followed by an uppercase archaic koppa wasn't converted (from transliteration to beta code or greek) due to a wrong string evaluation in Mapping.apply().
  • setTransliterationStyle.lunatesigma_s option was changing all sigmas to lunate sigmas when converting to beta code or greek, while regular sigmas were expected.
  • Transliteration: uppercase letters 'xi' & 'chi' weren't apply properly when options xi_ks & chi_kh were enabled.

As this release has been published twice on NPM, its number isn't 0.12.2 but 0.12.3.

0.12.1 (March 1st, 2024)

01 Mar 21:18
bd5de72
Compare
Choose a tag to compare

This release contains only fixes.

Fixes

  • Greek: self conversion was sending the wrong fromType to Mapping.apply().
  • Greek: self conversion didn't apply the setGreekStyle.disableBetaVariant option.
  • Transliteration: self conversion didn't apply the setTransliterationStyle options.
  • Gamma nasals were also applied to beta code strings (but we want ἄγγελος = ángelos = a)/ggelos).

0.12.0 (February 26, 2024)

26 Feb 15:15
b5fb52f
Compare
Choose a tag to compare

This release contains new features & fixes, including breaking changes.

Design changes

Note

As the library matures, some aspects need to be polished. Consider that the points below are now fixed.

  • (Coding conventions) Starting with this release, the enums follow the PascalCase naming convention. e. g. KeyType.
  • (Better defaults) The whitespace is now preserved by default (in this sense, the preserveWhitespace option has been replaced by the removeExtraWhitespace option).

Features

Transliteration presets

This release adds the ability to use predefined conversion options that follow some of the main institutional guidelines.

import { KeyType, Preset, toTransliteration } from 'greek-conversion'

const str = 'ἀΰπνους νύκτας ἴαυον'

toTransliteration(str, KeyType.GREEK, Preset.ALA_LC) // aypnous nyktas iauon
toTransliteration(str, KeyType.GREEK, Preset.BNF) // aǘpnous núktas íauon
toTransliteration(str, KeyType.GREEK, Preset.SBL) // aypnous nyktas iauon

Mixed presets

Conversion presets can be mixed/overridden with a regular conversion options object by passing an array to the conversion function:

toBetaCode('...', KeyType.GREEK, [Preset.MODERN_BC, { removeExtraWhitespace: true }])
toGreek('...', KeyType.TRANSLITERATION, [Preset.SBL, { setGreekStyle: { useLunateSigma: true } }])
toTransliteration('...', KeyType.BETA_CODE, [Preset.ALA_LC, { removeDiacritics: false }])

New conversion options

A number of new conversion options has been added to this release:

  • setGreekStyle.useLunateSigma allows to force the use of lunate sigmas rather than the regular form;
  • setTransliterationStyle.rho_rh allows to force the addition of a transliterated rough breathing after rhos;
  • setTransliterationStyle.upsilon_y allows to transliterate upsilons as 'y' (but 'u' in diphthongs);
  • setTransliterationStyle.lunatesigma_s allows to transliterate lunate sigmas as 's'.

New additional char

This release extends the character set with the letter ϙ (archaic koppa).

Updated IConversionOptions schema (breaking change)

removeDiacritics?: boolean,      // remove diacritics, except those that represent letters

removeExtraWhitespace?: boolean, // remove potential extra whitespace

setGreekStyle?: {
  disableBetaVariant?: boolean,  // disable the typographic variant 'ϐ' [U+03D0]
  useLunateSigma?: boolean       // use the lunate sigma rather than the regular form
},

setTransliterationStyle?: {
  useCxOverMacron?: boolean,     // use a circumflex rather than a macron for 'η', 'ω', etc 
  xi_ks?: boolean,               // transliterate 'ξ' as 'ks' (defaults to: 'x')
  rho_rh?: boolean,              // transliterate 'ρ' as 'rh' even if it doesn't have a rough breathing
  chi_kh?: boolean,              // transliterate 'χ' as 'kh' (defaults to: 'ch')
  upsilon_y?: boolean,           // transliterate 'υ' as 'y' (defaults to: 'u')
  lunatesigma_s?: boolean        // transliterate 'ϲ' [U+03F2] as 's' (defaults to: 'c')
},

useAdditionalChars?:             // extend the default mapping with additional chars
 AdditionalChar[] |              //   (use AdditionalChar.ALL to enable the whole set)
 AdditionalChar

Note that the useAdditionalLetters option has been renamed useAdditionalChars while the additionalLetters enum has been renamed AdditionalChar.

Other changes

  • Uppercase strings are handled better.
  • Coronides are now transliterated with a smooth breathing.
  • Support has been added for the diacritical mark combining dot below.
  • The second argument of applyGreekVariants() now expects an IGreekStyle interface.

Fixes

  • The AdditionalChar (formerly AdditionalLetters) enum was missing from the default export.
  • Beta code values were removed for additional letters stigma & sampi when the option setTransliterationStyle.useCxOverMacron was activated.
  • Beta code macron (%26) & breve (%27) weren't removed by removeDiacritics().
  • Correct the beta code representation of the 'question mark' (;) & the 'ano teleia' (:).
  • Return the right case for transliterated rough breathings (h).
  • Return the right case for letters transliterated with two characters when a string is uppercase.
  • Add missing flag m to handle multi-line line start (^) in two regular expressions.

0.11.0 (February 5, 2024)

05 Feb 19:05
59c1a7f
Compare
Choose a tag to compare

This release contains new features & fixes, including breaking changes.

Features

Transliteration style

This release adds the ability to customize the default transliteration style:

import { keyType, toTransliteration } from 'greek-conversion'

const style = {
  chi_kh: true,
  xi_ks: true
}

toTransliteration('τέχνη', keyType.GREEK, { setTransliterationStyle: style }) // tékhnē
toTransliteration('ξίφος', keyType.GREEK, { setTransliterationStyle: style }) // ksíphos

Long vowels transliteration (breaking change)

Long vowels η & ω were indicated with a circumflex by default when transliterated, but it seems reasonable to prefer the macron as most transliteration systems use it. One can go back to the circumflex notation thanks to a new conversion option (useful when transliterated greek must be typed on the keyboard for example):

import { keyType, toGreek, toTransliteration } from 'greek-conversion'

const style = {
  useCxOverMacron: true
}

toGreek('téchnê', keyType.TRANSLITERATION, { setTransliterationStyle: style }) // τέχνη
toTransliteration('τέχνη', keyType.GREEK, { setTransliterationStyle: style }) // téchnê

More archaic letters (breaking change)

This release extends the character set with several archaic letters (both capital & small), namely ϳ (yot), ϲ (lunate sigma), ϟ (koppa) & ϡ (sampi). Archaic letters, including the preexisting ϝ (digamma), must now be explicitly added to the conversion process using a new conversion option:

import { additionalLetters, keyType, toGreek } from 'greek-conversion'

toGreek('woĩ', keyType.TRANSLITERATION) // wοῖ
toGreek('woĩ', keyType.TRANSLITERATION, { useAdditionalLetters: additionalLetters.ALL }) // ϝοῖ

Updated IConversionOptions schema (breaking change)

{
  preserveWhitespace?: boolean,            // keep potential extra whitespace
  removeDiacritics?: boolean,              // remove diacritics, except those that represent letters
  useAdditionalLetters?:                   // extend the default mapping with predefined
    additionalLetters|additionalLetters[], //   additional letters
  setGreekStyle?: {
    disableBetaVariant?: boolean           // disable the typographic variant 'ϐ' [U+03D0]
  },
  setTransliterationStyle?: {
    useCxOverMacron?: boolean,             // use a circumflex rather than a macron for eta, omega, etc
    chi_kh?: boolean,                      // alter the transliteration of 'χ' (defaults to: 'ch')
    xi_ks?: boolean                        // alter the transliteration of 'ξ' (defaults to: 'x')
  }
}

Note that the disableBetaVariant option is nested in the setGreekStyle object now.

Other changes

  • Apply a Greek Question Mark ; [U+037E] rather than a semicolon when converting a ? to greek (following the BNF guidelines).
  • Dropped support for the public API applyGammaDiphthongs() (now part of the Mapping class, as a private method → #applyGammaNasals()).
  • Dropped support for the public API isMappedKey() (as the mapping is now stateful, this function needs a conceptual redefinition).

Fixes

  • Correctly position rough breathings in case of diphthongs and diaereses (from transliteration to greek).
  • Handle words more accurately by checking for \p{P} in the regex pattern (?<=\p{P}|\s|^).
  • Properly apply rh when transliterating letter ρ from beta code representation.
  • Properly apply rrh when transliterating the combination of letters ρρ from beta code & greek representations.
  • Don't apply a rough breathing on the second ρ when converting the combination of letters ρρ from transliterated representation.

0.10.0 (September 27, 2023)

28 Feb 15:13
59af6d0
Compare
Choose a tag to compare

This release contains new features & fixes.

Features

This release adds the ability to disable the typographic variant ϐ [U+03D0] which is employed in some high-quality typesetting but may be unwanted:

import { keyType, toGreek } from 'greek-conversion'
toGreek('bárbaros', keyType.TRANSLITERATION, { disableBetaVariant: true }) // βάρβαρος

Fixes

  • Properly apply variants to the converted source string when using the GreekString object.

0.9.4 (August 14, 2023)

14 Aug 18:08
Compare
Choose a tag to compare

This release is only a maintenance release with updated dependencies.

0.9.3 (July 31, 2022)

31 Jul 18:31
Compare
Choose a tag to compare

Summary

This is the first version to offer precompiled JavaScript files. If you don't use package managers/bundlers/transpilers and so on, this release is intended for you as you can now simply download the latest archive (greek-conversion-0.9.3.zip) below and import the library (greekConversion.min.js) into your project without any additional configuration.

Basic Example

Primary use case is in-browser use:

<!-- HTML page -->

<script type="module">
  import { keyType, toGreek } from "./greekConversion.min.js";
  console.log(toGreek('anthrôpos', keyType.TRANSLITERATION)); // ανθρωπος
</script>

Note that the <script> tag is set up with type="module", which is supported by all modern browsers. This way, the library doesn't pollutes the global namespace; however, you can't import the library the other way, as a non-module script.