ref2html.cpp
Go to the documentation of this file.
1/** ref2html.cpp Utility to generate a html documents from fref files */
2
3/* FAU Discrete Event Systems Library (libfaudes)
4
5Copyright (C) 2011 Thomas Moor
6
7This library is free software; you can redistribute it and/or
8modify it under the terms of the GNU Lesser General Public
9License as published by the Free Software Foundation; either
10version 2.1 of the License, or (at your option) any later version.
11
12This library is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public
18License along with this library; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
20
21
22/*
23
24Note: in its current state, this utility is badly organized.
25
26Issues include
27- preformance (linear searchs)
28- normalised section labels etc
29- global configuration data
30- embedded HTML fragments
31... however, it does its job
32
33*/
34
35
36
37#include <string>
38#include <cctype>
39#include <ctime>
40#include <iostream>
41#include <fstream>
42#include "corefaudes.h"
43
44
45using namespace faudes;
46
47// ******************************************************************
48// error exit
49// ******************************************************************
50
51void usage_exit(const std::string& rMessage="") {
52 // ui hints
53 if(rMessage!="") {
54 std::cerr << rMessage << std::endl;
55 std::cout << "" << std::endl;
56 }
57 std::cerr << "ref2html: " << VersionString() << std::endl;
58 std::cout << "" << std::endl;
59 std::cerr << "utility to generate HTML from libFAUDES reference pages (*.fref)" << std::endl;
60 std::cerr << std::endl << "usage: " << std::endl;
61 std::cerr << " ref2html [options...] <fref-file> <html-file>" << std::endl;
62 std::cerr << " ref2html [options...] <fref-file 1> [...] <fref-file n> <html-dir>" << std::endl;
63 std::cerr << " ref2html [options...] <fref-dir> <html-dir>" << std::endl;
64 std::cerr << "with options as follows:" << std::endl;
65 std::cerr << " -rti <rti-file> use specified run-time-interface definition" << std::endl;
66 std::cerr << " -flx <flx-file> use specified lua-extension file" << std::endl;
67 std::cerr << " -css <css-file> use specified style sheet" << std::endl;
68 std::cerr << " -cnav <fref-file> use specified chapter navigation file" << std::endl;
69 std::cerr << " -chapter <label> overwrite chapter label" << std::endl;
70 std::cerr << " -section <label> overwrite section label" << std::endl;
71 std::cerr << " -rel <prefix> prefix to chapter documentation base" << std::endl;
72 std::cerr << " -inc <fref-file> include table of contents" << std::endl;
73 std::cerr << std::endl << std::endl;
74 std::cerr << " ref2html -toc <fref-files> <output-file>" << std::endl;
75 std::cerr << "to generate table of contents file" << std::endl;
76 std::cerr << std::endl << std::endl;
77 std::cerr << " ref2html -doxheader <output-file>" << std::endl;
78 std::cerr << " ref2html -doxfooter <output-file>" << std::endl;
79 std::cerr << "to generate header/footer for c++ api documentation" << std::endl;
80 std::cerr << std::endl << std::endl;
81 std::cerr << " ref2html -extract <input-file> <output-directory>" << std::endl;
82 std::cerr << "to extract multiple reference pages from one file" << std::endl;
83 std::cerr << std::endl;
84 std::cerr << std::endl << "note: use \"-\" as output file for console output" << std::endl;
85 exit(1);
86}
87
88
89// ******************************************************************
90// configuration
91// ******************************************************************
92
94
95std::string mFrefTitle="";
96std::string mFrefChapter="";
97std::string mFrefSection="";
98std::string mFrefPage="";
99std::string mFrefLink="";
100std::string mFrefSummary="";
101
102std::string mRtiFile="";
103std::string mFlxFile="";
104std::string mDstFile="";
105std::set< std::string > mSrcFiles;
106std::string mChapterFile="";
107std::string mIncludeFile="";
108
109std::string mBooksPrefix="../";
110std::string mChaptersPrefix="./";
111std::string mImagePrefix="./images/";
112std::string mReferencePrefix="./reference/";
113std::string mCsourcePrefix="./csource/";
114std::string mLuafaudesPrefix="./luafaudes/";
115
116/*
117std::string mDownloadLink="http://www.rt.eei.uni-erlangen.de/FGdes/download.html";
118std::string mFaudesLink="http://www.rt.eei.uni-erlangen.de/FGdes/faudes";
119std::string mDestoolLink="http://www.rt.eei.uni-erlangen.de/FGdes/destool";
120std::string mLuafaudesLink="http://www.rt.eei.uni-erlangen.de/FGdes/faudes/luafaudes/";
121std::string mCsourceLink="http://www.rt.eei.uni-erlangen.de/FGdes/faudes/csource/";
122std::string mCssFile="faudes.css";
123*/
124
125std::string mDownloadLink="http://fgdes.tf.fau.de/download.html";
126std::string mFaudesLink="http://fgdes.tf.fau.de/faudes";
127std::string mDestoolLink="http://fgdes.tf.fau.de/destool";
128std::string mLuafaudesLink="http://fgdes.tf.fau.de/faudes/luafaudes/";
129std::string mCsourceLink="http://fgdes.tf.fau.de/faudes/csource/";
130std::string mCssFile="faudes.css";
131
132std::string mThisChapterClass="chapter_this";
133std::string mOtherChapterClass="chapter_other";
134std::string mExitChapterClass="chapter_exit";
135
136// ******************************************************************
137// configure: set my chapter prefix
138// ******************************************************************
139
140void ChaptersPrefix(const std::string& prefix) {
141 mChaptersPrefix=prefix;
142 mBooksPrefix=prefix+"../";
143 mImagePrefix=prefix+"images/";
144 mReferencePrefix=prefix+"reference/";
145 mCsourcePrefix=prefix+"csource/";
146 mLuafaudesPrefix=prefix+"luafaudes/";
147 mCssFile=prefix+mCssFile;
148}
149
150// ******************************************************************
151// helper: time stamp
152// ******************************************************************
153
154std::string TimeStamp(void) {
155 time_t now;
156 struct tm * local;
157 char buffer[80];
158 time(&now );
159 local=localtime(&now);
160 strftime(buffer,80,"%Y.%m.%d",local);
161 return std::string(buffer);
162}
163
164
165// ******************************************************************
166// helper: convert page to printable
167// ******************************************************************
168
169std::string PrettyPage(const std::string page){
170 // swallow page number
171 std::string ppage = page;
172 std::size_t upos = ppage.find_first_of("_");
173 std::size_t spos = ppage.find_first_of(" ");
174 std::size_t dpos = 0;
175 for(; dpos < ppage.size();dpos++)
176 if(!isdigit(ppage.at(dpos))) break;
177 if(upos!=std::string::npos)
178 if(upos==dpos)
179 if(upos+1<ppage.size())
180 ppage=ppage.substr(upos+1,ppage.size()-upos-1);
181 if(spos!=std::string::npos)
182 if(spos==dpos)
183 if(spos+1<ppage.size())
184 ppage=ppage.substr(spos+1,ppage.size()-spos-1);
185 // turn underscore to space
186 ppage=StringSubstitute(ppage,"_"," ");
187 // done
188 return ppage;
189}
190
191
192// ******************************************************************
193// helper: bottom line
194// ******************************************************************
195
196void BottomLineHtml(std::ostream* pStream) {
197 *pStream << "<p class=\"bottom_line\"> " << std::endl;
198 *pStream << "<a href=\"" << mFaudesLink << "\" target=\"_top\">" << VersionString() << "</a> " << std::endl;
199 *pStream << "--- " << TimeStamp() << " " << std::endl;
200 if(PluginsString()!="" && mFrefChapter!="cppapi")
201 *pStream << "--- with &quot;" << PluginsString() << "&quot; " << std::endl;
202 if(mFrefChapter=="cppapi")
203 *pStream << "--- c++ api documentaion by <a href=\"http://www.doxygen.org\" target=\"_top\">doxygen</a>" << std::endl;
204 *pStream << "</p>" << std::endl;
205 if(mFrefChapter=="reference") {
206 *pStream << "<!--[if IE]>" << std::endl;
207 *pStream << "<p class=\"bottom_line_warning\">" << std::endl;
208 *pStream << "If MS Internet Explorer fails to display certain mathematical symbols," << std::endl;
209 *pStream << "your system misses the corresponding unicode fonts." << std::endl;
210 *pStream << "<br>" << std::endl;
211 *pStream << "You may either install &quot;Arial Unicode MS&quot; from a recent MS Office package" << std::endl;
212 *pStream << "or the freely available" << std::endl;
213 *pStream << "&quot;<a href=\"http://greekfonts.teilar.gr/\">Symbola</a>&quot;" << std::endl;
214 *pStream << "<br>" << std::endl;
215 *pStream << "See also <a href=\"http://www.alanwood.net/\">Allan Woods</a> unicode page." << std::endl;
216 *pStream << "B.t.w.: <a href=\"http://www.mozilla.com\">Firefox</a> will display" << std::endl;
217 *pStream << "all relevant symbols out-of-the-box and nicely render SVG diagrams." << std::endl;
218 *pStream << "<br>" << std::endl;
219 *pStream << "<br>" << std::endl;
220 *pStream << "</p>" << std::endl;
221 *pStream << "<![endif]-->" << std::endl;
222 }
223}
224
225
226// ******************************************************************
227// helper: html header
228// ******************************************************************
229
230void HeaderHtml(std::ostream* pStream) {
231 *pStream << "<!doctype html>" << std::endl;
232 *pStream << "<html xmlns=\"http://www.w3.org/1999/xhtml\">" << std::endl;
233 *pStream << "<head>" << std::endl;
234 *pStream << "<title>" << mFrefTitle << "</title>" << std::endl;
235 *pStream << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />" << std::endl;
236 *pStream << "<meta name=\"contents\" content=\"discrete event systems, libFAUDES, supervisory control, controller synthesis, automata, software library, regular languages, open source, GPL.\"/>" << std::endl;
237 *pStream << "<link href=\"" << mCssFile << "\" rel=\"stylesheet\" type=\"text/css\" />" << std::endl;
238 *pStream << "<link rel=\"shortcut icon\" href=\""<< mImagePrefix << "des.ico\">" << std::endl;
239 *pStream << "</head>" << std::endl;
240 *pStream << "<body>" << std::endl;
241 *pStream << "<div id=\"cwrapper1000\">" << std::endl;
242 *pStream << "<div id=\"dwrapper1000\">" << std::endl;
243}
244
245// ******************************************************************
246// helper: html footer
247// ******************************************************************
248
249void FooterHtml(std::ostream* pStream) {
250 *pStream << "</div>" << std::endl;
251 *pStream << "</div>" << std::endl;
252 *pStream << "</body>" << std::endl;
253 *pStream << "</html>" << std::endl;
254}
255
256// ******************************************************************
257// helper: html for image
258// ******************************************************************
259
260void ImageHtml(std::ostream* pStream, const std::string& rFileName) {
261 *pStream << "<a class=\"faudes_image\" href=\"" << mImagePrefix << rFileName << ".html\">";
262 *pStream << "<img src=\"" << mImagePrefix << rFileName << ".png\"/>";
263 *pStream << "</a>";
264}
265
266// ******************************************************************
267// helper: fancy reference for resgistry list
268// ******************************************************************
269
270
271void ListItemHtml(std::ostream* pStream, const std::string& rLink, const std::string& rText) {
272 *pStream << "<li class=\"registry_item\">" << std::endl
273 << "<a href=\"" << rLink << "\">" << rText << "</a>" << std::endl
274 << "<a href=\"" << rLink << "\" class=\"registry_blinda\">&nbsp;</a>" << std::endl
275 << "</li>" << std::endl;
276 }
277
278// ******************************************************************
279// helper: html for linked type name
280// ******************************************************************
281
282void TypeHtml(std::ostream* pStream, const std::string& rTypeName) {
283
284 // just text if unknown
285 if(!TypeRegistry::G()->Exists(rTypeName)) {
286 *pStream << rTypeName;
287 return;
288 }
289
290 // retrieve definition
291 const TypeDefinition& tdef=TypeRegistry::G()->Definition(rTypeName);
292 std::string tyname = tdef.Name();
293 std::string tyhtml = tdef.HtmlDoc();
294 if(tyhtml=="" || tyhtml=="none") {
295 *pStream << tyname;
296 } else {
297 *pStream << "<a href=\"" << mReferencePrefix << tyhtml << "\">" << tyname << "</a>";
298 }
299}
300
301
302// ******************************************************************
303// helper: html for linked function name
304// ******************************************************************
305
306void FunctionHtml(std::ostream* pStream, const std::string& rFunctionName) {
307
308 // just text if unknown
309 if(!FunctionRegistry::G()->Exists(rFunctionName)) {
310 *pStream << rFunctionName;
311 return;
312 }
313
314 // retrieve definition
315 const FunctionDefinition& fdef=FunctionRegistry::G()->Definition(rFunctionName);
316 std::string fname = fdef.Name();
317 std::string fhtml = fdef.HtmlDoc();
318 if(fhtml=="" || fhtml=="none") {
319 *pStream << fname;
320 } else {
321 *pStream << "<a href=\"" << mReferencePrefix << fhtml << "\">" << fname << "</a>";
322 }
323}
324
325// ******************************************************************
326// helper: html for ascii text
327// ******************************************************************
328
329void TextHtml(std::ostream* pStream, const std::string& rText) {
330 std::string buff;
331 buff=StringSubstitute(buff,"<","&lt;");
332 buff=StringSubstitute(buff,">","&gt;");
333 buff=StringSubstitute(buff,"&","&amp;");
334 *pStream << buff;
335}
336
337// ******************************************************************
338// helper: html for math
339// (we really need at least regex here!)
340// ******************************************************************
341
342// resolve simple one-arg macros
343std::string TexMacroSubstitute1(const std::string& rTexString, const std::string& rMacro, const std::string& rSubst) {
344 // prep result
345 std::string res;
346 std::size_t pos=0;
347 // loop over occurences of "macro"
348 while(pos<rTexString.length()) {
349 std::size_t next=rTexString.find(rMacro,pos);
350 if(next==std::string::npos) break;
351 res.append(rTexString.substr(pos,next-pos));
352 std::string arg;
353 pos=next+rMacro.length();
354 if(!(pos+1<rTexString.length())) continue;
355 if(rTexString.at(pos)!='{') continue;
356 std::size_t aend=rTexString.find('}',pos);
357 if(aend==std::string::npos) break;
358 arg=rTexString.substr(pos+1,aend-pos-1);
359 arg=StringSubstitute(rSubst,"#1",arg);
360 res.append(arg);
361 pos=aend+1;
362 }
363 // get end
364 if(pos<rTexString.length())
365 res.append(rTexString.substr(pos));
366 // done
367 return res;
368}
369
370
371// mimique tex spacing
372std::string TexSpacing(const std::string& rTexString) {
373 // prep result
374 std::string res;
375 std::size_t pos=0;
376 bool math=true;
377 // traverse string
378 while(pos<rTexString.length()) {
379 // explict: "\ "
380 if(pos+1 < rTexString.length())
381 if(rTexString.substr(pos,2)=="\\ ")
382 {pos+=2; res.append("&nbsp;"); continue;}
383 // explicit: "\,"
384 if(pos+1 < rTexString.length())
385 if(rTexString.substr(pos,2)=="\\,")
386 {pos+=2; res.append("&ensp;"); continue;}
387 // explicit: "\;"
388 if(pos+1 < rTexString.length())
389 if(rTexString.substr(pos,2)=="\\;")
390 {pos+=2; res.append("&ensp;"); continue;}
391 // explict: "\quad"
392 if(pos+4 < rTexString.length())
393 if(rTexString.substr(pos,5)=="\\quad")
394 {pos+=5; res.append("&nbsp;&nbsp;&nbsp;&nbsp;"); continue;}
395 // math swallow space
396 if(math)
397 if(isspace(rTexString.at(pos)))
398 { pos+=1; continue;}
399 // sense end of math mode
400 if(math)
401 if(pos+5 < rTexString.length())
402 if(rTexString.substr(pos,6)=="\\text{")
403 {pos+=6; math=false; continue;};
404 // sense end of text mode
405 if(!math)
406 if(rTexString.at(pos)=='}')
407 { pos+=1; math=true; continue;}
408 // default: copy
409 res.append(1,rTexString.at(pos));
410 pos+=1;
411 }
412 return res;
413}
414
415// mimique tex scripts
416std::string TexScripts(const std::string& rTexString) {
417 // prep result
418 std::string res;
419 std::size_t pos=0;
420 int c0=-1;
421 int cm1=-1;
422 int cm2=-1;
423 // traverse string
424 while(pos<rTexString.length()) {
425 // fill buffer
426 cm2=cm1; cm1=c0; c0=rTexString.at(pos);
427 // full script
428 if(cm1=='^' || cm1=='_')
429 if(c0=='{') {
430 std::size_t aend=rTexString.find('}',pos);
431 if(aend==std::string::npos) break;
432 std::string script=rTexString.substr(pos+1,aend-pos-1);
433 res.append(1,cm1);
434 res.append(script);
435 cm1=-1; cm2=-1; pos=aend+1;
436 continue;
437 }
438 // superscript uparrow
439 if(cm1=='^')
440 if(c0=='\\') {
441 size_t mpos=rTexString.find("\\uparrow",pos);
442 if(mpos==pos) {
443 res.append("<span class=\"faudes_sup\">&uarr;</span>");
444 cm1=-1; cm2=-1; pos+=8;
445 continue;
446 }
447 }
448 // superscript uparrow
449 if(cm1=='^')
450 if(c0=='\\') {
451 size_t mpos=rTexString.find("\\Uparrow",pos);
452 if(mpos==pos) {
453 res.append("<span class=\"faudes_sup\">&#x21e7;</span>");
454 cm1=-1; cm2=-1; pos+=8;
455 continue;
456 }
457 }
458 // digit subscript
459 if(cm1=='_')
460 if(isalpha(cm2))
461 if(isdigit(c0)) {
462 res.append(1,c0);
463 cm1=-1; cm2=-1; pos+=1;
464 continue;
465 }
466 // lower subscript
467 if(cm1=='_')
468 if(islower(c0))
469 if(isupper(cm2)) {
470 res.append(1,c0);
471 cm1=-1; cm2=-1; pos+=1;
472 continue;
473 }
474 // super star
475 if(cm1=='^')
476 if(c0=='*' || c0=='+') {
477 res.append(1,c0);
478 cm1=-1; cm2=-1; pos+=1;
479 continue;
480 }
481 // other script
482 if(cm1=='^' || cm1=='_') {
483 res.append(1,cm1);
484 res.append(1,c0);
485 cm1=-1; cm2=-1; pos+=1;
486 continue;
487 }
488 // plain copy default
489 if(c0!='_')
490 if(c0!='^') {
491 res.append(1,c0);
492 }
493 // continue
494 pos+=1;
495 }
496 return res;
497}
498
499
500// over all tex processing
501void MathHtml(std::ostream* pStream, const std::string& rMathString) {
502 std::string buff=rMathString;
503 // xml quote
504 buff=StringSubstitute(buff,"&","&amp;");
505 // tex quote
506 buff=StringSubstitute(buff,"#","&hash;");
507 // greek letters
508 buff=StringSubstitute(buff,"\\Sigma","Sigma");
509 buff=StringSubstitute(buff,"\\sigma","o");
510 buff=StringSubstitute(buff,"\\delta","delta");
511 buff=StringSubstitute(buff,"\\epsilon","epsilon");
512 buff=StringSubstitute(buff,"\\omega","w");
513 buff=StringSubstitute(buff,"\\Upsilon","Upsilon");
514 buff=StringSubstitute(buff,"\\pi","pi");
515 // one-arg macros
516 buff=TexMacroSubstitute1(buff,"\\ProInv","Pinv#1");
517 buff=TexMacroSubstitute1(buff,"\\Pro","P#1");
518 buff=TexMacroSubstitute1(buff,"\\Closure","Closure(#1)");
519 buff=TexMacroSubstitute1(buff,"\\Prefix","Prefix(#1)");
520 buff=TexMacroSubstitute1(buff,"\\CtrlPfx","CtrlPfx(#1)");
521 buff=TexMacroSubstitute1(buff,"\\Shape","Shape(#1)");
522 // tex math spacing and plain text
523 buff=TexMacroSubstitute1(buff,"\\texttt","\\text{<tt>#1</tt>}");
524 buff=TexMacroSubstitute1(buff,"\\mathtt","\\text{<tt>#1</tt>}");
525 buff=TexMacroSubstitute1(buff,"\\textit","\\text{<i>#1</i>}");
526 buff=TexMacroSubstitute1(buff,"\\mathit","\\text{<i>#1</i>}");
527 buff=TexMacroSubstitute1(buff,"\\mathsf","\\text{<sf>#1</sf>}");
528 buff=TexMacroSubstitute1(buff,"\\mathbb","\\text{<it>#1</it>}");
529 buff=TexMacroSubstitute1(buff,"\\textbb","\\text{<it>#1</it>}");
530 buff=TexSpacing(buff);
531 // super- and subscripts
532 buff=TexScripts(buff);
533 // symbols
534 buff=StringSubstitute(buff,"\\{","{");
535 buff=StringSubstitute(buff,"\\}","}");
536 buff=StringSubstitute(buff,"\\[","[");
537 buff=StringSubstitute(buff,"\\]","]");
538 buff=StringSubstitute(buff,"=","&nbsp;=&nbsp;");
539 buff=StringSubstitute(buff,"\\colon","&nbsp:&nbsp;");
540 buff=StringSubstitute(buff,"class&nbsp;=&nbsp;","class="); // fix csss class
541 buff=StringSubstitute(buff,":&nbsp;=&nbsp;","&nbsp;:=&nbsp;"); //fix :=
542 buff=StringSubstitute(buff,"\\neq","&nbsp&ne;&nbsp;");
543 buff=StringSubstitute(buff,"\\lt","&nbsp;&lt;&nbsp;");
544 buff=StringSubstitute(buff,"\\gt","&nbsp;&gt;&nbsp;");
545 buff=StringSubstitute(buff,"\\le","&nbsp;&le;&nbsp;");
546 buff=StringSubstitute(buff,"\\ge","&nbsp;&ge;&nbsp;");
547 buff=StringSubstitute(buff,"\\emptyset","0");
548 buff=StringSubstitute(buff,"\\times","&nbsp;x&nbsp;");
549 buff=StringSubstitute(buff,"\\ldots","...");
550 buff=StringSubstitute(buff,"\\cdots","...");
551 buff=StringSubstitute(buff,"\\cdot",".");
552 buff=StringSubstitute(buff,"\\infty","&infin;");
553 buff=StringSubstitute(buff,"\\inf","inf");
554 buff=StringSubstitute(buff,"\\in","&nbsp;&isin;&nbsp;");
555 buff=StringSubstitute(buff,"\\nin","&nbsp;&notin;&nbsp;");
556 buff=StringSubstitute(buff,"\\not\\in","&nbsp;&notin;&nbsp;");
557 buff=StringSubstitute(buff,"\\subseteq","&nbsp;&sube;&nbsp;");
558 buff=StringSubstitute(buff,"\\subset","&nbsp;&sub;&nbsp;");
559 buff=StringSubstitute(buff,"\\supseteq","&nbsp;&supe;&nbsp;");
560 buff=StringSubstitute(buff,"\\supset","&nbsp;&sup;&nbsp;");
561 buff=StringSubstitute(buff,"\\cup","&cup;");
562 buff=StringSubstitute(buff,"\\dcup","&cup;"); // should be "&cup;&#775;" for "dot above"
563 buff=StringSubstitute(buff,"\\cap","&cap;");
564 buff=StringSubstitute(buff,"\\sup","sup");
565 buff=StringSubstitute(buff,"\\max","max");
566 buff=StringSubstitute(buff,"\\min","min");
567 buff=StringSubstitute(buff,"\\parallel","||");
568 buff=StringSubstitute(buff,"\\forall","&forall;&nbsp;");
569 buff=StringSubstitute(buff,"\\exists","&exist;&nbsp;");
570 buff=StringSubstitute(buff,"\\leftarrow","&larr;");
571 buff=StringSubstitute(buff,"\\rightarrow","&rarr;");
572 buff=StringSubstitute(buff,"\\leftrightarrow","&harr;");
573 buff=StringSubstitute(buff,"\\Leftarrow","&lArr;");
574 buff=StringSubstitute(buff,"\\Rightarrow","&rArr;");
575 buff=StringSubstitute(buff,"\\Leftrightarrow","&hArr;");
576 buff=StringSubstitute(buff,"\\uparrow","&uarr;");
577 buff=StringSubstitute(buff,"\\downarrow","&darr;");
578 buff=StringSubstitute(buff,"\\Uparrow","&#x21e7;");
579 buff=StringSubstitute(buff,"\\Downarrow","&#x21e9;");
580 // ie7 fallback symbols
581 /*
582 buff=StringSubstitute(buff,"&isin;","<span class=\"faudes_fmath\">&isin;</span>");
583 buff=StringSubstitute(buff,"&notin;","<span class=\"faudes_fmath\">&notin;</span>");
584 buff=StringSubstitute(buff,"&exist;","<span class=\"faudes_fmath\">&exist;</span>");
585 buff=StringSubstitute(buff,"&forall;","<span class=\"faudes_fmath\">&forall;</span>");
586 buff=StringSubstitute(buff,"&cup;","<span class=\"faudes_fmath\">&cup;</span>");
587 buff=StringSubstitute(buff,"&dcup;","<span class=\"faudes_fmath\">&cup;</span>"); // see above
588 buff=StringSubstitute(buff,"&cap;","<span class=\"faudes_fmath\">&cap;</span>");
589 buff=StringSubstitute(buff,"&larr;","<span class=\"faudes_fmath\">&larr;</span>");
590 buff=StringSubstitute(buff,"&rarr;","<span class=\"faudes_fmath\">&rarr;</span>");
591 buff=StringSubstitute(buff,"&harr;","<span class=\"faudes_fmath\">&harr;</span>");
592 buff=StringSubstitute(buff,"&lArr;","<span class=\"faudes_fmath\">&lArr;</span>");
593 buff=StringSubstitute(buff,"&rArr;","<span class=\"faudes_fmath\">&rArr;</span>");
594 buff=StringSubstitute(buff,"&hArr;","<span class=\"faudes_fmath\">&hArr;</span>");
595 buff=StringSubstitute(buff,"&sub;","<span class=\"faudes_fmath\">&sub;</span>");
596 buff=StringSubstitute(buff,"&sube;","<span class=\"faudes_fmath\">&sube;</span>");
597 buff=StringSubstitute(buff,"&sup;","<span class=\"faudes_fmath\">&sup;</span>");
598 buff=StringSubstitute(buff,"&supe;","<span class=\"faudes_fmath\">&supe;</span>");
599 */
600 // done
601 *pStream << buff;
602}
603
604
605// ******************************************************************
606// record pages
607// ******************************************************************
608
609
610// section lists (from reading rti/flx)
611std::set< std::string > mExclLuaSections;
612std::set< std::string > mInclLuaSections;
613
614// page data
616public:
617 std::string mTitle;
618 std::string mChapter;
619 std::string mSection;
620 std::string mPage;
621 std::string mLink;
622 std::string mSummary;
623};
624
625
626// record all pages
627std::vector<PageRecord> mAllPages;
628
629// record all pages within reference section (keys to lower)
630std::map< std::string , std::map< std::string , PageRecord > > mRefSectPages;
631
632// extract page data (works with both, *.flx and *.ftoc)
634 // record my level
635 int clevel = rTr.Level();
636 // std::cerr << "process level " << clevel << "\n";
637 // token loop
638 while(true) {
639 // skip plain text
640 std::string text;
641 rTr.ReadCharacterData(text);
642 if(text.size()>0) continue;
643 // break on no token or end of my level
644 Token token;
645 if(!rTr.Peek(token)) break;
646 if(token.IsEnd() && !token.IsBegin() && rTr.Level()==clevel)
647 break;
648 // ignore irrelevant
649 if(!token.IsBegin("ReferencePage")) {
650 rTr.Get(token);
651 continue;
652 }
653 // take my section
654 rTr.ReadBegin("ReferencePage");
655 // extract page data
656 mFrefChapter="";
657 if(token.ExistsAttributeString("chapter"))
658 mFrefChapter=token.AttributeStringValue("chapter");
659 mFrefSection="";
660 if(token.ExistsAttributeString("section"))
661 mFrefSection=token.AttributeStringValue("section");
662 mFrefPage="";
663 if(token.ExistsAttributeString("page"))
664 mFrefPage=token.AttributeStringValue("page");
665 mFrefTitle="";
666 if(token.ExistsAttributeString("title"))
667 mFrefTitle=token.AttributeStringValue("title");
668 mFrefLink=ExtractBasename(rTr.FileName())+".html";;
669 if(token.ExistsAttributeString("link"))
670 mFrefLink=token.AttributeStringValue("link");
671 // find optional findexdoc
672 mFrefSummary="";
673 if(rTr.ExistsBegin("fsummary")) {
674 rTr.ReadBegin("fsummary");
676 rTr.ReadEnd("fsummary");
677 }
678 // autodetect misslabled index pages
679 if(mFrefPage=="") {
680 std::string indexfile=mFrefSection + "_index.fref";
681 std::transform(indexfile.begin(), indexfile.end(), indexfile.begin(), tolower);
682 if(ExtractFilename(rTr.FileName())==indexfile)
683 mFrefPage="0_Index";
684 }
685 // ensure page number for index page
686 if(mFrefPage=="index") mFrefPage="Index";
687 if(mFrefPage=="Index") mFrefPage="0_Index";
688 // autogenerate page name
689 if(mFrefPage=="") {
691 std::string title=mFrefTitle;
692 std::transform(mFrefTitle.begin(), mFrefTitle.end(), title.begin(), tolower);
693 std::string section=mFrefSection;
694 std::transform(mFrefSection.begin(), mFrefSection.end(), section.begin(), tolower);
695 std::size_t spos = title.find(section);
696 if(spos==0 && title.size()>section.size())
697 mFrefPage=mFrefPage.substr(section.size(),mFrefPage.size()-section.size());
698 for(spos=0; spos<mFrefPage.size(); spos++){
699 int c= mFrefPage.at(spos);
700 if(c==' ') continue;
701 if(c=='-') continue;
702 if(c=='_') continue;
703 break;
704 }
705 if(spos<mFrefPage.size())
706 mFrefPage=mFrefPage.substr(spos,mFrefPage.size()-spos);
707 if(mFrefPage=="Index") mFrefPage="";
708 }
709 // read end
710 rTr.ReadEnd("ReferencePage");
711 // report
712 // std::cerr << "ref2html: found chapter \"" << mFrefChapter << "\" section \"" << mFrefSection << "\"" << std::endl;
713 // record
714 PageRecord pagerec;
715 pagerec.mChapter = mFrefChapter;
716 pagerec.mSection = mFrefSection;
717 pagerec.mPage = mFrefPage;
718 pagerec.mTitle = mFrefTitle;
719 pagerec.mLink = mFrefLink;
720 pagerec.mSummary=mFrefSummary;
721 // normalize
722 std::transform(mFrefChapter.begin(), mFrefChapter.end(), mFrefChapter.begin(), tolower);
723 std::transform(mFrefSection.begin(), mFrefSection.end(), mFrefSection.begin(), tolower);
724 std::transform(mFrefPage.begin(), mFrefPage.end(), mFrefPage.begin(), tolower);
725 // insert entry
726 if(mFrefChapter!="")
727 if(mFrefChapter!="none")
728 mAllPages.push_back(pagerec);
729 // insert entry to section pages of reference
730 if(mFrefChapter=="reference")
731 if(mFrefPage!="")
732 if(mFrefPage!="none")
734 }
735}
736
737
738// dump page records to include file
740 // loop records
741 std::vector<PageRecord>::iterator pit;
742 for(pit=mAllPages.begin(); pit!=mAllPages.end(); pit++) {
743 Token btag;
744 btag.SetEmpty("ReferencePage");
745 btag.InsAttributeString("title",pit->mTitle);
746 btag.InsAttributeString("chapter",pit->mChapter);
747 btag.InsAttributeString("section",pit->mSection);
748 btag.InsAttributeString("page",pit->mPage);
749 btag.InsAttributeString("link",pit->mLink);
750 // if we have no summary, that's it
751 if(pit->mSummary=="") {
752 rTw << btag;
753 continue;
754 }
755 // summary present
756 btag.ClrEnd();
757 rTw << btag;
758 rTw.WriteBegin("fsummary");
759 rTw.WriteCharacterData(pit->mSummary);
760 rTw.WriteEnd("fsummary");
761 rTw.WriteEnd("ReferencePage");
762 }
763}
764
765
766// ******************************************************************
767// search for types
768// ******************************************************************
769
770void ListTypesHtml(std::ostream* pIndexFile, const std::string& key="") {
771
772 // table output
773 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
774 // traverse type registry
775 bool found=false;
776 for(TypeRegistry::Iterator tit=TypeRegistry::G()->Begin();
777 tit!=TypeRegistry::G()->End(); tit++) {
778 // test for exact key
779 if(key!="") {
780 std::string section= tit->second->Name();
781 std::transform(section.begin(), section.end(), section.begin(), tolower);
782 if(section!=key) continue;
783 }
784 // test for user doc
785 if(tit->second->TextDoc()=="") continue;
786 // table row
787 *pIndexFile << "<tr><td valign=\"top\">";
788 TypeHtml(pIndexFile,tit->second->Name());
789 *pIndexFile << "</td><td valign=\"top\">";
790 TypeHtml(pIndexFile,tit->second->TextDoc());
791 *pIndexFile << "</td></tr>" << std::endl;
792 // record success
793 found=true;
794 }
795 // no matches
796 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
797 // table output
798 *pIndexFile << "</table>" << std::endl;
799}
800
801// ******************************************************************
802// search for functions
803// ******************************************************************
804
805void ListFunctionsHtml(std::ostream* pIndexFile, const std::string& key="") {
806
807 // table output
808 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
809 // traverse function registry
810 bool found=false;
812 fit!=FunctionRegistry::G()->End(); fit++) {
813 // test for exact key
814 if(key!="") {
815 std::string section= fit->second->Name();
816 std::transform(section.begin(), section.end(), section.begin(), tolower);
817 if(section!=key) continue;
818 }
819 // test for user doc
820 if(fit->second->TextDoc()=="") continue;
821 // table row
822 *pIndexFile << "<tr><td valign=\"top\">";
823 FunctionHtml(pIndexFile,fit->second->Name());
824 *pIndexFile << "</td><td valign=\"top\">";
825 TypeHtml(pIndexFile,fit->second->TextDoc());
826 *pIndexFile << "</td></tr>" << std::endl;
827 // record success
828 found=true;
829 }
830 // no matches
831 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
832 // table output
833 *pIndexFile << "</table>" << std::endl;
834}
835
836// ******************************************************************
837// search for sections
838// ******************************************************************
839
840void ListSectionsHtml(std::ostream* pIndexFile, const std::string& key="") {
841
842 // here: use special key "luaext" to filter lua-extensions"
843
844 // traverse pages
845 std::set< std::string > sections;
846 std::map< std::string , std::string > link;
847 std::map< std::string , std::string > summary;
848 std::vector< PageRecord >::iterator pit;
849 for(pit=mAllPages.begin(); pit != mAllPages.end(); pit++) {
850 std::string chap=pit->mChapter;
851 std::transform(chap.begin(), chap.end(), chap.begin(), tolower);
852 std::string sect=pit->mSection;
853 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
854 std::string page=pit->mPage;
855 std::transform(page.begin(), page.end(), page.begin(), tolower);
856 page=PrettyPage(page);
857 // my chapter only
858 if(chap!="reference") continue;
859 if(sect=="none") continue;
860 if(sect=="") continue;
861 if(page!="index") continue;
862 // lua ext only
863 if(key=="luaext") {
864 if(mExclLuaSections.find(sect)!=mExclLuaSections.end()) continue;
865 if(mInclLuaSections.find(sect)==mInclLuaSections.end()) continue;
866 }
867 // get nice name
868 std::string pname = pit->mSection;
869 // use title as fallback summary
870 std::string psumm = pit->mSummary;
871 if(psumm=="") psumm = pit->mTitle;
872 // record
873 sections.insert(pname);
874 link[pname]=pit->mLink;
875 summary[pname]=psumm;
876 }
877
878 // produce sorted index with corefaudes first
879 std::vector< std::string > sortvec;
880 if(sections.find("CoreFaudes")!=sections.end())
881 sortvec.push_back("CoreFaudes");
882 std::set< std::string >::iterator sit;
883 for(sit=sections.begin(); sit != sections.end(); sit++) {
884 if(*sit=="CoreFaudes") continue;
885 sortvec.push_back(*sit);
886 }
887
888 // table output
889 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
890
891 // populate table
892 std::vector< std::string >::iterator vit;
893 bool found=false;
894 for(vit=sortvec.begin(); vit != sortvec.end(); vit++) {
895 // get nice name
896 std::string sname = *vit;
897 std::string shtml = mReferencePrefix+link[sname];
898 std::string ssumm = summary[sname];
899 // table row
900 *pIndexFile << "<tr>" << std::endl;
901 *pIndexFile << "<td valign=\"top\"><a href=\"" << shtml << "\">" << sname << "</a></td>";
902 *pIndexFile << "<td valign=\"top\">";
903 *pIndexFile << ssumm;
904 *pIndexFile << "</td></tr>"<< std::endl;
905 // record success
906 found=true;
907 }
908 // no matches
909 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
910
911 // table output
912 *pIndexFile << "</table>" << std::endl;
913}
914
915
916
917
918
919// ******************************************************************
920// Type index by keyword (aka section name)
921// ******************************************************************
922
923void TypeIndexHtml(std::ostream* pIndexFile, const std::string& key="") {
924
925 // traverse type registry
926 bool head=false;
927 for(TypeRegistry::Iterator tit=TypeRegistry::G()->Begin();
928 tit!=TypeRegistry::G()->End(); tit++)
929 {
930 // test for exact key
931 if(key!="") {
932 std::string section= tit->second->KeywordAt(0);
933 std::transform(section.begin(), section.end(), section.begin(), tolower);
934 if(section!=key) continue;
935 }
936 // get name and reference
937 std::string tyname = tit->second->Name();
938 std::string tyhtml = tit->second->HtmlDoc();
939 // no doc
940 if(tyhtml=="") continue;
941 if(tyhtml=="none") continue;
942 // head line
943 if(!head) {
944 head=true;
945 *pIndexFile << "<li class=\"registry_heading\">Types</li>" << std::endl;
946 }
947 // index entry for this type
948 ListItemHtml(pIndexFile, tyhtml, tyname);
949 }
950 // done
951 if(head) *pIndexFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
952}
953
954// ******************************************************************
955// Function index by keyword (aka plugin)
956// ******************************************************************
957
958void FunctionIndexHtml(std::ostream* pIndexFile, const std::string& key="") {
959
960 // have lower case key
961 std::string lkey=key;
962 std::transform(lkey.begin(), lkey.end(), lkey.begin(), tolower);
963
964 // traverse function registry
965 bool head=false;
967 fit!=FunctionRegistry::G()->End(); fit++)
968 {
969 // test for key
970 if(lkey!="") {
971 std::string section= fit->second->KeywordAt(0);
972 std::transform(section.begin(), section.end(), section.begin(), tolower);
973 if(section!=lkey) continue;
974 }
975 // test for user doc
976 if(fit->second->TextDoc()=="") continue;
977 // index entry for this function
978 std::string fname = fit->second->Name();
979 std::string fhtml = fit->second->HtmlDoc();
980 if(fhtml=="") continue;
981 // head line
982 if(!head){
983 head=true;
984 *pIndexFile << "<li class=\"registry_heading\">Functions</li>" << std::endl;
985 }
986 // list entry: no doc
987 if(fhtml=="none") {
988 *pIndexFile << "<li class=\"registry_item\"> "<< fname << "</li>" << std::endl;
989 continue;
990 }
991 // list entry: link
992 ListItemHtml(pIndexFile, fhtml, fname);
993 }
994
995 // done
996 if(head) *pIndexFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
997
998}
999
1000// ******************************************************************
1001// Reference index by keyword (aka section)
1002// ******************************************************************
1003
1004void ReferenceIndexHtml(std::ostream* pIndexFile, const std::string& key="") {
1005
1006 // prepare list of all sections
1007 std::map< std::string , std::string > sectlink;
1008 std::vector< PageRecord >::iterator pit;
1009 for(pit=mAllPages.begin(); pit != mAllPages.end(); pit++) {
1010 std::string chap=pit->mChapter;
1011 std::transform(chap.begin(), chap.end(), chap.begin(), tolower);
1012 std::string sect=pit->mSection;
1013 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1014 // my chapter only
1015 if(chap!="reference") continue;
1016 if(sect=="none") continue;
1017 if(sect=="") continue;
1018 // get nice name
1019 std::string pname = pit->mSection;
1020 // have link
1021 std::string phtml = sect+"_index.html";
1022 // record
1023 sectlink[pname]=phtml;
1024 }
1025
1026 // produce sorted index, have corefaudes first
1027 std::vector< std::string > sections;
1028 if(sectlink["CoreFaudes"]!="") sections.push_back("CoreFaudes");
1029 std::map< std::string , std::string >::iterator sit;
1030 for(sit=sectlink.begin(); sit!=sectlink.end(); sit++) {
1031 std::string psect=sit->first;
1032 if(psect=="CoreFaudes") continue;
1033 sections.push_back(psect);
1034 }
1035
1036 // sections headline
1037 if(sections.size()!=0)
1038 *pIndexFile << "<li class=\"registry_heading\">Sections</li>" << std::endl;
1039
1040 // iterate sections
1041 std::size_t vit;
1042 for(vit=0; vit<sections.size(); vit++) {
1043 std::string psect=sections.at(vit);
1044 std::string plink=sectlink[psect];
1045 if(plink=="") continue;
1046 // find all pages within reference that match this section (keys to lower, skip index)
1047 std::string sect=psect;
1048 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1049 std::map< std::string , std::map< std::string , PageRecord > > ::iterator spit = mRefSectPages.find(sect);
1050 int pcnt=0;
1051 if(spit!=mRefSectPages.end()) {
1052 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1053 for(;pit!=spit->second.end();pit++) {
1054 std::string ppage = pit->second.mPage;
1055 std::transform(ppage.begin(), ppage.end(), ppage.begin(), tolower);
1056 if(ppage=="index") continue;
1057 if(ppage=="0_index") continue;
1058 if(ppage=="00_index") continue;
1059 pcnt++;
1060 }
1061 }
1062 // case a) no pages: just a link
1063 if(pcnt==0) {
1064 ListItemHtml(pIndexFile, plink, psect);
1065 continue;
1066 }
1067 // case b) generate link for sub menu for pages (do this my self)
1068 *pIndexFile << "<li class=\"registry_pitem\">" << std::endl
1069 << "<a href=\"" << plink << "\">" << psect << "</a>" << std::endl
1070 << "<a href=\"" << plink << "\" class=\"registry_blinda\">&nbsp;</a>" << std::endl
1071 << "<ul>" << std::endl
1072 << "<li class=\"registry_heading\">" << psect << "</li>" << std::endl;
1073 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1074 for(;pit!=spit->second.end();pit++) {
1075 // swallow page number
1076 std::string ppage = PrettyPage(pit->second.mPage);
1077 // normalize
1078 std::string ipage = ppage;
1079 std::transform(ipage.begin(), ipage.end(), ipage.begin(), tolower);
1080 // rename indes
1081 if(ipage=="index") ppage="Introduction";
1082 // page entry
1083 *pIndexFile << "<li class=\"registry_item\"><a href=\"" << pit->second.mLink << "\">"
1084 << ppage << "</a></li>" << std::endl;
1085 }
1086 // close page list
1087 *pIndexFile << "</ul></li>" << std::endl;
1088 }
1089
1090 // sections done
1091 if(sections.size()!=0)
1092 *pIndexFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
1093
1094 // list types
1095 if(key!="") TypeIndexHtml(pIndexFile,key);
1096
1097 // list functions
1098 if(key!="") FunctionIndexHtml(pIndexFile,key);
1099}
1100
1101
1102// ******************************************************************
1103// Section index (aka bottom navigation for key section)
1104// ******************************************************************
1105
1106
1107void SectionIndexHtml(std::ostream* pIndexFile, const std::string& key) {
1108
1109 // find all pages within reference that match this section (keys to lower, skip index)
1110 std::string sect=key;
1111 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1112 std::string plink=sect+"_index.html";
1113 std::string psect=key;
1114 std::map< std::string , std::map< std::string , PageRecord > > ::iterator spit = mRefSectPages.find(sect);
1115 int pcnt=0;
1116 if(spit!=mRefSectPages.end()) {
1117 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1118 for(;pit!=spit->second.end();pit++) {
1119 std::string ppage = pit->second.mPage;
1120 psect=pit->second.mSection;
1121 std::transform(ppage.begin(), ppage.end(), ppage.begin(), tolower);
1122 if(ppage=="index") continue;
1123 if(ppage=="0_index") continue;
1124 if(ppage=="00_index") continue;
1125 pcnt++;
1126 }
1127 }
1128
1129 // bail out if there are no pages
1130 //if(pcnt==0) return;
1131
1132 // tweak: key="" refers to the reference_index.html
1133 if(key=="") psect="Reference";
1134
1135 // generate menu for pages
1136 *pIndexFile << "<li class=\"registry_heading\">" << psect << "</li>" << std::endl;
1137 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1138 for(;pit!=spit->second.end();pit++) {
1139 // swallow page number
1140 std::string ppage = PrettyPage(pit->second.mPage);
1141 // normalize
1142 std::string ipage = ppage;
1143 std::transform(ipage.begin(), ipage.end(), ipage.begin(), tolower);
1144 // rename index
1145 if(ipage=="index") ppage="Introduction";
1146 // page entry
1147 *pIndexFile << "<li class=\"registry_item\"><a href=\"" << pit->second.mLink << "\">"
1148 << ppage << "</a></li>" << std::endl;
1149 }
1150}
1151
1152
1153// ******************************************************************
1154// signature
1155// ******************************************************************
1156
1157void SignatureHtml(std::ostream* pOutFile, std::string function) {
1158
1159 // bail out on non existence
1160 if(!FunctionRegistry::G()->Exists(function)) return;
1161
1162 // function definition
1163 const FunctionDefinition& fdef=FunctionRegistry::G()->Definition(function);
1164
1165 // bail out if there is no signature
1166 if(fdef.VariantsSize()==0) return;
1167
1168 // start signature box
1169 *pOutFile << "<div class=\"registry_signature\">" << std::endl;
1170 *pOutFile << "<h5><strong>Signature:</strong></h5>" << std::endl;
1171
1172 // loop signatures
1173 for(int i=0; i< fdef.VariantsSize(); i++) {
1174 const Signature& sigi=fdef.Variant(i);
1175 *pOutFile << "<p>" << fdef.Name() << "(";
1176 // loop params
1177 for(int j=0; j < sigi.Size(); j++) {
1178 if(j!=0) *pOutFile << ", ";
1179 const Parameter& parj=sigi.At(j);
1180 *pOutFile << "<span>+" << Parameter::AStr(parj.Attribute()) << "+ ";
1181 TypeHtml(pOutFile,parj.Type());
1182 *pOutFile << " <i>" << parj.Name() << "</i></span>";
1183 }
1184 *pOutFile << ")</p>" << std::endl;
1185 }
1186
1187
1188 // close signature box
1189 *pOutFile << std::endl << "</div>" << std::endl;
1190}
1191
1192// ******************************************************************
1193// short doc
1194// ******************************************************************
1195
1196void ShortdocHtml(std::ostream* pOutFile, std::string fname) {
1197
1198 // its a function
1199 if(FunctionRegistry::G()->Exists(fname)) {
1200
1201 // function definition
1203
1204 // stream doc
1205 //*pOutFile << "<div class=\"registry_signature\">" << std::endl;
1206 *pOutFile << "<p>" << fdef.TextDoc() << "</p>" << std::endl;
1207 //*pOutFile << "</div>" << std::endl;
1208
1209 // stream signature
1210 SignatureHtml(pOutFile,fname);
1211 }
1212
1213 // its a type
1214 if(TypeRegistry::G()->Exists(fname)) {
1215
1216 // type definition
1217 const TypeDefinition& tdef=TypeRegistry::G()->Definition(fname);
1218
1219 // stream doc
1220 //*pOutFile << "<div class=\"registry_signature\">" << std::endl;
1221 *pOutFile << "<p>" << tdef.TextDoc() << "<p>" << std::endl;
1222 //*pOutFile << "</div>" << std::endl;
1223
1224 }
1225
1226}
1227
1228
1229
1230
1231// ******************************************************************
1232// record literature
1233// ******************************************************************
1234
1235// record
1237public:
1238 std::string mLabel;
1239 std::string mLink;
1240 std::string mAuthors;
1241 std::string mTitle;
1242 std::string mJournal;
1243 std::string mPublisher;
1244 std::string mYear;
1245};
1246
1247// data
1248std::map<std::string,LiteratureRecord> mLiterature;
1249
1250// extract all from a section
1252 // record my level
1253 int clevel = rTr.Level();
1254 // std::cerr << "process level " << clevel << "\n";
1255 // token loop
1256 while(true) {
1257 // skip plain text
1258 std::string text;
1259 rTr.ReadCharacterData(text);
1260 if(text.size()>0) continue;
1261 // break on no token or end of my level
1262 Token token;
1263 if(!rTr.Peek(token)) break;
1264 if(token.IsEnd() && !token.IsBegin() && rTr.Level()==clevel)
1265 break;
1266 // track where we are
1267 if(token.IsBegin("ReferencePage")) {
1268 mFrefChapter="";
1269 if(token.ExistsAttributeString("chapter"))
1270 mFrefChapter=token.AttributeStringValue("chapter");
1271 mFrefSection="";
1272 if(token.ExistsAttributeString("section"))
1273 mFrefSection=token.AttributeStringValue("section");
1274 std::transform(mFrefChapter.begin(), mFrefChapter.end(), mFrefChapter.begin(), tolower);
1275 std::transform(mFrefSection.begin(), mFrefSection.end(), mFrefSection.begin(), tolower);
1276 // report
1277 // std::cerr << "ref2html: found chapter \"" << mFrefChapter << "\" section \"" << mFrefSection << "\"" << std::endl;
1278 }
1279 // ignore other tokens
1280 if(!token.IsBegin("fliterature")) {
1281 rTr.Get(token);
1282 continue;
1283 }
1284 // do my special tag: fliterature
1285 rTr.ReadBegin("fliterature");
1286 std::string label=token.AttributeStringValue("name");
1287 //std::cerr << "process literature " << label << "\n";
1288 LiteratureRecord litrec;
1289 litrec.mLabel=label;
1290 litrec.mLink = mFrefSection + "_index.html#lit_" + label;
1291 //process entries
1292 while(!rTr.Eos("fliterature")) {
1293 Token token;
1294 rTr.Peek(token);
1295 //std::cerr << "process literature peek " << token.Str() << "\n";
1296 if(token.IsBegin("fauthors")) {
1297 rTr.ReadBegin("fauthors");
1298 rTr.ReadSection(litrec.mAuthors);
1299 rTr.ReadEnd("fauthors");
1300 continue;
1301 }
1302 if(token.IsBegin("ftitle")) {
1303 rTr.ReadBegin("ftitle");
1304 rTr.ReadSection(litrec.mTitle);
1305 rTr.ReadEnd("ftitle");
1306 continue;
1307 }
1308 if(token.IsBegin("fjournal")) {
1309 rTr.ReadBegin("fjournal");
1310 rTr.ReadSection(litrec.mJournal);
1311 rTr.ReadEnd("fjournal");
1312 continue;
1313 }
1314 if(token.IsBegin("fyear")) {
1315 rTr.ReadBegin("fyear");
1316 rTr.ReadSection(litrec.mYear);
1317 rTr.ReadEnd("fyear");
1318 continue;
1319 }
1320 if(token.IsBegin("flink")) {
1321 rTr.ReadBegin("flink");
1322 rTr.ReadSection(litrec.mLink);
1323 rTr.ReadEnd("flink");
1324 continue;
1325 }
1326 if(token.IsBegin()) {
1327 rTr.ReadBegin(token.StringValue());
1328 rTr.ReadEnd(token.StringValue());
1329 continue;
1330 }
1331 rTr.Get(token);
1332 }
1333 // insert entry
1334 if(litrec.mLabel!="")
1335 mLiterature[litrec.mLabel]=litrec;
1336 // done
1337 rTr.ReadEnd("fliterature");
1338 }
1339}
1340
1341
1342// dump literature records to include file
1344 // loop records
1345 std::map<std::string,LiteratureRecord>::iterator lit;
1346 for(lit=mLiterature.begin(); lit!=mLiterature.end(); lit++) {
1347 Token btag;
1348 btag.SetBegin("fliterature");
1349 btag.InsAttributeString("name",lit->second.mLabel);
1350 rTw << btag;
1351 if(lit->second.mAuthors!="") {
1352 rTw.WriteBegin("fauthors");
1353 rTw.WriteCharacterData(lit->second.mAuthors);
1354 rTw.WriteEnd("fauthors");
1355 }
1356 if(lit->second.mTitle!="") {
1357 rTw.WriteBegin("ftitle");
1358 rTw.WriteCharacterData(lit->second.mTitle);
1359 rTw.WriteEnd("ftitle");
1360 }
1361 if(lit->second.mJournal!="") {
1362 rTw.WriteBegin("fjournal");
1363 rTw.WriteCharacterData(lit->second.mJournal);
1364 rTw.WriteEnd("fjournal");
1365 }
1366 if(lit->second.mPublisher!="") {
1367 rTw.WriteBegin("fpublisher");
1368 rTw.WriteCharacterData(lit->second.mPublisher);
1369 rTw.WriteEnd("fpublisher");
1370 }
1371 if(lit->second.mYear!="") {
1372 rTw.WriteBegin("fyear");
1373 rTw.WriteCharacterData(lit->second.mYear);
1374 rTw.WriteEnd("fyear");
1375 }
1376 if(lit->second.mLink!="") {
1377 rTw.WriteBegin("flink");
1378 rTw.WriteCharacterData(lit->second.mLink);
1379 rTw.WriteEnd("flink");
1380 }
1381 rTw.WriteEnd("fliterature");
1382 rTw.Endl();
1383 }
1384}
1385
1386
1387// html for (one) literature reference
1388void LiteratureHtml(std::ostream* pStream, const std::string& rLabel="") {
1389 // loop records
1390 std::map<std::string,LiteratureRecord>::iterator lit;
1391 for(lit=mLiterature.begin(); lit!=mLiterature.end(); lit++) {
1392 // skip for no match
1393 if(rLabel!="")
1394 if(rLabel!=lit->second.mLabel) continue;
1395 // produce html
1396 *pStream << "<p>" << std::endl;
1397 *pStream << "<a id=\"" << "lit_" << lit->second.mLabel << "\">[" << lit->second.mLabel << "]</a>" << std::endl;
1398 *pStream << lit->second.mAuthors << ": ";
1399 *pStream << "<i>" << lit->second.mTitle << "</i>";
1400 if(lit->second.mJournal!="") *pStream << ", " << lit->second.mJournal;
1401 if(lit->second.mPublisher!="") *pStream << ", " << lit->second.mPublisher;
1402 if(lit->second.mYear!="") *pStream << ", " << lit->second.mYear;
1403 *pStream << ".</p>" << std::endl;
1404 }
1405}
1406
1407
1408// html for literature citation
1409void CiteHtml(std::ostream* pStream, const std::string& rLabel) {
1410 // prepare
1411 std::string link="reference_literature.html";
1412 // find records
1413 std::map<std::string,LiteratureRecord>::iterator lit;
1414 lit=mLiterature.find(rLabel);
1415 if(lit!=mLiterature.end()) link=lit->second.mLink;
1416 // produce HTML
1417 *pStream << "<a href=\"" << link << "\">[" << rLabel << "]</a>";
1418}
1419
1420
1421// ******************************************************************
1422// extract pages
1423// ******************************************************************
1424
1425void XtractPages(TokenReader& src,const std::string& rDstDir) {
1426
1427 // scan for reference page sections
1428 Token btag;
1429 while(src.Peek(btag)) {
1430 // skip tokens
1431 if(!btag.IsBegin("ReferencePage")) {
1432 src.Get(btag);
1433 continue;
1434 }
1435 // read begin tag
1436 src.ReadBegin("ReferencePage",btag);
1437 // extract title & friends
1438 mFrefTitle="libFAUDES Reference";
1439 if(btag.ExistsAttributeString("title"))
1440 mFrefTitle=btag.AttributeStringValue("title");
1441 mFrefChapter="Reference";
1442 if(btag.ExistsAttributeString("chapter"))
1443 mFrefChapter=btag.AttributeStringValue("chapter");
1444 mFrefSection="";
1445 if(btag.ExistsAttributeString("section"))
1446 mFrefSection=btag.AttributeStringValue("section");
1447 mFrefPage="";
1448 if(btag.ExistsAttributeString("page"))
1449 mFrefPage=btag.AttributeStringValue("page");
1450 // insist in page and section
1451 if(mFrefSection=="" || mFrefPage=="") {
1452 std::cerr << "ref2html: skipping undefined page at " << src.FileLine() << std::endl;
1453 src.ReadEnd("ReferencePage");
1454 continue;
1455 }
1456 // normalize & report
1457 std::transform(mFrefChapter.begin(), mFrefChapter.end(), mFrefChapter.begin(), tolower);
1458 std::transform(mFrefSection.begin(), mFrefSection.end(), mFrefSection.begin(), tolower);
1459 std::transform(mFrefPage.begin(), mFrefPage.end(), mFrefPage.begin(), tolower);
1460 // dst file
1461 std::string dstfile=PrependPath(rDstDir,mFrefSection + "_" + mFrefPage +".fref");
1462 std::cerr << "ref2html: extracting page to \"" << dstfile << "\"" << std::endl;
1463 TokenWriter dst(dstfile);
1464 // copy section
1465 dst.Write(btag);
1466 std::string srctext;
1467 src.ReadSection(srctext);
1468 dst.WriteCharacterData(srctext);
1469 dst.WriteEnd("ReferencePage");
1470 // read end tag
1471 src.ReadEnd("ReferencePage");
1472 }
1473}
1474
1475// ******************************************************************
1476// extract files
1477// ******************************************************************
1478
1479void XtractFiles(TokenReader& src,const std::string& rDstDir) {
1480
1481 // scan for file sections
1482 Token btag;
1483 while(src.Peek(btag)) {
1484 // skip tokens
1485 if(!btag.IsBegin("ImageFile")) {
1486 src.Get(btag);
1487 continue;
1488 }
1489 // read begin tag
1490 src.ReadBegin("ImageFile",btag);
1491 std::string name=btag.AttributeStringValue("name");
1492 if(name==""){
1493 std::cerr << "ref2html: skipping undefined image file at " << src.FileLine() << std::endl;
1494 src.ReadEnd("ImageFile");
1495 continue;
1496 }
1497 // read data
1498 Token data;
1499 src.Get(data);
1500 if(!data.IsBinary()){
1501 std::cerr << "ref2html: skipping invalid image file at " << src.FileLine() << std::endl;
1502 src.ReadEnd("ImageFile");
1503 continue;
1504 }
1505 // dst file
1506 std::string dstfile;
1507 std::transform(name.begin(), name.end(), name.begin(), tolower);
1508 dstfile=PrependPath(rDstDir,"images");
1509 dstfile=PrependPath(dstfile,name);
1510 std::cerr << "ref2html: extracting image file to \"" << dstfile << "\"" << std::endl;
1511 // setup stream
1512 std::fstream fsout;
1513 fsout.exceptions(std::ios::badbit|std::ios::failbit);
1514 try{
1515 fsout.open(dstfile.c_str(), std::ios::out | std::ios::binary);
1516 fsout.write(data.StringValue().c_str(),data.StringValue().size());
1517 fsout.close();
1518 }
1519 catch (std::ios::failure&) {
1520 std::cerr << "ref2html: file io error when writing \"" << dstfile << "\"" << std::endl;
1521 }
1522 // read end tag
1523 src.ReadEnd("ImageFile");
1524 }
1525}
1526
1527// ******************************************************************
1528// luafaudes index
1529// ******************************************************************
1530
1531void LuafaudesIndexHtml(std::ostream* pIndexFile) {
1532
1533 // prepare list of all sections
1534 std::map< std::string , std::string > pages;
1535 std::vector< PageRecord >::iterator pit;
1536 for(pit=mAllPages.begin(); pit != mAllPages.end(); pit++) {
1537 // my chapter only
1538 if(pit->mChapter!="luafaudes") continue;
1539 if(pit->mSection=="none") continue;
1540 if(pit->mSection=="") continue;
1541 if(pit->mPage=="") continue;
1542 // get nice name
1543 std::string pname = pit->mPage;
1544 // have link
1545 std::string phtml = pit->mLink;
1546 // record
1547 pages[pname]=phtml;
1548 }
1549 // produce sorted index
1550 std::map< std::string , std::string >::iterator sit;
1551 for(sit=pages.begin(); sit!=pages.end(); sit++) {
1552 // have entry
1553 ListItemHtml(pIndexFile,sit->second, sit->first);
1554 }
1555 // empty
1556 if(pages.size()==0) {
1557 *pIndexFile << "<li class=\"registry_item\">" << "none" << "</li>" << std::endl;
1558 }
1559}
1560
1561// ******************************************************************
1562// process current section
1563// ******************************************************************
1564
1566
1567 // record my level/mode
1568 int clevel = rTr.Level();
1569
1570 // std::cerr << "process level " << clevel << "\n";
1571
1572 // token copy loop
1573 while(true) {
1574 // see whether we can grab and copy some plain text
1575 std::string text;
1576 rTr.ReadCharacterData(text);
1577 if(text.size()>0) {
1578 //std::cerr << "copy text \"" << text << "\"\n";
1579 rTw.WriteCharacterData(text);
1580 continue;
1581 }
1582 // break on no token or end of my level
1583 Token token;
1584 if(!rTr.Peek(token)) break;
1585 if(token.IsEnd() && !token.IsBegin() && rTr.Level()==clevel)
1586 break;
1587 // do my special tags: ftype
1588 if(token.IsBegin("ftype")) {
1589 std::string ftype;
1590 rTr.ReadText("ftype",ftype);
1591 TypeHtml(rTw.Streamp(),ftype);
1592 continue;
1593 }
1594 // do my special tags: ffnct
1595 if(token.IsBegin("ffnct")) {
1596 std::string ffnct;
1597 rTr.ReadText("ffnct",ffnct);
1598 FunctionHtml(rTw.Streamp(),ffnct);
1599 continue;
1600 }
1601 // do my special tags: fimage
1602 if(token.IsBegin("fimage")) {
1603 rTr.ReadBegin("fimage", token);
1604 std::string fsrc=token.AttributeStringValue("fsrc");
1605 fsrc = StringSubstitute(fsrc,"FAUDES_IMAGES/",""); // be nice
1606 fsrc = ExtractBasename(fsrc); // be even niecer
1607 ImageHtml(rTw.Streamp(),fsrc);
1608 rTr.ReadEnd("fimage");
1609 continue;
1610 }
1611 // do my special tags: dmath
1612 if(token.IsBegin("fdmath")) {
1613 rTr.ReadBegin("fdmath", token);
1614 std::string mtext;
1615 rTr.ReadCharacterData(mtext);
1616 *rTw.Streamp() << "<span class=\"faudes_dmath\">";
1617 MathHtml(rTw.Streamp(),mtext);
1618 *rTw.Streamp()<< "</span>";
1619 rTr.ReadEnd("fdmath");
1620 continue;
1621 }
1622 // do my special tags: imath
1623 if(token.IsBegin("fimath")) {
1624 rTr.ReadBegin("fimath", token);
1625 std::string mtext;
1626 rTr.ReadCharacterData(mtext);
1627 *rTw.Streamp()<< "<span class=\"faudes_imath\">";
1628 MathHtml(rTw.Streamp(),mtext);
1629 *rTw.Streamp()<< "</span>";
1630 rTr.ReadEnd("fimath");
1631 continue;
1632 }
1633 // do my special tags: ffnct_reference
1634 if(token.IsBegin("ffnct_reference")) {
1635 rTr.ReadBegin("ffnct_reference", token);
1636 std::string ffnct = token.AttributeStringValue("name");
1637 *rTw.Streamp() << "<div class=\"registry_function\"> " << std::endl;
1638 *rTw.Streamp() << "<h2>" << "<a id=\"" << ffnct << "\">" << ffnct << "</a></h2>" << std::endl;
1639 ShortdocHtml(rTw.Streamp(),ffnct);
1640 ProcessSection(rTw,rTr);
1641 *rTw.Streamp() << "</div>" << std::endl;
1642 rTr.ReadEnd("ffnct_reference");
1643 continue;
1644 }
1645 // do my special tags: ftype_reference
1646 if(token.IsBegin("ftype_reference")) {
1647 rTr.ReadBegin("ftype_reference", token);
1648 std::string ftype = token.AttributeStringValue("name");
1649 *rTw.Streamp() << "<div class=\"registry_type\"> " << std::endl;
1650 *rTw.Streamp() << "<h2>" << "<a id=\"" << ftype << "\">" << ftype << "</a></h2>" << std::endl;
1651 ShortdocHtml(rTw.Streamp(),ftype);
1652 ProcessSection(rTw,rTr);
1653 *rTw.Streamp() << "</div>" << std::endl;
1654 rTr.ReadEnd("ftype_reference");
1655 continue;
1656 }
1657 // do my special tags: fdetails
1658 if(token.IsBegin("fdetails")) {
1659 rTr.ReadBegin("fdetails", token);
1660 *rTw.Streamp() << "<h5>Detailed description:</h5>";
1661 rTr.ReadEnd("fdetails");
1662 continue;
1663 }
1664 // do my special tags: fconditions
1665 if(token.IsBegin("fconditions")) {
1666 rTr.ReadBegin("fconditions", token);
1667 *rTw.Streamp() << "<h5>Parameter Conditions:</h5>";
1668 rTr.ReadEnd("fconditions");
1669 continue;
1670 }
1671 // do my special tags: fexample
1672 if(token.IsBegin("fexample")) {
1673 rTr.ReadBegin("fexample", token);
1674 *rTw.Streamp() << "<h5>Example:</h5>";
1675 rTr.ReadEnd("fexample");
1676 continue;
1677 }
1678 // do my special tags: falltypes
1679 if(token.IsBegin("falltypes")) {
1680 rTr.ReadBegin("falltypes", token);
1681 ListTypesHtml(rTw.Streamp());
1682 rTr.ReadEnd("falltypes");
1683 continue;
1684 }
1685 // do my special tags: fallfncts
1686 if(token.IsBegin("fallfncts")) {
1687 rTr.ReadBegin("fallfncts", token);
1689 rTr.ReadEnd("fallfncts");
1690 continue;
1691 }
1692 // do my special tags: fallsects
1693 if(token.IsBegin("fallsects")) {
1694 rTr.ReadBegin("fallsects", token);
1696 rTr.ReadEnd("fallsects");
1697 continue;
1698 }
1699 // do my special tags: fluasects
1700 if(token.IsBegin("fluasects")) {
1701 rTr.ReadBegin("fluasects", token);
1702 ListSectionsHtml(rTw.Streamp(),"luaext");
1703 rTr.ReadEnd("fluasects");
1704 continue;
1705 }
1706 // do my special tags: fliteratur (list all)
1707 if(token.IsBegin("falllit")) {
1708 rTr.ReadBegin("falllit");
1709 LiteratureHtml(rTw.Streamp());
1710 rTr.ReadEnd("falllit");
1711 continue;
1712 }
1713 // do my special tags: fliterature (definition of)
1714 if(token.IsBegin("fliterature")) {
1715 rTr.ReadBegin("fliterature", token);
1716 std::string label=token.AttributeStringValue("name");
1717 LiteratureHtml(rTw.Streamp(),label);
1718 rTr.ReadEnd("fliterature");
1719 continue;
1720 }
1721 // do my special tags: fcontributors
1722 if(token.IsBegin("fcontributors")) {
1723 rTr.ReadBegin("fcontributors");
1724 *rTw.Streamp() << ContributorsString();
1725 rTr.ReadEnd("fcontributors");
1726 continue;
1727 }
1728 // do my special tags: fcite
1729 if(token.IsBegin("fcite")) {
1730 rTr.ReadBegin("fcite", token);
1731 std::string label=token.AttributeStringValue("name");
1732 CiteHtml(rTw.Streamp(),label);
1733 rTr.ReadEnd("fcite");
1734 continue;
1735 }
1736 // do my special tags: fix br for HTML
1737 if(token.IsBegin("br")) {
1738 rTr.ReadBegin("br");
1739 Token etag;
1740 rTr.Peek(etag);
1741 if(etag.IsEnd("br")) rTr.ReadEnd("br"); // optionally accept balanced <br>
1742 token.ClrEnd();
1743 token.PreceedingSpace("n");
1744 rTw.Write(token); // intentionall write unbalanced <br> for HTML
1745 continue;
1746 }
1747 // do my special tags: fsummary
1748 if(token.IsBegin("fsummary")) {
1749 rTr.ReadBegin("fsummary");
1750 rTr.ReadEnd("fsummary");
1751 continue;
1752 }
1753 // get token to do my special attributes
1754 rTr.Get(token);
1755 //std::cerr << "copy token (lv " << rTr.Level() << "): " << token.Str() << "\n";
1756 // sense chapter classes
1757 if(token.ExistsAttributeString("ftcclass")) {
1758 mThisChapterClass=token.AttributeStringValue("ftcclass");
1759 token.ClrAttribute("ftcclass");
1760 }
1761 if(token.ExistsAttributeString("focclass")) {
1762 mOtherChapterClass=token.AttributeStringValue("focclass");
1763 token.ClrAttribute("focclass");
1764 }
1765 if(token.ExistsAttributeString("fxcclass")) {
1766 mExitChapterClass=token.AttributeStringValue("fxcclass");
1767 token.ClrAttribute("fxcclass");
1768 }
1769 // chapter attribute
1770 if(token.ExistsAttributeString("fchapter")) {
1771 std::string chapter = token.AttributeStringValue("fchapter");
1772 std::string cclass=mOtherChapterClass;
1773 if(chapter==mFrefChapter) cclass=mThisChapterClass;
1774 if(chapter=="exit") cclass=mExitChapterClass;
1775 token.InsAttributeString("class",cclass);
1776 token.ClrAttribute("fchapter");
1777 }
1778 // fhref attribute: ref only
1779 if(token.ExistsAttributeString("fhref") && mStandaloneReference) {
1780 std::string href = token.AttributeStringValue("fhref");
1781 href = StringSubstitute(href,"FAUDES_BOOKS/",mBooksPrefix);
1782 href = StringSubstitute(href,"FAUDES_CHAPTERS/",mChaptersPrefix);
1783 href = StringSubstitute(href,"FAUDES_IMAGES/",mImagePrefix);
1784 href = StringSubstitute(href,"FAUDES_REFERENCE/",mReferencePrefix);
1785 href = StringSubstitute(href,"FAUDES_CSOURCE/",mCsourceLink);
1786 href = StringSubstitute(href,"FAUDES_LUAFAUDES/",mLuafaudesLink);
1787 href = StringSubstitute(href,"FAUDES_ONLINE",mFaudesLink);
1788 href = StringSubstitute(href,"FAUDES_GETLINUX",mDownloadLink+"#Packages");
1789 href = StringSubstitute(href,"FAUDES_GETMSWIN",mDownloadLink+"#Packages");
1790 href = StringSubstitute(href,"DESTOOL_ONLINE",mDestoolLink);
1791 token.InsAttributeString("href",href);
1792 token.ClrAttribute("fhref");
1793 }
1794 // fhref attribute
1795 if(token.ExistsAttributeString("fhref") && !mStandaloneReference) {
1796 std::string href = token.AttributeStringValue("fhref");
1797 href = StringSubstitute(href,"FAUDES_BOOKS/",mBooksPrefix);
1798 href = StringSubstitute(href,"FAUDES_CHAPTERS/",mChaptersPrefix);
1799 href = StringSubstitute(href,"FAUDES_IMAGES/",mImagePrefix);
1800 href = StringSubstitute(href,"FAUDES_REFERENCE/",mReferencePrefix);
1801 href = StringSubstitute(href,"FAUDES_CSOURCE/",mCsourcePrefix);
1802 href = StringSubstitute(href,"FAUDES_LUAFAUDES/",mLuafaudesPrefix);
1803 href = StringSubstitute(href,"FAUDES_ONLINE",mFaudesLink);
1804 href = StringSubstitute(href,"FAUDES_GETLINUX",mDownloadLink+"#Packages");
1805 href = StringSubstitute(href,"FAUDES_GETMSWIN",mDownloadLink+"#Packages");
1806 href = StringSubstitute(href,"DESTOOL_ONLINE",mDestoolLink);
1807 token.InsAttributeString("href",href);
1808 token.ClrAttribute("fhref");
1809 }
1810 // fsrc attribute
1811 if(token.ExistsAttributeString("fsrc")) {
1812 std::string fsrc = token.AttributeStringValue("fsrc");
1813 fsrc = StringSubstitute(fsrc,"FAUDES_IMAGES/",mImagePrefix);
1814 fsrc = StringSubstitute(fsrc,"FAUDES_CSOURCE/",mCsourcePrefix);
1815 fsrc = StringSubstitute(fsrc,"FAUDES_LUAFAUDES/",mLuafaudesPrefix);
1816 token.InsAttributeString("src",fsrc);
1817 token.ClrAttribute("fsrc");
1818 }
1819 token.PreceedingSpace("n");
1820 rTw.Write(token);
1821 }
1822}
1823
1824
1825// ******************************************************************
1826// reference page
1827// ******************************************************************
1828
1829void RefpageHtml(std::ostream* pOutFile, std::string inputfile) {
1830
1831 // setup token io
1832 TokenReader src(inputfile);
1833 TokenWriter dst(*pOutFile);
1834
1835 // find the reference page section
1836 Token btag;
1837 src.SeekBegin("ReferencePage");
1838 src.ReadBegin("ReferencePage",btag);
1839
1840 // extract title & friends
1841 mFrefTitle="libFAUDES Reference";
1842 if(btag.ExistsAttributeString("title"))
1843 mFrefTitle=btag.AttributeStringValue("title");
1844 mFrefChapter="";
1845 if(btag.ExistsAttributeString("chapter"))
1846 mFrefChapter=btag.AttributeStringValue("chapter");
1847 mFrefSection="";
1848 if(btag.ExistsAttributeString("section"))
1849 mFrefSection=btag.AttributeStringValue("section");
1850 std::transform(mFrefChapter.begin(), mFrefChapter.end(), mFrefChapter.begin(), tolower);
1851 std::transform(mFrefSection.begin(), mFrefSection.end(), mFrefSection.begin(), tolower);
1852
1853 // report
1854 // std::cerr << "ref2html: found chapter \"" << mFrefChapter << "\" section \"" << mFrefSection << "\"" << std::endl;
1855
1856 // generate generic html header
1857 dst.Flush();
1858 HeaderHtml(pOutFile);
1859
1860 // begin body
1861 dst.Flush();
1862
1863 // include chapter level navigation
1864 if(mChapterFile!="") {
1865 //std::cerr << "using " << mChapterFile << std::endl;
1867 ProcessSection(dst,inc);
1868 }
1869
1870 // include section level navigation, part 1
1871 if(mFrefChapter=="reference") {
1872 *pOutFile << "<table id=\"registry_page\">" << std::endl;
1873 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
1874 *pOutFile << "<td id=\"registry_index\">" << std::endl;
1875 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1876 *pOutFile << "<li class=\"registry_heading\">libFAUDES</li>" << std::endl;
1877 ListItemHtml(pOutFile,"reference_index.html", "Reference");
1878 ListItemHtml(pOutFile,"reference_types.html", "Type Index");
1879 ListItemHtml(pOutFile,"reference_functions.html", "Function Index");
1880 ListItemHtml(pOutFile,"reference_literature.html", "Literature");
1881 *pOutFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
1883 *pOutFile << "</ul></td>" << std::endl;
1884 *pOutFile << "<td id=\"registry_content\">" << std::endl;
1885 }
1886
1887 // include section level navigation, part 1
1888 if(mFrefChapter=="luafaudes") {
1889 *pOutFile << "<table id=\"registry_page\">" << std::endl;
1890 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
1891 *pOutFile << "<td id=\"registry_index\">" << std::endl;
1892 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1893 *pOutFile << "<li class=\"registry_heading\">luafaudes</li>" << std::endl;
1894 *pOutFile
1895 << "<script language=\"JavaScript\"> var luafaudes=function() { "
1896 << " popupWin = window.open('luafaudes_repl.html','open_window',"
1897 << " 'resizable,dependent, width=720, height=480, left=0, top=0'); } "
1898 << "</script>" << std::endl;
1899 ListItemHtml(pOutFile,"index.html", "Introduction");
1900 ListItemHtml(pOutFile,"javascript:luafaudes();", "Lua-Console");
1901 ListItemHtml(pOutFile,"faudes_luaext.html", "Lua-Extensions");
1902 ListItemHtml(pOutFile,"faudes_luatech.html", "Technical Detail");
1903 *pOutFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
1904 *pOutFile << "<li class=\"registry_heading\">Tutorials</li>" << std::endl;
1905 LuafaudesIndexHtml(pOutFile);
1906 *pOutFile << "</ul></td>" << std::endl;
1907 *pOutFile << "<td id=\"registry_content\">" << std::endl;
1908 }
1909
1910 // process src
1911 ProcessSection(dst,src);
1912 src.ReadEnd("ReferencePage");
1913 dst.Flush();
1914
1915 // track bottom line
1916 bool bottom=false;
1917
1918 // include section level navigation, part 2
1919 if(mFrefChapter=="reference") {
1920 BottomLineHtml(pOutFile);
1921 bottom=true;
1922 *pOutFile << "</td>" << std::endl;
1923 *pOutFile << "</tr>" << std::endl;
1924 *pOutFile << "</table>" << std::endl;
1925 }
1926
1927 // include section level navigation, part 2
1928 if(mFrefChapter=="luafaudes") {
1929 BottomLineHtml(pOutFile);
1930 bottom=true;
1931 *pOutFile << "</td>" << std::endl;
1932 *pOutFile << "</tr>" << std::endl;
1933 *pOutFile << "</table>" << std::endl;
1934 }
1935
1936 // include section level navigation, part 3
1937 if(mFrefChapter=="reference") {
1938 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
1939 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
1940 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
1941 *pOutFile << "<div class=\"registry_trigger\"> <span>&gt;&gt;</span>" << std::endl;
1942 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1944 *pOutFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
1945 ListItemHtml(pOutFile,"#", "Top of Page");
1946 *pOutFile << "</ul></div>" << std::endl;
1947 }
1948
1949 // include section level navigation, part 3
1950 if(mFrefChapter=="luafaudes" && mFrefSection=="tutorials") {
1951 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
1952 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
1953 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
1954 *pOutFile << "<div class=\"registry_trigger\"> <span>&gt;&gt;</span>" << std::endl;
1955 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1956 *pOutFile << "<li class=\"registry_heading\">luafaudes</li>" << std::endl;
1957 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luafaudes.html\">Introduction</a></li>" << std::endl;
1958 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luaext.html\">Lua-Extansions</a></li>" << std::endl;
1959 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luatech.html\">Techn. Details</a></li>" << std::endl;
1960 *pOutFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
1961 *pOutFile << "<li class=\"registry_item\"><a href=\"#\">Top of Page</a></li>" << std::endl;
1962 *pOutFile << "</ul></div>" << std::endl;
1963 }
1964
1965 // bottom line
1966 if(!bottom) BottomLineHtml(pOutFile);
1967
1968 // generic footer
1969 FooterHtml(pOutFile);
1970
1971}
1972
1973
1974
1975// ******************************************************************
1976// Doxygen header and footer
1977// ******************************************************************
1978
1979void DoxygenHeader(std::ostream* pOutFile) {
1980
1981 // setup token io
1982 TokenWriter dst(*pOutFile);
1983
1984 // configure
1985 mFrefTitle="C++ API";
1986 mFrefChapter="cppapi";
1987 mFrefSection="none";
1988
1989 // generate generic html header
1990 dst.Flush();
1991 HeaderHtml(pOutFile);
1992
1993 // include chapter level navigation
1994 if(mChapterFile!="") {
1996 ProcessSection(dst,inc);
1997 }
1998
1999 // include section level navigation, part 1
2000 *pOutFile << "<table id=\"registry_page\">" << std::endl;
2001 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
2002 *pOutFile << "<td id=\"registry_index\">" << std::endl;
2003 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
2004 *pOutFile << "<li class=\"registry_heading\">libFAUDES</li>" << std::endl;
2005 ListItemHtml(pOutFile, "index.html", "C++ API");
2006 *pOutFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
2007 *pOutFile << "<li class=\"registry_heading\">Sections</li>" << std::endl;
2008 ListItemHtml(pOutFile, "group__ContainerClasses.html", "Sets");
2009 ListItemHtml(pOutFile, "group__GeneratorClasses.html", "Generators");
2010 ListItemHtml(pOutFile, "group__GeneratorFunctions.html", "Functions");
2011 ListItemHtml(pOutFile, "group__AllPlugins.html", "PlugIns");
2012 ListItemHtml(pOutFile, "group__Tutorials.html", "Tutorials");
2013 *pOutFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
2014 *pOutFile << "<li class=\"registry_heading\">Index</li>" << std::endl;
2015 ListItemHtml(pOutFile, "classes.html", "Classes");
2016 ListItemHtml(pOutFile, "files.html", "Files");
2017 *pOutFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
2018 *pOutFile << "</ul></td>" << std::endl;
2019 *pOutFile << "<td id=\"registry_content\">" << std::endl;
2020}
2021
2022
2023void DoxygenFooter(std::ostream* pOutFile) {
2024
2025 // setup token io
2026 TokenWriter dst(*pOutFile);
2027
2028 // configure
2029 mFrefTitle="C++ API";
2030 mFrefChapter="cppapi";
2031 mFrefSection="none";
2032
2033 // include section level navigation, part 2
2034 BottomLineHtml(pOutFile);
2035 *pOutFile << "</td>" << std::endl;
2036 *pOutFile << "</tr>" << std::endl;
2037 *pOutFile << "</table>" << std::endl;
2038
2039 // include section level navigation, part 3
2040 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
2041 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
2042 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
2043 *pOutFile << "<div class=\"registry_trigger\"> <span>&gt;&gt;</span>" << std::endl;
2044 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
2045 *pOutFile << "<li class=\"registry_heading\">C++ API</li>" << std::endl;
2046 *pOutFile << "<li class=\"registry_item\"><a href=\"index.html\">Introduction</a></li>" << std::endl;
2047 *pOutFile << "<li class=\"registry_item\"><a href=\"group__ContainerClasses.html\">Sets</a></li>" << std::endl;
2048 *pOutFile << "<li class=\"registry_item\"><a href=\"group__GeneratorClasses.html\">Generators</a></li>" << std::endl;
2049 *pOutFile << "<li class=\"registry_item\"><a href=\"group__GeneratorFunctions.html\">Functions</a></li>" << std::endl;
2050 *pOutFile << "<li class=\"registry_item\"><a href=\"group__AllPlugins.html\">PlugIns</a></li>" << std::endl;
2051 *pOutFile << "<li class=\"registry_item\"><a href=\"group__Tutorials.html\">Tutorials</a></li>" << std::endl;
2052 *pOutFile << "<li class=\"registry_item\"><a href=\"classes.html\">Classes</a></li>" << std::endl;
2053 *pOutFile << "<li class=\"registry_item\"><a href=\"files.html\">Files</a></li>" << std::endl;
2054 *pOutFile << "<li class=\"registry_blanc\">&nbsp;</li>" << std::endl;
2055 *pOutFile << "<li class=\"registry_item\"><a href=\"#\">Top of Page</a></li>" << std::endl;
2056 *pOutFile << "</ul></div>" << std::endl;
2057
2058 // end page
2059 dst.Flush();
2060 FooterHtml(pOutFile);
2061
2062}
2063
2064// ******************************************************************
2065// command line ui
2066// ******************************************************************
2067
2068
2069int main(int argc, char *argv[]) {
2070
2071 // local config
2072 bool dotoc=false;
2073 bool dodhd=false;
2074 bool dodft=false;
2075 bool xpage=false;
2076
2077 // min args
2078 if(argc < 3) usage_exit();
2079
2080 // primitive commad line parsing
2081 int i;
2082 for(i=1; i<argc; i++) {
2083 std::string option(argv[i]);
2084 // option: rti file
2085 if(option=="-rti") {
2086 i++; if(i>=argc) usage_exit();
2087 mRtiFile=argv[i];
2088 continue;
2089 }
2090 // option: flx file
2091 if(option=="-flx") {
2092 i++; if(i>=argc) usage_exit();
2093 mFlxFile=argv[i];
2094 continue;
2095 }
2096 // option: css file
2097 if(option=="-css") {
2098 i++; if(i>=argc) usage_exit();
2099 mCssFile=argv[i];
2100 continue;
2101 }
2102 // option: navigation include
2103 if(option=="-cnav") {
2104 i++; if(i>=argc) usage_exit();
2105 mChapterFile=argv[i];
2106 continue;
2107 }
2108 // option: toc include
2109 if(option=="-inc") {
2110 i++; if(i>=argc) usage_exit();
2111 mIncludeFile=argv[i];
2112 continue;
2113 }
2114 // option: target prefix
2115 if(option=="-rel") {
2116 i++; if(i>=argc) usage_exit();
2117 ChaptersPrefix(argv[i]);
2118 continue;
2119 }
2120 // option: overwrite chapter
2121 if(option=="-chapter") {
2122 i++; if(i>=argc) usage_exit();
2123 mFrefChapter=argv[i];
2124 continue;
2125 }
2126 // option: overwrite section
2127 if(option=="-section") {
2128 i++; if(i>=argc) usage_exit();
2129 mFrefSection=argv[i];
2130 continue;
2131 }
2132 // option: extract multiple pages
2133 if(option=="-extract") {
2134 if(i+2!=argc-1) usage_exit();
2135 xpage=true;
2136 break;
2137 }
2138 // option: generate toc (break)
2139 if(option=="-toc") {
2140 i++; if(i+1>=argc) usage_exit();
2141 dotoc=true;
2142 mDstFile = argv[argc-1];
2143 break;
2144 }
2145 // option: generate doxygen header (break)
2146 if(option=="-doxheader") {
2147 i++; if(i>=argc) usage_exit();
2148 dodhd=true;
2149 mDstFile = argv[argc-1];
2150 break;
2151 }
2152 // option: generate doxygen footer (break)
2153 if(option=="-doxfooter") {
2154 i++; if(i>=argc) usage_exit();
2155 dodft=true;
2156 mDstFile = argv[argc-1];
2157 break;
2158 }
2159 // option: generate standalone reference
2160 if(option=="-app") {
2162 continue;
2163 }
2164 // option: help
2165 if((option=="-?") || (option=="--help")) {
2166 usage_exit();
2167 continue;
2168 }
2169 // option: unknown
2170 if(option.size()>1)
2171 if(option.at(0)=='-') {
2172 usage_exit("unknown option " + option);
2173 continue;
2174 }
2175 // non-option: break
2176 break;
2177 }
2178
2179 // figure source
2180 for(;i<argc-1; i++) {
2181 std::string option(argv[i]);
2182 if(option.size()>1)
2183 if(option.at(0)=='-') {
2184 usage_exit("missplaced/unknown option " + option);
2185 continue;
2186 }
2187 mSrcFiles.insert(option);
2188 }
2189
2190 // figure destination
2191 for(;i<argc; i++) {
2192 std::string option(argv[i]);
2193 if(option.size()>1)
2194 if(option.at(0)=='-') {
2195 usage_exit("missplaced/unknown option " + option);
2196 continue;
2197 }
2198 mDstFile=option;
2199 }
2200
2201 // test
2202 if(mDstFile=="") {
2203 usage_exit("no destination file specified");
2204 }
2205 bool dirdst=DirectoryExists(mDstFile);
2206
2207 // load registry
2208 if(mRtiFile!="") {
2210 }
2211
2212 // record plug-in and buil-in sections
2214 fit!=FunctionRegistry::G()->End(); fit++) {
2215 std::string section=fit->second->KeywordAt(0);
2216 std::transform(section.begin(), section.end(), section.begin(), tolower);
2217 mExclLuaSections.insert(section);
2218 }
2219
2220 // extend registry
2221 if(mFlxFile!="") {
2223 }
2224
2225 // record lua sections
2227 fit!=FunctionRegistry::G()->End(); fit++) {
2228 std::string section=fit->second->KeywordAt(0);
2229 std::transform(section.begin(), section.end(), section.begin(), tolower);
2230 mInclLuaSections.insert(section);
2231 }
2232
2233
2234 // include toc
2235 if(mIncludeFile!="") {
2237 RecordLiterature(tr);
2238 tr.Rewind();
2239 RecordPages(tr);
2240 }
2241
2242
2243 // special case: xtract fref
2244 if(xpage) {
2245 if(mSrcFiles.size()!=1) {
2246 usage_exit("extract mode requires one source file");
2247 }
2248 if(!dirdst) {
2249 usage_exit("extract mode requires destination directory");
2250 }
2251 std::cerr << "ref2html: extract pages from " << *mSrcFiles.begin() << std::endl;
2252 TokenReader tr(*mSrcFiles.begin());
2254 tr.Rewind();
2256 exit(0);
2257 }
2258
2259
2260 // special case: generate toc
2261 if(dotoc) {
2262 if(dirdst) {
2263 usage_exit("toc mode requires destination file");
2264 }
2265 // output file
2266 std::ostream* hout= &std::cout;
2267 std::ofstream fout;
2268 if(mDstFile != "-") {
2269 fout.open(mDstFile.c_str(), std::ios::out);
2270 hout = &fout;
2271 }
2272 // process all input
2273 std::set< std::string >::iterator sit=mSrcFiles.begin();
2274 for(;sit!=mSrcFiles.end();++sit) {
2275 std::cerr << "ref2html: process toc " << *sit << std::endl;
2276 TokenReader tr(*sit);
2277 RecordLiterature(tr);
2278 tr.Rewind();
2279 RecordPages(tr);
2280 }
2281 // dump
2282 TokenWriter dst(*hout);
2283 DumpPages(dst);
2284 DumpLiterature(dst);
2285 dst.Flush();
2286 exit(0);
2287 }
2288
2289 // special case: generate dox header/footer
2290 if(dodhd || dodft) {
2291 if(dirdst) {
2292 usage_exit("header-footer mode requires destination file");
2293 }
2294 // output file
2295 std::ostream* hout= &std::cout;
2296 std::ofstream fout;
2297 if(mDstFile != "-") {
2298 fout.open(mDstFile.c_str(), std::ios::out);
2299 hout = &fout;
2300 }
2301 // doit
2302 if(dodhd) DoxygenHeader(hout);
2303 if(dodft) DoxygenFooter(hout);
2304 exit(0);
2305 }
2306
2307
2308 // convert all source directories
2309 std::set< std::string > srcfiles;
2310 std::set< std::string >::iterator sit=mSrcFiles.begin();
2311 for(;sit!=mSrcFiles.end();++sit) {
2312 if(!DirectoryExists(*sit)) { srcfiles.insert(*sit); continue;}
2313 std::set< std::string > dirfiles = ReadDirectory(*sit);
2314 std::set< std::string >::iterator dit=dirfiles.begin();
2315 for(;dit!=dirfiles.end();++dit) {
2316 std::string ext = ExtractSuffix(*dit);
2317 std::string base = ExtractBasename(*dit);
2318 std::string src= PrependPath(*sit,base + ".fref");
2319 // skip if not an fref file
2320 if(ext!="fref") continue;
2321 // record
2322 srcfiles.insert(src);
2323 }
2324 }
2325 mSrcFiles=srcfiles;
2326
2327 // insist in target dir
2328 if(mSrcFiles.size()>1 && ! dirdst) {
2329 usage_exit("multiple source files require destination directory");
2330 }
2331
2332
2333 // do loop
2334 /*std::set< std::string >::iterator*/ sit=mSrcFiles.begin();
2335 for(;sit!=mSrcFiles.end();++sit) {
2336 std::string base = ExtractBasename(*sit);
2337 std::string src= *sit;
2338 std::string dst= mDstFile;
2339 if(dirdst) dst=PrependPath(mDstFile,base + ".html");
2340 // process
2341 if(mSrcFiles.size()>1)
2342 std::cout << "ref2html: processing " << src << " to " << dst << std::endl;
2343 std::ofstream fout;
2344 fout.open(dst.c_str(), std::ios::out);
2345 RefpageHtml(&fout,src);
2346 }
2347 exit(0);
2348}
int main()
std::string mJournal
std::string mTitle
std::string mYear
std::string mLabel
std::string mPublisher
std::string mAuthors
std::string mLink
std::string mSection
Definition ref2html.cpp:619
std::string mPage
Definition ref2html.cpp:620
std::string mLink
Definition ref2html.cpp:621
std::string mSummary
Definition ref2html.cpp:622
std::string mChapter
Definition ref2html.cpp:618
std::string mTitle
Definition ref2html.cpp:617
const std::string & HtmlDoc(void) const
const std::string & Name(void) const
const std::string & TextDoc(void) const
const Signature & Variant(const std::string &rName) const
Iterator End(void) const
static FunctionRegistry * G()
std::map< std::string, FunctionDefinition * >::const_iterator Iterator
const FunctionDefinition & Definition(const std::string &rFunctionName) const
void MergeDocumentation(TokenReader &rTr)
const std::string & Type(void) const
const ParamAttr & Attribute(void) const
static std::string AStr(Parameter::ParamAttr attr)
const std::string & Name(void) const
int Size(void) const
const Parameter & At(int n) const
std::string FileLine(void) const
void ReadCharacterData(std::string &rData)
void ReadText(const std::string &rLabel, std::string &rText)
bool Eos(const std::string &rLabel)
void SeekBegin(const std::string &rLabel)
int Level(void) const
void ReadEnd(const std::string &rLabel)
void ReadSection(std::string &rSectionString)
void ReadBegin(const std::string &rLabel)
bool Get(Token &token)
bool Peek(Token &token)
bool ExistsBegin(const std::string &rLabel)
std::string FileName(void) const
void WriteCharacterData(const std::string &rCharData)
void Write(Token &rToken)
std::ostream * Streamp(void)
void WriteEnd(const std::string &rLabel)
void WriteBegin(const std::string &rLabel)
bool IsBinary(void) const
const std::string & PreceedingSpace(void) const
const std::string & StringValue(void) const
void ClrEnd(void)
bool ExistsAttributeString(const std::string &name)
bool IsBegin(void) const
void SetEmpty(const std::string &rName)
void ClrAttribute(const std::string &name)
void SetBegin(const std::string &rName)
Definition cfl_token.cpp:92
void InsAttributeString(const std::string &name, const std::string &value)
bool IsEnd(void) const
const std::string & AttributeStringValue(const std::string &name)
const TypeDefinition & Definition(const std::string &rTypeName) const
static TypeRegistry * G()
std::map< std::string, TypeDefinition * >::const_iterator Iterator
Iterator End(void) const
void LoadRegistry(const std::string &rPath)
std::string VersionString()
std::string PrependPath(const std::string &rLeft, const std::string &rRight)
std::string PluginsString()
std::string ExtractFilename(const std::string &rFullPath)
std::string ContributorsString()
std::set< std::string > ReadDirectory(const std::string &rDirectory)
std::string StringSubstitute(const std::string &rString, const std::string &rFrom, const std::string &rTo)
std::string ExtractBasename(const std::string &rFullPath)
bool DirectoryExists(const std::string &rDirectory)
std::string ExtractSuffix(const std::string &rFullPath)
void SectionIndexHtml(std::ostream *pIndexFile, const std::string &key)
std::string mExitChapterClass
Definition ref2html.cpp:134
std::string mFrefLink
Definition ref2html.cpp:99
void ChaptersPrefix(const std::string &prefix)
Definition ref2html.cpp:140
void DoxygenHeader(std::ostream *pOutFile)
std::set< std::string > mSrcFiles
Definition ref2html.cpp:105
void RecordPages(TokenReader &rTr)
Definition ref2html.cpp:633
std::string mChapterFile
Definition ref2html.cpp:106
void RefpageHtml(std::ostream *pOutFile, std::string inputfile)
std::map< std::string, std::map< std::string, PageRecord > > mRefSectPages
Definition ref2html.cpp:630
std::string TimeStamp(void)
Definition ref2html.cpp:154
void XtractFiles(TokenReader &src, const std::string &rDstDir)
std::vector< PageRecord > mAllPages
Definition ref2html.cpp:627
std::string mFlxFile
Definition ref2html.cpp:103
std::string mReferencePrefix
Definition ref2html.cpp:112
std::string mDstFile
Definition ref2html.cpp:104
std::string mFaudesLink
Definition ref2html.cpp:126
void ShortdocHtml(std::ostream *pOutFile, std::string fname)
std::string mThisChapterClass
Definition ref2html.cpp:132
std::string mLuafaudesPrefix
Definition ref2html.cpp:114
void FooterHtml(std::ostream *pStream)
Definition ref2html.cpp:249
std::string mFrefSection
Definition ref2html.cpp:97
std::string TexScripts(const std::string &rTexString)
Definition ref2html.cpp:416
std::string mChaptersPrefix
Definition ref2html.cpp:110
std::string mIncludeFile
Definition ref2html.cpp:107
void ListItemHtml(std::ostream *pStream, const std::string &rLink, const std::string &rText)
Definition ref2html.cpp:271
void DumpLiterature(TokenWriter &rTw)
void BottomLineHtml(std::ostream *pStream)
Definition ref2html.cpp:196
void ListFunctionsHtml(std::ostream *pIndexFile, const std::string &key="")
Definition ref2html.cpp:805
void RecordLiterature(TokenReader &rTr)
std::map< std::string, LiteratureRecord > mLiterature
std::string mBooksPrefix
Definition ref2html.cpp:109
std::string mImagePrefix
Definition ref2html.cpp:111
std::string mFrefSummary
Definition ref2html.cpp:100
std::string mOtherChapterClass
Definition ref2html.cpp:133
void FunctionIndexHtml(std::ostream *pIndexFile, const std::string &key="")
Definition ref2html.cpp:958
void MathHtml(std::ostream *pStream, const std::string &rMathString)
Definition ref2html.cpp:501
std::set< std::string > mInclLuaSections
Definition ref2html.cpp:612
std::string mLuafaudesLink
Definition ref2html.cpp:128
void LiteratureHtml(std::ostream *pStream, const std::string &rLabel="")
void TypeIndexHtml(std::ostream *pIndexFile, const std::string &key="")
Definition ref2html.cpp:923
std::string mFrefPage
Definition ref2html.cpp:98
std::string TexSpacing(const std::string &rTexString)
Definition ref2html.cpp:372
void SignatureHtml(std::ostream *pOutFile, std::string function)
std::string mFrefTitle
Definition ref2html.cpp:95
std::string mDownloadLink
Definition ref2html.cpp:125
std::string mCsourceLink
Definition ref2html.cpp:129
std::string mFrefChapter
Definition ref2html.cpp:96
void DumpPages(TokenWriter &rTw)
Definition ref2html.cpp:739
std::string PrettyPage(const std::string page)
Definition ref2html.cpp:169
void TextHtml(std::ostream *pStream, const std::string &rText)
Definition ref2html.cpp:329
std::string mCsourcePrefix
Definition ref2html.cpp:113
void ImageHtml(std::ostream *pStream, const std::string &rFileName)
Definition ref2html.cpp:260
void ReferenceIndexHtml(std::ostream *pIndexFile, const std::string &key="")
std::string mCssFile
Definition ref2html.cpp:130
std::string mRtiFile
Definition ref2html.cpp:102
void usage_exit(const std::string &rMessage="")
Definition ref2html.cpp:51
void HeaderHtml(std::ostream *pStream)
Definition ref2html.cpp:230
void CiteHtml(std::ostream *pStream, const std::string &rLabel)
void LuafaudesIndexHtml(std::ostream *pIndexFile)
std::string mDestoolLink
Definition ref2html.cpp:127
std::string TexMacroSubstitute1(const std::string &rTexString, const std::string &rMacro, const std::string &rSubst)
Definition ref2html.cpp:343
bool mStandaloneReference
Definition ref2html.cpp:93
void ListSectionsHtml(std::ostream *pIndexFile, const std::string &key="")
Definition ref2html.cpp:840
void FunctionHtml(std::ostream *pStream, const std::string &rFunctionName)
Definition ref2html.cpp:306
void XtractPages(TokenReader &src, const std::string &rDstDir)
void DoxygenFooter(std::ostream *pOutFile)
void ProcessSection(TokenWriter &rTw, TokenReader &rTr)
void TypeHtml(std::ostream *pStream, const std::string &rTypeName)
Definition ref2html.cpp:282
std::set< std::string > mExclLuaSections
Definition ref2html.cpp:611
void ListTypesHtml(std::ostream *pIndexFile, const std::string &key="")
Definition ref2html.cpp:770

libFAUDES 2.33k --- 2025.09.16 --- c++ api documentaion by doxygen