diff options
author | Karl Berry <karl@freefriends.org> | 2025-01-19 22:46:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2025-01-19 22:46:45 +0000 |
commit | f1ac450581dc20747fc8bd86b3f4b61b1ec65d92 (patch) | |
tree | 241e9158959bcb54865fb8aacb84c6d38f1c0d9a /Master | |
parent | 768286ed5cfbc91ccd36f684b7c04b2067b43b6a (diff) |
TLUtils.pm (parse_AddHyphen_line): require left/righthyphenmin to be
specified, rather than defaulting to 2/3, since latest hyph-utf8 missed
some settings. Also require non-empty luaspecial, databases, synonyms, name.
tl-update-tlpdb (finish): include commented-out call to
create_language_def, which (along with its siblings) is what invokes
parse_AddHyphen_line.
hyphen-arabic.tlpsrc,
hyphen-farsi.tlpsrc: add 0 for left/righthyphenmin=.
git-svn-id: svn://tug.org/texlive/trunk@73518 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 67 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-tlpdb | 13 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc | 4 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc | 4 |
4 files changed, 64 insertions, 24 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index b9ff366fcee..fff17ae3686 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -3677,69 +3677,102 @@ sub _create_config_files { close(OUTFILE) || warn "close(>$dest) failed: $!"; } +# sub parse_AddHyphen_line { my $line = shift; my %ret; # default values - my $default_lefthyphenmin = 2; - my $default_righthyphenmin = 3; - $ret{"lefthyphenmin"} = $default_lefthyphenmin; - $ret{"righthyphenmin"} = $default_righthyphenmin; + my $default_lefthyphenmin = -1; + my $default_righthyphenmin = -1; $ret{"synonyms"} = []; for my $p (quotewords('\s+', 0, "$line")) { my ($a, $b) = split /=/, $p; if ($a eq "name") { if (!$b) { - $ret{"error"} = "AddHyphen line needs name=something"; + $ret{"error"} = "AddHyphen line needs name=something: $line"; return %ret; } $ret{"name"} = $b; next; } if ($a eq "lefthyphenmin") { - $ret{"lefthyphenmin"} = ( $b ? $b : $default_lefthyphenmin ); + if (! defined $b) { + $ret{"error"} = "AddHyphen line needs lefthyphenmin=something: $line"; + return %ret; + } + $ret{"lefthyphenmin"} = $b; next; } if ($a eq "righthyphenmin") { - $ret{"righthyphenmin"} = ( $b ? $b : $default_righthyphenmin ); + if (! defined $b) { + $ret{"error"} = "AddHyphen line needs righthyphenmin=something: $line"; + return %ret; + } + $ret{"righthyphenmin"} = $b; next; } if ($a eq "file") { if (!$b) { - $ret{"error"} = "AddHyphen line needs file=something"; + $ret{"error"} = "AddHyphen line needs file=something: $line "; return %ret; } $ret{"file"} = $b; next; } if ($a eq "file_patterns") { - $ret{"file_patterns"} = $b; - next; + # many are blank in hyph-utf8, don't check. + $ret{"file_patterns"} = $b; + next; } if ($a eq "file_exceptions") { - $ret{"file_exceptions"} = $b; - next; + # many are blank in hyph-utf8, don't check. + $ret{"file_exceptions"} = $b; + next; } if ($a eq "luaspecial") { - $ret{"luaspecial"} = $b; - next; + if (!$b) { + $ret{"error"} = "AddHyphen line needs luaspecial=something: $line"; + return %ret; + } + $ret{"luaspecial"} = $b; + next; } if ($a eq "databases") { + if (!$b) { + $ret{"error"} = "AddHyphen line needs databases=something: $line"; + return %ret; + } @{$ret{"databases"}} = split /,/, $b; next; } if ($a eq "synonyms") { + if (!$b) { + $ret{"error"} = "AddHyphen line needs synonyms=something: $line"; + return %ret; + } @{$ret{"synonyms"}} = split /,/, $b; next; } if ($a eq "comment") { - $ret{"comment"} = $b; - next; + $ret{"comment"} = $b; + next; } # should not be reached at all - $ret{"error"} = "Unknown language directive $a"; + $ret{"error"} = "Unknown AddHyphen directive $a: $line"; return %ret; } + if (! $ret{"name"}) { + $ret{"error"} = "AddHyphen is missing name setting: $a"; + return %ret; + } + if ($ret{"lefthyphenmin"} < 0) { + $ret{"error"} = "AddHyphen is missing lefthyphemin setting: $a"; + return %ret; + } + if ($ret{"righthyphenmin"} < 0) { + $ret{"error"} = "AddHyphen is missing righthyphemin setting: $a"; + return %ret; + } # this default value couldn't be set earlier if (not defined($ret{"databases"})) { if (defined $ret{"file_patterns"} or defined $ret{"file_exceptions"} diff --git a/Master/tlpkg/bin/tl-update-tlpdb b/Master/tlpkg/bin/tl-update-tlpdb index aa998a75d94..32d4a6bd13d 100755 --- a/Master/tlpkg/bin/tl-update-tlpdb +++ b/Master/tlpkg/bin/tl-update-tlpdb @@ -143,8 +143,8 @@ sub main { if ($opt_no_revision_check) { if ($opt_keep_revisions) { - copy_revisions_over($oldtlpdb, $newtlpdb); - info("$prg: keeping old revisions due to --keep-revisions\n"); + copy_revisions_over($oldtlpdb, $newtlpdb); + info("$prg: keeping old revisions due to --keep-revisions\n"); } else { info("$prg: not checking revisions due to --no-reverse-revision-check\n"); } @@ -211,7 +211,7 @@ sub main { } } if (!$buggy_tlpdb) { - finish($newtlpdb, $pkgcount); + finish($newtlpdb, $pkgcount); # never returns } else { # return error to the shell script, it is evaluated in cron.tl! return 1; @@ -704,6 +704,13 @@ sub is_hash_ref { sub finish { my ($tlpdb,$pkgcount) = @_; + + # uncommenting this line is the way to test parse_AddHyphen_line and + # similar, since that's the only time they are called. Seems like it + # would be cleaner to parse them when the *.tlpsrc is read. Someday. + #TeXLive::TLUtils::create_language_def($tlpdb, "/tmp/tlut-language.def", + # "/dev/null"); + if ($opt_output) { if (open(OUT, ">$opt_output")) { $tlpdb->writeout(\*OUT); diff --git a/Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc b/Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc index cbf74a0b88e..22568545fba 100644 --- a/Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc +++ b/Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc @@ -5,8 +5,8 @@ shortdesc (No) Arabic hyphenation patterns. longdesc Prevent hyphenation in Arabic. execute AddHyphen \ name=arabic \ - lefthyphenmin= \ - righthyphenmin= \ + lefthyphenmin=0 \ + righthyphenmin=0 \ file=zerohyph.tex \ file_patterns= runpattern f texmf-dist/tex/generic/hyph-utf8/patterns/tex/hyph-ar.tex diff --git a/Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc b/Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc index 214213c60bb..d57e2080fd9 100644 --- a/Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc +++ b/Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc @@ -5,8 +5,8 @@ shortdesc (No) Persian hyphenation patterns. longdesc Prevent hyphenation in Persian. execute AddHyphen \ name=farsi synonyms=persian \ - lefthyphenmin= \ - righthyphenmin= \ + lefthyphenmin=0 \ + righthyphenmin=0 \ file=zerohyph.tex \ file_patterns= runpattern f texmf-dist/tex/generic/hyph-utf8/patterns/tex/hyph-fa.tex |