harvard-kyoto: fixes

This commit is contained in:
Vlasta Vesely 2023-02-14 18:44:15 +01:00
parent 232a0f85b3
commit ff72a6ce05
4 changed files with 26 additions and 25 deletions

View file

@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* https://en.wikipedia.org/wiki/Velthuis */
/* https://en.wikipedia.org/wiki/Harvard-Kyoto */
#include "compat.h"
#include "harvard-kyoto.h"
@ -16,16 +16,12 @@ static const struct encoder_tuple table[] = {
{"U", "\u016b"},
{"RR", "\u1e5d"},
{"R", "\u1e5b"},
{"LL", "\u1e39"},
{"L", "\u1e37"},
{"lRR", "\u1e39"},
{"lR", "\u1e37"},
{"aa", "\u0101"},
{"ii", "\u012b"},
{"uu", "\u016b"},
{".rr", "\u1e5d"},
{".r", "\u1e5b"},
{".ll", "\u1e39"},
{".l", "\u1e37"},
{"M", "\u1e43"},
{"H", "\u1e25"},
@ -36,8 +32,11 @@ static const struct encoder_tuple table[] = {
{"D", "\u1e0d"},
{"N", "\u1e47"},
{"S", "\u1e63"},
{"sh", "\u015b"},
{"z", "\u015b"}
{"z", "\u015b"},
/* not defined by the standard */
{"LL", "\u1e39"},
{"L", "\u1e37"}
};
static const struct encoder_tuple *find_tuple(const char *text)

1
main.c
View file

@ -54,6 +54,7 @@ static const struct option long_opts[] = {
{"encode", no_argument, 0, 'e'},
{"velthuis", no_argument, 0, 'e'},
{"harvard", no_argument, 0, 'k'},
{"kyoto", no_argument, 0, 'k'},
{"ascii", no_argument, 0, 'a'},
{"devanagari", no_argument, 0, 'd'},
{"czech", no_argument, 0, 'c'},

View file

@ -18,9 +18,9 @@ START_TEST(test_harvard_kyoto_encoding)
{
test_harvard_kyoto("saMskRtam", "saṃskṛtam");
test_harvard_kyoto("yogaH", "yogaḥ");
test_harvard_kyoto("zaastraM shaastram", "śāstraṃ śāstram");
test_harvard_kyoto("zaastraM zAstram", "śāstraṃ śāstram");
test_harvard_kyoto("liGga yajJa varNa", "liṅga yajña varṇa");
test_harvard_kyoto("Aaa Iii Uuu RR R L", "āā īī ūū ṝ ṛ ḷ");
test_harvard_kyoto("Aaa Iii Uuu RR R L lR lRR", "āā īī ūū ṝ ṛ ḷ ḷ ḹ");
}
END_TEST

View file

@ -120,9 +120,10 @@ START_TEST(test_harvard)
{
test_output("./iast \"RtaM\" -k", "ṛtaṃ\n");
test_output("./iast \"RtaM\" --harvard", "ṛtaṃ\n");
test_output("./iast \"RtaM\" --kyoto", "ṛtaṃ\n");
/* force Devanagari output */
test_output("./iast \"agnIH zatruH shatruH\" -kd", "अग्नीः शत्रुः शत्रुः\n");
test_output("./iast \"agnIH zatruH\" -kd", "अग्नीः शत्रुः\n");
}
END_TEST