summaryrefslogtreecommitdiff
path: root/graphics/gri/patches/patch-doc_texinfo2HTML
blob: 0507086f98310c392a29a1facc3ca2bc9d765fd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
$NetBSD: patch-doc_texinfo2HTML,v 1.1 2017/06/17 19:42:26 joerg Exp $

5.26 requires quoting of { in certain regex contexts.

--- doc/texinfo2HTML.orig	2017-06-10 18:03:25.861306247 +0000
+++ doc/texinfo2HTML
@@ -120,7 +120,7 @@ while(get_a_line()) {
 	next;
     }
     # Process image commands (NOT...it's there already) 
-    if (/\@image{(.*)}/) {
+    if (/\@image\{(.*)\}/) {
 	#print "<img src=\"$1.gif\" border=\"1\">\n";
 	next;
     }
@@ -208,12 +208,12 @@ while(get_a_line()) {
     s,<,&lt;,og;
     # Special tweak to make 'Gri' look cooler.
 	#    s, Gri , G<FONT SIZE=-1>RI</FONT> ,og;
-    s,\@code{\@\@},\@code{TEXINFO2HTML-AT-AT},og; 
+    s,\@code\{\@\@\},\@code{TEXINFO2HTML-AT-AT},og; 
     s,\@},TEXINFO2HTML-CLOSE-BRACE,og; # retain inside e.g. @code{}
     s,\@\@,TEXINFO2HTML-AT-AT,og;
-    s,\@{,{,og;
-    s,\@TeX{},TeX,og;
-    s,\@dots{},...,og;
+    s,\@\{,{,og;
+    s,\@TeX\{\},TeX,og;
+    s,\@dots\{\},...,og;
     # Put in place-holders for some accents.  I should check for all
     # of them, but for now, I'm just kludging in a couple, 
     # to solve an immediate problem and to serve as a place-holder
@@ -237,18 +237,18 @@ while(get_a_line()) {
 	}
 	next;
     }
-    while (/\@url{([^}]*)}/) {
+    while (/\@url\{([^}]*)\}/) {
 	$the_url = $1;
-        s:\@url{[^}]*}:<a href="$the_url">\@code{$the_url}</a>:;
+        s:\@url\{[^}]*\}:<a href="$the_url">\@code{$the_url}</a>:;
     }
-    while (/\@uref{([^}]*)}/) {
+    while (/\@uref\{([^}]*)\}/) {
 	@items = split(/,/, $1);
         if ($#items == 0) {
-            s:\@uref{[^}]*}:<a href="$items[0]">$items[0]</a>:;
+            s:\@uref\{[^}]*\}:<a href="$items[0]">$items[0]</a>:;
         } elsif ($#items == 1) {
-            s:\@uref{[^}]*}:<a href="$items[0]">$items[1]</a>:;
+            s:\@uref\{[^}]*\}:<a href="$items[0]">$items[1]</a>:;
         } elsif ($#items == 2) {
-            s:\@uref{[^}]*}:\@code{$items[2]}:;
+            s:\@uref\{[^}]*\}:\@code{$items[2]}:;
         } else {
             die "Cannot have more than 3 items in a 'uref' at \"$_\"";
         }
@@ -330,7 +330,7 @@ while(get_a_line()) {
 	while(get_a_line()) {
 	    next if /\@sp/;
 	    next if /\@cindex/;
-            s|\@anchor{([^}]*)}|<a name=\"$1\"></a>|g;
+            s|\@anchor\{([^}]*)\}|<a name=\"$1\"></a>|g;
 	    &process_examples();
 	    # Handle HTML inserts
 	    if (/^\@c HTML (.*)/o) {
@@ -346,10 +346,10 @@ while(get_a_line()) {
 	    }
 	    if (/\s*\@item\s*(.*)/o) {
                 $the_item = $1;
-		$the_item =~ s:\@{:{:og;
-		$the_item =~ s:\@}:}:og;
+		$the_item =~ s:\@\{:{:og;
+		$the_item =~ s:\@\}:}:og;
 		$the_item =~ s:\@\@:\@:og;
-		$the_item =~ s:\@code{([^}]*)}:`<font color="$ex_color"><code>$1</code></font>':og;
+		$the_item =~ s:\@code\{([^}]*)\}:`<font color="$ex_color"><code>$1</code></font>':og;
 		print "<dt> $start_item$the_item$end_item\n<dd>";
 	    } else {
 		print "<p>" if (/^$/o);
@@ -402,38 +402,38 @@ sub process_examples() {
     } else {
         s,\@value\{([^}]*)\},$value{$1},g; # Substitute set/value pair
         s,\@},},og;
-        s,\@{,{,og;
+        s,\@\{,{,og;
     }
 }
 
 
 sub sub_refs {
-    die "line $. of file: cannot have multiple refs on one line" if (/\@[px]*ref{(.*)}(.*)\@[px]*ref{(.*)}/);
+    die "line $. of file: cannot have multiple refs on one line" if (/\@[px]*ref\{(.*)\}(.*)\@[px]*ref\{(.*)\}/);
     # anchors
-    s|\@anchor{([^}]*)}|<a name=\"$1\"></a>|g;
+    s|\@anchor\{([^}]*)\}|<a name=\"$1\"></a>|g;
     # Change e.g. 
     #     @xref{Viewing}
     # into
     #     <a href="#Viewing">see Viewing</a>
 
     #if (/\@ref/){print "AAA[$_]AAA\n";
-    s|\@ref{([^}]*)}|see <a href="#$1">$1</a>|g;
+    s|\@ref\{([^}]*)\}|see <a href="#$1">$1</a>|g;
     #print "BBB[$_]BBB\n";}
 
-    s|\@xref{([^}]*)}|see <a href="#$1">$1</a>|g;
-    s|\@pxref{([^}]*)}|see <a href="#$1">$1.</a>|g;
-    while (/\@url{([^}]*)}/) {
+    s|\@xref\{([^}]*)\}|see <a href="#$1">$1</a>|g;
+    s|\@pxref\{([^}]*)\}|see <a href="#$1">$1.</a>|g;
+    while (/\@url\{([^}]*)\}/) {
 	$the_url = $1;
-        s:\@url{[^}]*}:<a href="$the_url">\@code{$the_url}</a>:;
+        s:\@url\{[^}]*\}:<a href="$the_url">\@code{$the_url}</a>:;
     }
-    while (/\@uref{([^}]*)}/) {
+    while (/\@uref\{([^}]*)\}/) {
 	@items = split(/,/, $1);
         if ($#items == 0) {
-            s:\@uref{[^}]*}:<a href="$items[0]">$items[0]</a>:;
+            s:\@uref\{[^}]*\}:<a href="$items[0]">$items[0]</a>:;
         } elsif ($#items == 1) {
-            s:\@uref{[^}]*}:<a href="$items[0]">$items[1]</a>:;
+            s:\@uref\{[^}]*\}:<a href="$items[0]">$items[1]</a>:;
         } elsif ($#items == 2) {
-            s:\@uref{[^}]*}:\@code{$items[2]}:;
+            s:\@uref\{[^}]*\}:\@code{$items[2]}:;
         } else {
             die "Cannot have more than 3 items in a 'uref' at \"$_\"";
         }
@@ -466,17 +466,17 @@ sub sub_headings {
 sub sub_emphasis {
     s,<<,&lt&lt,g;
     s,>>,&gt&gt,g;
-    s,\@emph{([^}]*)},<em>$1</em>,g;
-    s,\@strong{([^}]*)},<b>$1</b>,g;
-    s,\@footnote{([^}]*)}, [$1],g;
-    s,\@b{([^}]*)},<b>$1</b>,g;
+    s,\@emph\{([^}]*)\},<em>$1</em>,g;
+    s,\@strong\{([^}]*)\},<b>$1</b>,g;
+    s,\@footnote\{([^}]*)\}, [$1],g;
+    s,\@b\{([^}]*)\},<b>$1</b>,g;
 
-    s,\@code{([^}]*)},`<font color="$ex_color"><code>$1</code></font>',g;
+    s,\@code\{([^}]*)\},`<font color="$ex_color"><code>$1</code></font>',g;
     s,\@\@,\@,g;
-    s,\@samp{([^}]*)},`<font color="$ex_color"><samp>$1</samp></font>',g;
-    s,\@key{([^}]*)},`<font color="$ex_color"><kbd>$1</kbd></font>',g;
-    s,\@kbd{([^}]*)},`<font color="$ex_color"><kbd>$1</kbd></font>',g;
-    s,\@file{([^}]*)},`<font color="$ex_color"><samp>$1</samp></font>',g;
+    s,\@samp\{([^}]*)\},`<font color="$ex_color"><samp>$1</samp></font>',g;
+    s,\@key\{([^}]*)\},`<font color="$ex_color"><kbd>$1</kbd></font>',g;
+    s,\@kbd\{([^}]*)\},`<font color="$ex_color"><kbd>$1</kbd></font>',g;
+    s,\@file\{([^}]*)\},`<font color="$ex_color"><samp>$1</samp></font>',g;
     s,TEXINFO2HTML-CLOSE-BRACE,},g;
     s,TEXINFO2HTML-AT-AT,\@,g;
     s,TEXINFO2HTML-ACCENT-ACUTE-a,&#225,g;