summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/shipunov/scripts
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/shipunov/scripts
Initial commit
Diffstat (limited to 'macros/latex/contrib/shipunov/scripts')
-rw-r--r--macros/latex/contrib/shipunov/scripts/shipunov/biokey2html.bat5
-rw-r--r--macros/latex/contrib/shipunov/scripts/shipunov/biokey2html.sh8
-rw-r--r--macros/latex/contrib/shipunov/scripts/shipunov/biokey2html1.pl30
-rw-r--r--macros/latex/contrib/shipunov/scripts/shipunov/biokey2html2.pl31
-rw-r--r--macros/latex/contrib/shipunov/scripts/shipunov/biokey2html3.pl89
5 files changed, 163 insertions, 0 deletions
diff --git a/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html.bat b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html.bat
new file mode 100644
index 0000000000..4953470861
--- /dev/null
+++ b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html.bat
@@ -0,0 +1,5 @@
+@echo off
+perl -w biokey2html1.pl %1 > %12
+perl -w biokey2html2.pl %12 > %1.tmp
+perl -w biokey2html3.pl %1.tmp > %1.html
+if exist %1.tmp del %1.tmp \ No newline at end of file
diff --git a/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html.sh b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html.sh
new file mode 100644
index 0000000000..50ee8a52ab
--- /dev/null
+++ b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+export PATH=.:{$PATH}
+biokey2html1.pl $1 > $12
+biokey2html2.pl $12 > /tmp/$1.$$
+biokey2html3.pl /tmp/$1.$$ > $1.html
+
+#
diff --git a/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html1.pl b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html1.pl
new file mode 100644
index 0000000000..e7eb44b07d
--- /dev/null
+++ b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html1.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -w
+
+$/="";
+
+print STDERR "Making relative LaTeX key... \n";
+
+&ochki();
+
+print "\n";
+while(<>){
+ s/\\Z(\d+)\./\\TEZA{$ochki[$1-1]}/g;
+ s/\\T+?\s*(\d+)\./\\SSYLKA{$ochki[$1-1]}/sg;
+ s/\\ZZ(\d+)\((\d+)\)\./\\STEZA{$ochki[$1-1]}{$ochki[$2-1]}/g;
+ print;
+}
+
+# fill array to links
+sub ochki {
+$B0 = $B1 = $nom = "";
+@ochki = ();
+ for ($x = 0; $x < 26; $x++) {
+ for ($y = 0; $y < 26; $y++) {
+ $B0 = chr($y + 65);
+ $B1 = chr($x + 65);
+ $nom = "$B1$B0";
+ @ochki = (@ochki, $nom)
+ }
+ }
+}
+# \ No newline at end of file
diff --git a/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html2.pl b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html2.pl
new file mode 100644
index 0000000000..75801f4430
--- /dev/null
+++ b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html2.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl -w
+
+print STDERR "Making HTML title and paragrafs tags... \n";
+
+while(<>){
+ s@^\s+?$@\n<p>@g;
+print;
+}
+
+BEGIN {
+print <<END_OF_BEGIN
+<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
+<html>
+<head>
+ \t<meta http-equiv=\"Content-Type\" content=\"text/html\">
+ \t<link type="text/css" rel="stylesheet" href="ws_key.css">
+</head>
+<body>
+
+END_OF_BEGIN
+}
+
+END{
+print <<END_OF_END
+
+</body>
+</html>
+END_OF_END
+}
+
+# \ No newline at end of file
diff --git a/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html3.pl b/macros/latex/contrib/shipunov/scripts/shipunov/biokey2html3.pl
new file mode 100644
index 0000000000..296daaab6a
--- /dev/null
+++ b/macros/latex/contrib/shipunov/scripts/shipunov/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