|
Go to the documentation of this file.
54 std::cerr << rMessage << std::endl;
55 std::cout << "" << 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;
159 local=localtime(&now);
160 strftime(buffer,80, "%Y.%m.%d",local);
161 return std::string(buffer);
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)
179 if(upos+1<ppage.size())
180 ppage=ppage.substr(upos+1,ppage.size()-upos-1);
181 if(spos!=std::string::npos)
183 if(spos+1<ppage.size())
184 ppage=ppage.substr(spos+1,ppage.size()-spos-1);
197 *pStream << "<p class=\"bottom_line\"> " << std::endl;
199 *pStream << "--- " << TimeStamp() << " " << std::endl;
201 *pStream << "--- with "" << PluginsString() << "" " << std::endl;
203 *pStream << "--- c++ api documentaion by <a href=\"http://www.doxygen.org\" target=\"_top\">doxygen</a>" << std::endl;
204 *pStream << "</p>" << std::endl;
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 "Arial Unicode MS" from a recent MS Office package" << std::endl;
212 *pStream << "or the freely available" << std::endl;
213 *pStream << ""<a href=\"http://greekfonts.teilar.gr/\">Symbola</a>"" << 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;
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;
250 *pStream << "</div>" << std::endl;
251 *pStream << "</div>" << std::endl;
252 *pStream << "</body>" << std::endl;
253 *pStream << "</html>" << std::endl;
260 void 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\"/>";
271 void 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\"> </a>" << std::endl
275 << "</li>" << std::endl;
282 void TypeHtml(std::ostream* pStream, const std::string& rTypeName) {
286 *pStream << rTypeName;
292 std::string tyname = tdef. Name();
293 std::string tyhtml = tdef. HtmlDoc();
294 if(tyhtml== "" || tyhtml== "none") {
297 *pStream << "<a href=\"" << mReferencePrefix << tyhtml << "\">" << tyname << "</a>";
306 void FunctionHtml(std::ostream* pStream, const std::string& rFunctionName) {
310 *pStream << rFunctionName;
316 std::string fname = fdef. Name();
317 std::string fhtml = fdef. HtmlDoc();
318 if(fhtml== "" || fhtml== "none") {
321 *pStream << "<a href=\"" << mReferencePrefix << fhtml << "\">" << fname << "</a>";
329 void TextHtml(std::ostream* pStream, const std::string& rText) {
343 std::string TexMacroSubstitute1( const std::string& rTexString, const std::string& rMacro, const std::string& rSubst) {
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));
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);
364 if(pos<rTexString.length())
365 res.append(rTexString.substr(pos));
378 while(pos<rTexString.length()) {
380 if(pos+1 < rTexString.length())
381 if(rTexString.substr(pos,2)== "\\ ")
382 {pos+=2; res.append( " "); continue;}
384 if(pos+1 < rTexString.length())
385 if(rTexString.substr(pos,2)== "\\,")
386 {pos+=2; res.append( " "); continue;}
388 if(pos+1 < rTexString.length())
389 if(rTexString.substr(pos,2)== "\\;")
390 {pos+=2; res.append( " "); continue;}
392 if(pos+4 < rTexString.length())
393 if(rTexString.substr(pos,5)== "\\quad")
394 {pos+=5; res.append( " "); continue;}
397 if(isspace(rTexString.at(pos)))
401 if(pos+5 < rTexString.length())
402 if(rTexString.substr(pos,6)== "\\text{")
403 {pos+=6; math= false; continue;};
406 if(rTexString.at(pos)== '}')
407 { pos+=1; math= true; continue;}
409 res.append(1,rTexString.at(pos));
424 while(pos<rTexString.length()) {
426 cm2=cm1; cm1=c0; c0=rTexString.at(pos);
428 if(cm1== '^' || cm1== '_')
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);
435 cm1=-1; cm2=-1; pos=aend+1;
441 size_t mpos=rTexString.find( "\\uparrow",pos);
443 res.append( "<span class=\"faudes_sup\">↑</span>");
444 cm1=-1; cm2=-1; pos+=8;
451 size_t mpos=rTexString.find( "\\Uparrow",pos);
453 res.append( "<span class=\"faudes_sup\">⇧</span>");
454 cm1=-1; cm2=-1; pos+=8;
463 cm1=-1; cm2=-1; pos+=1;
471 cm1=-1; cm2=-1; pos+=1;
476 if(c0== '*' || c0== '+') {
478 cm1=-1; cm2=-1; pos+=1;
482 if(cm1== '^' || cm1== '_') {
485 cm1=-1; cm2=-1; pos+=1;
501 void MathHtml(std::ostream* pStream, const std::string& rMathString) {
502 std::string buff=rMathString;
579 buff= StringSubstitute(buff, "∈", "<span class=\"faudes_fmath\">∈</span>");
580 buff= StringSubstitute(buff, "∉", "<span class=\"faudes_fmath\">∉</span>");
581 buff= StringSubstitute(buff, "∃", "<span class=\"faudes_fmath\">∃</span>");
582 buff= StringSubstitute(buff, "∀", "<span class=\"faudes_fmath\">∀</span>");
583 buff= StringSubstitute(buff, "∪", "<span class=\"faudes_fmath\">∪</span>");
584 buff= StringSubstitute(buff, "&dcup;", "<span class=\"faudes_fmath\">∪</span>");
585 buff= StringSubstitute(buff, "∩", "<span class=\"faudes_fmath\">∩</span>");
586 buff= StringSubstitute(buff, "←", "<span class=\"faudes_fmath\">←</span>");
587 buff= StringSubstitute(buff, "→", "<span class=\"faudes_fmath\">→</span>");
588 buff= StringSubstitute(buff, "↔", "<span class=\"faudes_fmath\">↔</span>");
589 buff= StringSubstitute(buff, "⇐", "<span class=\"faudes_fmath\">⇐</span>");
590 buff= StringSubstitute(buff, "⇒", "<span class=\"faudes_fmath\">⇒</span>");
591 buff= StringSubstitute(buff, "⇔", "<span class=\"faudes_fmath\">⇔</span>");
592 buff= StringSubstitute(buff, "⊂", "<span class=\"faudes_fmath\">⊂</span>");
593 buff= StringSubstitute(buff, "⊆", "<span class=\"faudes_fmath\">⊆</span>");
594 buff= StringSubstitute(buff, "⊃", "<span class=\"faudes_fmath\">⊃</span>");
595 buff= StringSubstitute(buff, "⊇", "<span class=\"faudes_fmath\">⊇</span>");
626 std::map< std::string , std::map< std::string , PageRecord > > mRefSectPages;
631 int clevel = rTr. Level();
638 if(text.size()>0) continue;
641 if(!rTr. Peek(token)) break;
645 if(!token. IsBegin( "ReferencePage")) {
677 std::transform(indexfile.begin(), indexfile.end(), indexfile.begin(), tolower);
691 std::size_t spos = title.find(section);
692 if(spos==0 && title.size()>section.size())
694 for(spos=0; spos< mFrefPage.size(); spos++){
737 std::vector<PageRecord>::iterator pit;
747 if(pit->mSummary== "") {
769 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
776 std::string section= tit->second->Name();
777 std::transform(section.begin(), section.end(), section.begin(), tolower);
778 if(section!=key) continue;
781 if(tit->second->TextDoc()== "") continue;
783 *pIndexFile << "<tr><td valign=\"top\">";
784 TypeHtml(pIndexFile,tit->second->Name());
785 *pIndexFile << "</td><td valign=\"top\">";
786 TypeHtml(pIndexFile,tit->second->TextDoc());
787 *pIndexFile << "</td></tr>" << std::endl;
792 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
794 *pIndexFile << "</table>" << std::endl;
804 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
811 std::string section= fit->second->Name();
812 std::transform(section.begin(), section.end(), section.begin(), tolower);
813 if(section!=key) continue;
816 if(fit->second->TextDoc()== "") continue;
818 *pIndexFile << "<tr><td valign=\"top\">";
820 *pIndexFile << "</td><td valign=\"top\">";
821 TypeHtml(pIndexFile,fit->second->TextDoc());
822 *pIndexFile << "</td></tr>" << std::endl;
827 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
829 *pIndexFile << "</table>" << std::endl;
841 std::set< std::string > sections;
842 std::map< std::string , std::string > link;
843 std::map< std::string , std::string > summary;
844 std::vector< PageRecord >::iterator pit;
846 std::string chap=pit->mChapter;
847 std::transform(chap.begin(), chap.end(), chap.begin(), tolower);
848 std::string sect=pit->mSection;
849 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
850 std::string page=pit->mPage;
851 std::transform(page.begin(), page.end(), page.begin(), tolower);
854 if(chap!= "reference") continue;
855 if(sect== "none") continue;
856 if(sect== "") continue;
857 if(page!= "index") continue;
864 std::string pname = pit->mSection;
866 std::string psumm = pit->mSummary;
867 if(psumm== "") psumm = pit->mTitle;
869 sections.insert(pname);
870 link[pname]=pit->mLink;
871 summary[pname]=psumm;
875 std::vector< std::string > sortvec;
876 if(sections.find( "CoreFaudes")!=sections.end())
877 sortvec.push_back( "CoreFaudes");
878 std::set< std::string >::iterator sit;
879 for(sit=sections.begin(); sit != sections.end(); sit++) {
880 if(*sit== "CoreFaudes") continue;
881 sortvec.push_back(*sit);
885 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
888 std::vector< std::string >::iterator vit;
890 for(vit=sortvec.begin(); vit != sortvec.end(); vit++) {
892 std::string sname = *vit;
894 std::string ssumm = summary[sname];
896 *pIndexFile << "<tr>" << std::endl;
897 *pIndexFile << "<td valign=\"top\"><a href=\"" << shtml << "\">" << sname << "</a></td>";
898 *pIndexFile << "<td valign=\"top\">";
899 *pIndexFile << ssumm;
900 *pIndexFile << "</td></tr>"<< std::endl;
905 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
908 *pIndexFile << "</table>" << std::endl;
928 std::string section= tit->second->KeywordAt(0);
929 std::transform(section.begin(), section.end(), section.begin(), tolower);
930 if(section!=key) continue;
933 std::string tyname = tit->second->Name();
934 std::string tyhtml = tit->second->HtmlDoc();
936 if(tyhtml== "") continue;
937 if(tyhtml== "none") continue;
941 *pIndexFile << "<li class=\"registry_heading\">Types</li>" << std::endl;
947 if(head) *pIndexFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
957 std::string lkey=key;
958 std::transform(lkey.begin(), lkey.end(), lkey.begin(), tolower);
967 std::string section= fit->second->KeywordAt(0);
968 std::transform(section.begin(), section.end(), section.begin(), tolower);
969 if(section!=lkey) continue;
972 if(fit->second->TextDoc()== "") continue;
974 std::string fname = fit->second->Name();
975 std::string fhtml = fit->second->HtmlDoc();
976 if(fhtml== "") continue;
980 *pIndexFile << "<li class=\"registry_heading\">Functions</li>" << std::endl;
984 *pIndexFile << "<li class=\"registry_item\"> "<< fname << "</li>" << std::endl;
992 if(head) *pIndexFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1003 std::map< std::string , std::string > sectlink;
1004 std::vector< PageRecord >::iterator pit;
1006 std::string chap=pit->mChapter;
1007 std::transform(chap.begin(), chap.end(), chap.begin(), tolower);
1008 std::string sect=pit->mSection;
1009 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1011 if(chap!= "reference") continue;
1012 if(sect== "none") continue;
1013 if(sect== "") continue;
1015 std::string pname = pit->mSection;
1017 std::string phtml = sect+ "_index.html";
1019 sectlink[pname]=phtml;
1023 std::vector< std::string > sections;
1024 if(sectlink[ "CoreFaudes"]!= "") sections.push_back( "CoreFaudes");
1025 std::map< std::string , std::string >::iterator sit;
1026 for(sit=sectlink.begin(); sit!=sectlink.end(); sit++) {
1027 std::string psect=sit->first;
1028 if(psect== "CoreFaudes") continue;
1029 sections.push_back(psect);
1033 if(sections.size()!=0)
1034 *pIndexFile << "<li class=\"registry_heading\">Sections</li>" << std::endl;
1038 for(vit=0; vit<sections.size(); vit++) {
1039 std::string psect=sections.at(vit);
1040 std::string plink=sectlink[psect];
1041 if(plink== "") continue;
1043 std::string sect=psect;
1044 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1045 std::map< std::string , std::map< std::string , PageRecord > > ::iterator spit = mRefSectPages.find(sect);
1048 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1049 for(;pit!=spit->second.end();pit++) {
1050 std::string ppage = pit->second.mPage;
1051 std::transform(ppage.begin(), ppage.end(), ppage.begin(), tolower);
1052 if(ppage== "index") continue;
1053 if(ppage== "0_index") continue;
1054 if(ppage== "00_index") continue;
1064 *pIndexFile << "<li class=\"registry_pitem\">" << std::endl
1065 << "<a href=\"" << plink << "\">" << psect << "</a>" << std::endl
1066 << "<a href=\"" << plink << "\" class=\"registry_blinda\"> </a>" << std::endl
1067 << "<ul>" << std::endl
1068 << "<li class=\"registry_heading\">" << psect << "</li>" << std::endl;
1069 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1070 for(;pit!=spit->second.end();pit++) {
1072 std::string ppage = PrettyPage(pit->second.mPage);
1074 std::string ipage = ppage;
1075 std::transform(ipage.begin(), ipage.end(), ipage.begin(), tolower);
1077 if(ipage== "index") ppage= "Introduction";
1079 *pIndexFile << "<li class=\"registry_item\"><a href=\"" << pit->second.mLink << "\">"
1080 << ppage << "</a></li>" << std::endl;
1083 *pIndexFile << "</ul></li>" << std::endl;
1087 if(sections.size()!=0)
1088 *pIndexFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1106 std::string sect=key;
1107 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1108 std::string plink=sect+ "_index.html";
1109 std::string psect=key;
1110 std::map< std::string , std::map< std::string , PageRecord > > ::iterator spit = mRefSectPages.find(sect);
1113 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1114 for(;pit!=spit->second.end();pit++) {
1115 std::string ppage = pit->second.mPage;
1116 psect=pit->second.mSection;
1117 std::transform(ppage.begin(), ppage.end(), ppage.begin(), tolower);
1118 if(ppage== "index") continue;
1119 if(ppage== "0_index") continue;
1120 if(ppage== "00_index") continue;
1129 if(key== "") psect= "Reference";
1132 *pIndexFile << "<li class=\"registry_heading\">" << psect << "</li>" << std::endl;
1133 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1134 for(;pit!=spit->second.end();pit++) {
1136 std::string ppage = PrettyPage(pit->second.mPage);
1138 std::string ipage = ppage;
1139 std::transform(ipage.begin(), ipage.end(), ipage.begin(), tolower);
1141 if(ipage== "index") ppage= "Introduction";
1143 *pIndexFile << "<li class=\"registry_item\"><a href=\"" << pit->second.mLink << "\">"
1144 << ppage << "</a></li>" << std::endl;
1165 *pOutFile << "<div class=\"registry_signature\">" << std::endl;
1166 *pOutFile << "<h5><strong>Signature:</strong></h5>" << std::endl;
1171 *pOutFile << "<p>" << fdef. Name() << "(";
1173 for( int j=0; j < sigi. Size(); j++) {
1174 if(j!=0) *pOutFile << ", ";
1178 *pOutFile << " <i>" << parj. Name() << "</i></span>";
1180 *pOutFile << ")</p>" << std::endl;
1185 *pOutFile << std::endl << "</div>" << std::endl;
1202 *pOutFile << "<p>" << fdef. TextDoc() << "</p>" << std::endl;
1217 *pOutFile << "<p>" << tdef. TextDoc() << "<p>" << std::endl;
1249 int clevel = rTr. Level();
1256 if(text.size()>0) continue;
1259 if(!rTr. Peek(token)) break;
1263 if(token. IsBegin( "ReferencePage")) {
1276 if(!token. IsBegin( "fliterature")) {
1288 while(!rTr. Eos( "fliterature")) {
1292 if(token. IsBegin( "fauthors")) {
1304 if(token. IsBegin( "fjournal")) {
1341 std::map<std::string,LiteratureRecord>::iterator lit;
1347 if(lit->second.mAuthors!= "") {
1352 if(lit->second.mTitle!= "") {
1357 if(lit->second.mJournal!= "") {
1362 if(lit->second.mPublisher!= "") {
1367 if(lit->second.mYear!= "") {
1372 if(lit->second.mLink!= "") {
1386 std::map<std::string,LiteratureRecord>::iterator lit;
1390 if(rLabel!=lit->second.mLabel) continue;
1392 *pStream << "<p>" << std::endl;
1393 *pStream << "<a id=\"" << "lit_" << lit->second.mLabel << "\">[" << lit->second.mLabel << "]</a>" << std::endl;
1394 *pStream << lit->second.mAuthors << ": ";
1395 *pStream << "<i>" << lit->second.mTitle << "</i>";
1396 if(lit->second.mJournal!= "") *pStream << ", " << lit->second.mJournal;
1397 if(lit->second.mPublisher!= "") *pStream << ", " << lit->second.mPublisher;
1398 if(lit->second.mYear!= "") *pStream << ", " << lit->second.mYear;
1399 *pStream << ".</p>" << std::endl;
1405 void CiteHtml(std::ostream* pStream, const std::string& rLabel) {
1407 std::string link= "reference_literature.html";
1409 std::map<std::string,LiteratureRecord>::iterator lit;
1411 if(lit!= mLiterature.end()) link=lit->second.mLink;
1413 *pStream << "<a href=\"" << link << "\">[" << rLabel << "]</a>";
1425 while(src. Peek(btag)) {
1427 if(!btag. IsBegin( "ReferencePage")) {
1448 std::cerr << "ref2html: skipping undefined page at " << src. FileLine() << std::endl;
1458 std::cerr << "ref2html: extracting page to \"" << dstfile << "\"" << std::endl;
1462 std::string srctext;
1479 while(src. Peek(btag)) {
1481 if(!btag. IsBegin( "ImageFile")) {
1489 std::cerr << "ref2html: skipping undefined image file at " << src. FileLine() << std::endl;
1497 std::cerr << "ref2html: skipping invalid image file at " << src. FileLine() << std::endl;
1502 std::string dstfile;
1503 std::transform(name.begin(), name.end(), name.begin(), tolower);
1506 std::cerr << "ref2html: extracting image file to \"" << dstfile << "\"" << std::endl;
1509 fsout.exceptions(std::ios::badbit|std::ios::failbit);
1511 fsout.open(dstfile.c_str(), std::ios::out | std::ios::binary);
1515 catch (std::ios::failure&) {
1516 std::cerr << "ref2html: file io error when writing \"" << dstfile << "\"" << std::endl;
1530 std::map< std::string , std::string > pages;
1531 std::vector< PageRecord >::iterator pit;
1534 if(pit->mChapter!= "luafaudes") continue;
1535 if(pit->mSection== "none") continue;
1536 if(pit->mSection== "") continue;
1537 if(pit->mPage== "") continue;
1539 std::string pname = pit->mPage;
1541 std::string phtml = pit->mLink;
1546 std::map< std::string , std::string >::iterator sit;
1547 for(sit=pages.begin(); sit!=pages.end(); sit++) {
1552 if(pages.size()==0) {
1553 *pIndexFile << "<li class=\"registry_item\">" << "none" << "</li>" << std::endl;
1564 int clevel = rTr. Level();
1580 if(!rTr. Peek(token)) break;
1612 *rTw. Streamp() << "<span class=\"faudes_dmath\">";
1623 *rTw. Streamp()<< "<span class=\"faudes_imath\">";
1630 if(token. IsBegin( "ffnct_reference")) {
1631 rTr. ReadBegin( "ffnct_reference", token);
1633 *rTw. Streamp() << "<div class=\"registry_function\"> " << std::endl;
1634 *rTw. Streamp() << "<h2>" << "<a id=\"" << ffnct << "\">" << ffnct << "</a></h2>" << std::endl;
1637 *rTw. Streamp() << "</div>" << std::endl;
1638 rTr. ReadEnd( "ffnct_reference");
1642 if(token. IsBegin( "ftype_reference")) {
1643 rTr. ReadBegin( "ftype_reference", token);
1645 *rTw. Streamp() << "<div class=\"registry_type\"> " << std::endl;
1646 *rTw. Streamp() << "<h2>" << "<a id=\"" << ftype << "\">" << ftype << "</a></h2>" << std::endl;
1649 *rTw. Streamp() << "</div>" << std::endl;
1650 rTr. ReadEnd( "ftype_reference");
1654 if(token. IsBegin( "fdetails")) {
1656 *rTw. Streamp() << "<h5>Detailed description:</h5>";
1661 if(token. IsBegin( "fconditions")) {
1663 *rTw. Streamp() << "<h5>Parameter Conditions:</h5>";
1668 if(token. IsBegin( "fexample")) {
1670 *rTw. Streamp() << "<h5>Example:</h5>";
1675 if(token. IsBegin( "falltypes")) {
1682 if(token. IsBegin( "fallfncts")) {
1689 if(token. IsBegin( "fallsects")) {
1696 if(token. IsBegin( "fluasects")) {
1703 if(token. IsBegin( "falllit")) {
1710 if(token. IsBegin( "fliterature")) {
1718 if(token. IsBegin( "fcontributors")) {
1744 if(token. IsBegin( "fsummary")) {
1868 *pOutFile << "<table id=\"registry_page\">" << std::endl;
1869 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
1870 *pOutFile << "<td id=\"registry_index\">" << std::endl;
1871 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1872 *pOutFile << "<li class=\"registry_heading\">libFAUDES</li>" << std::endl;
1873 ListItemHtml(pOutFile, "reference_index.html", "Reference");
1874 ListItemHtml(pOutFile, "reference_types.html", "Type Index");
1875 ListItemHtml(pOutFile, "reference_functions.html", "Function Index");
1876 ListItemHtml(pOutFile, "reference_literature.html", "Literature");
1877 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1879 *pOutFile << "</ul></td>" << std::endl;
1880 *pOutFile << "<td id=\"registry_content\">" << std::endl;
1885 *pOutFile << "<table id=\"registry_page\">" << std::endl;
1886 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
1887 *pOutFile << "<td id=\"registry_index\">" << std::endl;
1888 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1889 *pOutFile << "<li class=\"registry_heading\">luafaudes</li>" << std::endl;
1891 << "<script language=\"JavaScript\"> var luafaudes=function() { "
1892 << " popupWin = window.open('luafaudes_repl.html','open_window',"
1893 << " 'resizable,dependent, width=720, height=480, left=0, top=0'); } "
1894 << "</script>" << std::endl;
1896 ListItemHtml(pOutFile, "javascript:luafaudes();", "Lua-Console");
1897 ListItemHtml(pOutFile, "faudes_luaext.html", "Lua-Extensions");
1898 ListItemHtml(pOutFile, "faudes_luatech.html", "Technical Detail");
1899 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1900 *pOutFile << "<li class=\"registry_heading\">Tutorials</li>" << std::endl;
1902 *pOutFile << "</ul></td>" << std::endl;
1903 *pOutFile << "<td id=\"registry_content\">" << std::endl;
1918 *pOutFile << "</td>" << std::endl;
1919 *pOutFile << "</tr>" << std::endl;
1920 *pOutFile << "</table>" << std::endl;
1927 *pOutFile << "</td>" << std::endl;
1928 *pOutFile << "</tr>" << std::endl;
1929 *pOutFile << "</table>" << std::endl;
1934 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
1935 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
1936 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
1937 *pOutFile << "<div class=\"registry_trigger\"> <span>>></span>" << std::endl;
1938 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1940 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1942 *pOutFile << "</ul></div>" << std::endl;
1947 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
1948 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
1949 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
1950 *pOutFile << "<div class=\"registry_trigger\"> <span>>></span>" << std::endl;
1951 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1952 *pOutFile << "<li class=\"registry_heading\">luafaudes</li>" << std::endl;
1953 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luafaudes.html\">Introduction</a></li>" << std::endl;
1954 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luaext.html\">Lua-Extansions</a></li>" << std::endl;
1955 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luatech.html\">Techn. Details</a></li>" << std::endl;
1956 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1957 *pOutFile << "<li class=\"registry_item\"><a href=\"#\">Top of Page</a></li>" << std::endl;
1958 *pOutFile << "</ul></div>" << std::endl;
1996 *pOutFile << "<table id=\"registry_page\">" << std::endl;
1997 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
1998 *pOutFile << "<td id=\"registry_index\">" << std::endl;
1999 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
2000 *pOutFile << "<li class=\"registry_heading\">libFAUDES</li>" << std::endl;
2002 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
2003 *pOutFile << "<li class=\"registry_heading\">Sections</li>" << std::endl;
2004 ListItemHtml(pOutFile, "group__ContainerClasses.html", "Sets");
2005 ListItemHtml(pOutFile, "group__GeneratorClasses.html", "Generators");
2006 ListItemHtml(pOutFile, "group__GeneratorFunctions.html", "Functions");
2007 ListItemHtml(pOutFile, "group__AllPlugins.html", "PlugIns");
2008 ListItemHtml(pOutFile, "group__Tutorials.html", "Tutorials");
2009 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
2010 *pOutFile << "<li class=\"registry_heading\">Index</li>" << std::endl;
2013 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
2014 *pOutFile << "</ul></td>" << std::endl;
2015 *pOutFile << "<td id=\"registry_content\">" << std::endl;
2031 *pOutFile << "</td>" << std::endl;
2032 *pOutFile << "</tr>" << std::endl;
2033 *pOutFile << "</table>" << std::endl;
2036 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
2037 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
2038 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
2039 *pOutFile << "<div class=\"registry_trigger\"> <span>>></span>" << std::endl;
2040 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
2041 *pOutFile << "<li class=\"registry_heading\">C++ API</li>" << std::endl;
2042 *pOutFile << "<li class=\"registry_item\"><a href=\"index.html\">Introduction</a></li>" << std::endl;
2043 *pOutFile << "<li class=\"registry_item\"><a href=\"group__ContainerClasses.html\">Sets</a></li>" << std::endl;
2044 *pOutFile << "<li class=\"registry_item\"><a href=\"group__GeneratorClasses.html\">Generators</a></li>" << std::endl;
2045 *pOutFile << "<li class=\"registry_item\"><a href=\"group__GeneratorFunctions.html\">Functions</a></li>" << std::endl;
2046 *pOutFile << "<li class=\"registry_item\"><a href=\"group__AllPlugins.html\">PlugIns</a></li>" << std::endl;
2047 *pOutFile << "<li class=\"registry_item\"><a href=\"group__Tutorials.html\">Tutorials</a></li>" << std::endl;
2048 *pOutFile << "<li class=\"registry_item\"><a href=\"classes.html\">Classes</a></li>" << std::endl;
2049 *pOutFile << "<li class=\"registry_item\"><a href=\"files.html\">Files</a></li>" << std::endl;
2050 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
2051 *pOutFile << "<li class=\"registry_item\"><a href=\"#\">Top of Page</a></li>" << std::endl;
2052 *pOutFile << "</ul></div>" << std::endl;
2078 for(i=1; i<argc; i++) {
2079 std::string option(argv[i]);
2081 if(option== "-rti") {
2087 if(option== "-flx") {
2093 if(option== "-css") {
2099 if(option== "-cnav") {
2105 if(option== "-inc") {
2111 if(option== "-rel") {
2117 if(option== "-chapter") {
2123 if(option== "-section") {
2129 if(option== "-extract") {
2135 if(option== "-toc") {
2142 if(option== "-doxheader") {
2149 if(option== "-doxfooter") {
2156 if(option== "-app") {
2161 if((option== "-?") || (option== "--help")) {
2167 if(option.at(0)== '-') {
2176 for(;i<argc-1; i++) {
2177 std::string option(argv[i]);
2179 if(option.at(0)== '-') {
2180 usage_exit( "missplaced/unknown option " + option);
2188 std::string option(argv[i]);
2190 if(option.at(0)== '-') {
2191 usage_exit( "missplaced/unknown option " + option);
2211 std::string section=fit->second->KeywordAt(0);
2212 std::transform(section.begin(), section.end(), section.begin(), tolower);
2224 std::string section=fit->second->KeywordAt(0);
2225 std::transform(section.begin(), section.end(), section.begin(), tolower);
2242 usage_exit( "extract mode requires one source file");
2245 usage_exit( "extract mode requires destination directory");
2247 std::cerr << "ref2html: extract pages from " << * mSrcFiles.begin() << std::endl;
2259 usage_exit( "toc mode requires destination file");
2262 std::ostream* hout= &std::cout;
2265 fout.open( mDstFile.c_str(), std::ios::out);
2269 std::set< std::string >::iterator sit= mSrcFiles.begin();
2271 std::cerr << "ref2html: process toc " << *sit << std::endl;
2286 if(dodhd || dodft) {
2288 usage_exit( "header-footer mode requires destination file");
2291 std::ostream* hout= &std::cout;
2294 fout.open( mDstFile.c_str(), std::ios::out);
2305 std::set< std::string > srcfiles;
2306 std::set< std::string >::iterator sit= mSrcFiles.begin();
2310 std::set< std::string >::iterator dit=dirfiles.begin();
2311 for(;dit!=dirfiles.end();++dit) {
2314 std::string src= PrependPath(*sit,base + ".fref");
2316 if(ext!= "fref") continue;
2318 srcfiles.insert(src);
2325 usage_exit( "multiple source files require destination directory");
2333 std::string src= *sit;
2338 std::cout << "ref2html: processing " << src << " to " << dst << std::endl;
2340 fout.open(dst.c_str(), std::ios::out);
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
int VariantsSize(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
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)
void ReadEnd(const std::string &rLabel)
void ReadSection(std::string &rSectionString)
void ReadBegin(const std::string &rLabel)
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
bool ExistsAttributeString(const std::string &name)
void SetEmpty(const std::string &rName)
void ClrAttribute(const std::string &name)
void SetBegin(const std::string &rName)
void InsAttributeString(const std::string &name, const std::string &value)
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
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)
int main(int argc, char *argv[])
std::string mExitChapterClass
void ChaptersPrefix(const std::string &prefix)
void DoxygenHeader(std::ostream *pOutFile)
std::set< std::string > mSrcFiles
void RecordPages(TokenReader &rTr)
void RefpageHtml(std::ostream *pOutFile, std::string inputfile)
std::map< std::string, std::map< std::string, PageRecord > > mRefSectPages
std::string TimeStamp(void)
void XtractFiles(TokenReader &src, const std::string &rDstDir)
std::vector< PageRecord > mAllPages
std::string mReferencePrefix
void ShortdocHtml(std::ostream *pOutFile, std::string fname)
std::string mThisChapterClass
std::string mLuafaudesPrefix
void FooterHtml(std::ostream *pStream)
std::string TexScripts(const std::string &rTexString)
std::string mChaptersPrefix
void ListItemHtml(std::ostream *pStream, const std::string &rLink, const std::string &rText)
void DumpLiterature(TokenWriter &rTw)
void BottomLineHtml(std::ostream *pStream)
void ListFunctionsHtml(std::ostream *pIndexFile, const std::string &key="")
void RecordLiterature(TokenReader &rTr)
std::map< std::string, LiteratureRecord > mLiterature
std::string mOtherChapterClass
void FunctionIndexHtml(std::ostream *pIndexFile, const std::string &key="")
void MathHtml(std::ostream *pStream, const std::string &rMathString)
std::set< std::string > mInclLuaSections
std::string mLuafaudesLink
void LiteratureHtml(std::ostream *pStream, const std::string &rLabel="")
void TypeIndexHtml(std::ostream *pIndexFile, const std::string &key="")
std::string TexSpacing(const std::string &rTexString)
void SignatureHtml(std::ostream *pOutFile, std::string function)
std::string mDownloadLink
void DumpPages(TokenWriter &rTw)
std::string PrettyPage(const std::string page)
void TextHtml(std::ostream *pStream, const std::string &rText)
std::string mCsourcePrefix
void ImageHtml(std::ostream *pStream, const std::string &rFileName)
void ReferenceIndexHtml(std::ostream *pIndexFile, const std::string &key="")
void usage_exit(const std::string &rMessage="")
void HeaderHtml(std::ostream *pStream)
void CiteHtml(std::ostream *pStream, const std::string &rLabel)
void LuafaudesIndexHtml(std::ostream *pIndexFile)
std::string TexMacroSubstitute1(const std::string &rTexString, const std::string &rMacro, const std::string &rSubst)
bool mStandaloneReference
void ListSectionsHtml(std::ostream *pIndexFile, const std::string &key="")
void FunctionHtml(std::ostream *pStream, const std::string &rFunctionName)
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)
std::set< std::string > mExclLuaSections
void ListTypesHtml(std::ostream *pIndexFile, const std::string &key="")
libFAUDES 2.33c
--- 2025.05.15
--- c++ api documentaion by doxygen
|