transliterate

Transliteration engine
git clone git://lumidify.org/transliterate.git
Log | Files | Refs | README | LICENSE

commit 245d58622d19538e858392c22c9230e4b018962e
parent b6678f1d8770d62f8d1e7940f4228ab614b01c3b
Author: lumidify <nobody@lumidify.org>
Date:   Mon,  6 Apr 2020 17:07:45 +0200

Add option to ignore word choices

Diffstat:
Mtransliterate.pl | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/transliterate.pl b/transliterate.pl @@ -250,7 +250,7 @@ sub prompt_choose_word { # make a list of all substrings that contain multiple word options my @replacements; foreach (0..$#$substrings) { - if ($substrings->[$_]->[1] =~ /\Q$config->{choicesep}\E/) { + if ($substrings->[$_]->[0] && $substrings->[$_]->[1] =~ /\Q$config->{choicesep}\E/) { if (exists $config->{"choiceoverride"} && exists $config->{"choiceoverride"}->{$substrings->[$_]->[1]}) { $substrings->[$_]->[1] = $config->{"choiceoverride"}->{$substrings->[$_]->[1]}; @@ -383,6 +383,8 @@ sub prompt_choose_word { } @choices = sort {$choice_nums{$b} <=> $choice_nums{$a}} @choices; } + # also give option to ignore word by just keeping everything + push @choices, $word; foreach my $word_choice (@choices) { my $button = Gtk2::Button->new($word_choice); $button->signal_connect( @@ -1525,6 +1527,11 @@ is possible to just press enter instead of manually clicking it. Before the line is finalized, the user may press "Undo" to undo any changes on the current line. +The last option is always the complete word (with B<choicesep>), in case +it simply needs to be ignored. I guess this could be useful if B<choicesep> +occurs in the text (although that should be avoided) and is ignored with +a B<matchignore> statement. It shouldn't be needed in most cases, though. + "Stop processing" will exit the program and print the line number that was currently being processed.