summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/shipunov/scripts/biokey2html3.pl
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-08 03:00:28 +0000
committerNorbert Preining <norbert@preining.info>2019-10-08 03:00:28 +0000
commite5ffc42ed260285f76383ae18dd0f4a603c07fa8 (patch)
tree7d901aebae17ed14f1c9812c9339a88d68dc74e4 /macros/latex/contrib/shipunov/scripts/biokey2html3.pl
parentba86549c94b1e8b6b19bc82b01e85a7e513e7586 (diff)
CTAN sync 201910080300
Diffstat (limited to 'macros/latex/contrib/shipunov/scripts/biokey2html3.pl')
-rw-r--r--macros/latex/contrib/shipunov/scripts/biokey2html3.pl89
1 files changed, 89 insertions, 0 deletions
diff --git a/macros/latex/contrib/shipunov/scripts/biokey2html3.pl b/macros/latex/contrib/shipunov/scripts/biokey2html3.pl
new file mode 100644
index 0000000000..296daaab6a
--- /dev/null
+++ b/macros/latex/contrib/shipunov/scripts/biokey2html3.pl
@@ -0,0 +1,89 @@
+#!/usr/bin/perl -w
+$/ = "";
+
+use File::Basename;
+
+$kl = $ARGV[0];
+if ($kl && ($kl =~ /-h|-\?/)) {&message(); exit(1);}
+
+$file = @ARGV;
+if ($file < 1) {&message(); exit(1);}
+
+$a = $ARGV[0];
+open(VCHOD, "$a") || die "Sorry, I cannot open $a: $!\n";
+
+print STDERR "Making reference tags... \n";
+
+&hesh_stup();
+
+while(<VCHOD>){
+
+ &format1();
+ &name_href();
+ &format2();
+ print;
+}
+
+sub hesh_stup {
+ $schet_stup = 0;
+ while(<VCHOD>){
+ if (/\\TEZA{(\w\w)}/) {$schet_stup++; $stup{"$1"} = "$schet_stup";}
+ if (/\\STEZA{(\w\w)}{(\w\w)}/) {$schet_stup++; $stup{"$1"} = "$schet_stup";}
+ }
+ seek (VCHOD, 0, 0);
+}
+
+END {
+ close (VCHOD);
+}
+
+sub format1 {
+ s@<!--(.*)-->@$1@g;
+ s@(\\TEZA{\w\w})@<span class="TEZA">$1\.</span>@gi;
+ s@(\\STEZA{\w\w}{\w\w})@<span class="STEZA">$1\.</span>@gi;
+ s@(\\SSYLKA{\w\w})@ ... <span class="SSYLKA">$1\.</span>@gi;
+}
+
+sub name_href {
+ s@\\TEZA{(\w\w)}@<a name=\"$1\">$stup{$1}<\/a>@g;
+ s@\\STEZA{(\w\w)}{(\w\w)}@<a name=\"$1\">$stup{$1}<\/a>\(<a href=\"#$2\">$stup{$2}<\/a>\)@g;
+ s@\\SSYLKA{(\w\w)}@<a href=\"#$1\">$stup{$1}<\/a>@g;
+}
+
+sub format2 {
+ s@\\documentclass.*@@gi;
+ s@\\usepackage.*@@gi;
+ s@\\begin.*@@gi;
+ s@\\end.*@@gi;
+ s@<p>%@@gi;
+ s@\\i *{}@i@gsi;
+ s@\$\\times\$@&times\;@gi;
+ s@\\#@-@gi;
+ s@\\<|<<@&laquo\;@g;
+ s@\\>|>>@&raquo\;@g;
+ s@~@&nbsp\;@gi;
+ s@---|\\---@&mdash;@gi;
+ s@(\\T+?)(.*?)\n\n@ ...
+ <!--<a href="">--><span class="SP">$2</span><!--</a>-->\n\n@gsi;
+ s@\\KN (.+?) @<em>$1</em> @gsi;
+ s@\\NN (.+?) (.+?) @<em>$1 $2</em> @gsi;
+ s@\\K *{(.+?)}@<em>$1</em>@gsi;
+ s@\\J *{(.+?)}@<strong>$1</strong>@gsi;
+ s@\\textit *{(.+?)}@<em>$1</em>@gsi;
+ s@\\textbf *{(.+?)}@<strong>$1</strong>@gsi;
+ s@<p>\\FK@<p class="FK">@sgi;
+ s@<p>@<p class="ST">@sgi;
+ s@\\AN@&ndash;@gi;
+ s@\\AAN|\\AAAN@=@gi;
+ s@ +?@ @sgi;
+ s@\\'@@sgi;
+ s@\\i{}@@sgi;
+}
+
+sub message {
+$Me = basename($0);
+print <<END_OF_MESSAGE
+USAGE: $Me [-h|-?] File1 [>File2]
+END_OF_MESSAGE
+}
+# \ No newline at end of file