Mercurial > hg > batmud > ggrtf
annotate docs/tfdoc.pl @ 1682:de46e2e23c66
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Apr 2024 23:03:33 +0300 |
parents | acd73fb8402f |
children |
rev | line source |
---|---|
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 #!/usr/bin/perl -w |
1642 | 2 ### |
3 ### TFDoc for extending GgrTF DocBook manual with embedded TF docs. | |
4 ### Programmed by Matti 'ccr' Hamalainen <ccr@tnsp.org> | |
1682 | 5 ### (C) Copyright 2009-2024 Tecnic Software productions (TNSP) |
1642 | 6 ### |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 use strict; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 use warnings; |
1682 | 9 use utf8; |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 |
1642 | 11 |
1054
04d9510b9591
Convert special characters to XML entities when processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1051
diff
changeset
|
12 ## Convert special characters to HTML/XML entities |
04d9510b9591
Convert special characters to XML entities when processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1051
diff
changeset
|
13 sub xmlentities($) |
04d9510b9591
Convert special characters to XML entities when processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1051
diff
changeset
|
14 { |
1682 | 15 my ($value) = @_; |
1622 | 16 $value =~ s/&/&/g; |
17 $value =~ s/</</g; | |
18 $value =~ s/>/>/g; | |
1054
04d9510b9591
Convert special characters to XML entities when processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1051
diff
changeset
|
19 return $value; |
04d9510b9591
Convert special characters to XML entities when processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1051
diff
changeset
|
20 } |
04d9510b9591
Convert special characters to XML entities when processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1051
diff
changeset
|
21 |
1642 | 22 |
1424
6a0876dfc9d4
Handle TFDoc @desc lines differently when it comes to entity expansion.
Matti Hamalainen <ccr@tnsp.org>
parents:
1070
diff
changeset
|
23 sub xmlentities2($) |
6a0876dfc9d4
Handle TFDoc @desc lines differently when it comes to entity expansion.
Matti Hamalainen <ccr@tnsp.org>
parents:
1070
diff
changeset
|
24 { |
1682 | 25 my ($value) = @_; |
1622 | 26 $value =~ s/&/&/g; |
1560 | 27 |
28 my $str = ""; | |
29 my $state = 0; | |
30 foreach my $qch (split(//, $value)) | |
31 { | |
32 if ($qch eq "\$") | |
33 { | |
34 $state = !$state; | |
35 $str .= ($state ? "<emphasis>" : "</emphasis>"); | |
36 } | |
37 else | |
38 { | |
39 $str .= $qch; | |
40 } | |
41 } | |
42 return $str; | |
1424
6a0876dfc9d4
Handle TFDoc @desc lines differently when it comes to entity expansion.
Matti Hamalainen <ccr@tnsp.org>
parents:
1070
diff
changeset
|
43 } |
6a0876dfc9d4
Handle TFDoc @desc lines differently when it comes to entity expansion.
Matti Hamalainen <ccr@tnsp.org>
parents:
1070
diff
changeset
|
44 |
1054
04d9510b9591
Convert special characters to XML entities when processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1051
diff
changeset
|
45 |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 ### Scan one TinyFugue script file for documentation entries |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 sub scan_file($) |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
48 { |
1682 | 49 my ($filename) = @_; |
50 | |
51 print STDERR "Scanning '".$filename."'\n"; | |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 my $data = {}; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 my $cmd = ""; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 my $sect = ""; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
55 my %bindtypes = ("c" => "cast", "g" => "general", "s" => "skill"); |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 |
1682 | 57 open(my $fh, "<:encoding(iso-8859-1)", $filename) or die("Could not open '".$filename."' for reading.\n"); |
58 while (defined(my $line = <$fh>)) | |
1621 | 59 { |
1682 | 60 chomp($line); |
61 if ($line =~ /\/prdef(c|g|b)bind\s+-s\"(.+?)\"\s+-c\"(.+?)\"\s*(.*)$/) | |
1621 | 62 { |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 my $opts = $4; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
64 my $type = $bindtypes{$1}; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
65 my $tmp = {}; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
66 $tmp->{"name"} = $2; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 $tmp->{"desc"} = $3; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
68 $tmp->{"quiet"} = ($opts =~ /-q/) ? 1 : 0; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
69 $tmp->{"notarget"} = ($opts =~ /-n/) ? 1 : 0; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 push(@{$data->{"binds"}{$type}}, $tmp); |
1621 | 71 } |
1682 | 72 elsif ($line =~ /;\s*\@keybind\s+(.*?)\s*=\s*(.*?)$/) |
1621 | 73 { |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
74 $data->{"keybinds"}{$1} = $2; |
1621 | 75 } |
1682 | 76 elsif ($line =~ /;\s*\@command\s+(\S+)\s*?(.*)$/) |
1621 | 77 { |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
78 $cmd = $1; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
79 $sect = "commands"; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
80 $data->{$sect}{$cmd}{"opts"} = $2; |
1621 | 81 } |
1682 | 82 elsif ($line =~ /;\s*\@desc\s+(.*)$/) |
1621 | 83 { |
84 if ($sect ne "" && $cmd ne "") | |
85 { | |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
86 $data->{$sect}{$cmd}{"desc"} .= $1." "; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
87 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
88 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
89 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
90 |
1682 | 91 close($fh); |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
92 return $data; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
93 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
94 |
1621 | 95 |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
96 ### Print out a DocBook SGML/XML table header |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 sub table_start |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
98 { |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
99 my $title = shift; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 my $cols = shift; |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
101 |
1621 | 102 print |
103 "<table>\n". | |
1682 | 104 " <title>".$title."</title>\n". |
105 " <tgroup cols=\"".$cols."\" align=\"left\">\n". | |
1621 | 106 " <thead>\n". |
107 " <row>\n"; | |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
108 |
1621 | 109 foreach my $col (@_) |
110 { | |
1682 | 111 print " <entry>".$col."</entry>\n"; |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
112 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
113 |
1621 | 114 print |
115 " </row>\n". | |
116 " </thead>\n". | |
117 " <tbody>\n"; | |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
118 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 sub table_end |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
121 { |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
122 print |
1621 | 123 " </tbody>\n". |
124 " </tgroup>\n". | |
125 "</table>\n"; | |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
127 |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 |
1061 | 129 sub handle_directive($$$$$) |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
130 { |
1061 | 131 my ($mode, $title, $currfile, $files, $linen) = @_; |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 |
1682 | 133 die("Directive '\@".$mode." ". $title."' found, but no \@file directive set before it on line ".$linen.".\n") |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
134 unless defined($currfile); |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
135 |
1621 | 136 if ($mode eq "keybinds") |
137 { | |
138 # Keyboard bindings | |
139 if (defined($files->{$currfile}{"keybinds"})) | |
140 { | |
141 my $data = $files->{$currfile}{"keybinds"}; | |
142 table_start((defined($title) ? xmlentities($title)." k" : "K")."eybindings", "2", "Key(s)", "Function"); | |
143 foreach my $tmp (sort keys %{$data}) | |
144 { | |
145 print | |
146 " <row><entry>".xmlentities($tmp)."</entry>". | |
1054
04d9510b9591
Convert special characters to XML entities when processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1051
diff
changeset
|
147 "<entry>".xmlentities($data->{$tmp})."</entry></row>\n"; |
1621 | 148 } |
149 table_end(); | |
150 } | |
151 } | |
152 elsif ($mode eq "binds") | |
153 { | |
154 # Command bindings | |
155 if (defined($files->{$currfile}{"binds"})) | |
156 { | |
157 my $data = $files->{$currfile}{"binds"}; | |
158 foreach my $type (sort keys %{$data}) | |
159 { | |
160 my $entry = $data->{$type}; | |
1682 | 161 table_start((defined($title) ? xmlentities($title)." " : "")."'".$type."' type command bindings", "4", "Command", "Quiet", "NoTarget", "Description"); |
1621 | 162 foreach my $entry (sort @{$data->{$type}}) |
163 { | |
164 print | |
165 " <row><entry>".xmlentities($entry->{"name"})."</entry>". | |
166 "<entry>".($entry->{"quiet"} ? "X" : "")."</entry>". | |
167 "<entry>".($entry->{"notarget"} ? "X" : "")."</entry>". | |
168 "<entry>".xmlentities($entry->{"desc"})."</entry></row>\n"; | |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
169 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
170 table_end(); |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
171 } |
1621 | 172 } |
173 } | |
174 elsif ($mode eq "commands") | |
175 { | |
176 # Macro commands | |
177 if (defined($files->{$currfile}{"commands"})) | |
178 { | |
179 my $data = $files->{$currfile}{"commands"}; | |
180 | |
181 table_start((defined($title) ? xmlentities($title)." m" : "M")."acro commands", "2", "Command", "Description"); | |
182 foreach my $tmp (sort keys %{$data}) | |
183 { | |
184 print | |
185 " <row><entry><emphasis>".xmlentities($tmp)."</emphasis> ".xmlentities($data->{$tmp}{"opts"})."</entry>". | |
186 "<entry>".xmlentities2($data->{$tmp}{"desc"}). | |
187 "</entry></row>\n"; | |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
188 } |
1621 | 189 table_end(); |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
190 } |
1621 | 191 } |
192 else | |
193 { | |
1682 | 194 die("Invalid/unsupported directive '\@".$mode." ".$title."' on line ".$linen.".\n"); |
1621 | 195 } |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
196 } |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
197 |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
198 |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
199 ### |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
200 ### Main program |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
201 ### |
1061 | 202 my $basepath = shift or die("Usage: <tfdir basepath> < input.sgml > output.sgml\n"); |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
203 |
1682 | 204 print STDERR "Using TF-basepath '".$basepath."'\n"; |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
205 |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
206 binmode(STDOUT, ":utf8"); |
1061 | 207 binmode(STDIN, ":utf8"); |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
208 |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
209 my $linen = 0; |
1051 | 210 my ($currfile, $currtitle); |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
211 my $files = {}; |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
212 |
1682 | 213 while (defined (my $line = <STDIN>)) |
214 { | |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
215 $linen++; |
1682 | 216 |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
217 # Get module filenames from section titles |
1682 | 218 if ($line =~ /<title>(.*?)\((\S+?\.tf)\)<\/title>/) |
1621 | 219 { |
1682 | 220 print $line; |
1051 | 221 $currtitle = $1; |
222 $currfile = $2; | |
1621 | 223 if (!defined($files->{$currfile})) |
224 { | |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
225 $files->{$currfile} = scan_file($basepath.$currfile); |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
226 } |
1621 | 227 } |
1682 | 228 elsif ($line =~ /<!--\s*\@file\s+\"(.+?)\"\s+\"(.+?)\"\s*-->/) |
1621 | 229 { |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
230 $currfile = $1; |
1051 | 231 $currtitle = $2; |
1621 | 232 if (!defined($files->{$currfile})) |
233 { | |
1047
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
234 $files->{$currfile} = scan_file($basepath.$currfile); |
4451f1a1467a
Modularize the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1044
diff
changeset
|
235 } |
1621 | 236 } |
1682 | 237 elsif ($line =~ /<!--\s*\@([a-z]+)\s+\"(.+?)\"\s*-->/) |
1621 | 238 { |
1061 | 239 handle_directive($1, $2, $currfile, $files, $linen); |
1621 | 240 } |
1682 | 241 elsif ($line =~ /<!--\s*\@([a-z]+)\s*-->/) |
1621 | 242 { |
1061 | 243 handle_directive($1, $currtitle, $currfile, $files, $linen); |
1621 | 244 } |
245 else | |
246 { | |
1682 | 247 print $line; |
1044
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
248 } |
d8b504e5b356
Imported initial implementation of TFDoc, an extremely simplistic embedded documentation extractor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
249 } |