|
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;
125 std::string mDownloadLink= "http://www.rt.techfak.fau.de/FGdes/download.html";
126 std::string mFaudesLink= "http://www.rt.techfak.fau.de/FGdes/faudes";
128 std::string mLuafaudesLink= "http://www.rt.techfak.fau.de/FGdes/faudes/luafaudes/";
129 std::string mCsourceLink= "http://www.rt.techfak.fau.de/FGdes/faudes/csource/";
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;
574 buff= StringSubstitute(buff, "∈", "<span class=\"faudes_fmath\">∈</span>");
575 buff= StringSubstitute(buff, "∉", "<span class=\"faudes_fmath\">∉</span>");
576 buff= StringSubstitute(buff, "∃", "<span class=\"faudes_fmath\">∃</span>");
577 buff= StringSubstitute(buff, "∀", "<span class=\"faudes_fmath\">∀</span>");
578 buff= StringSubstitute(buff, "∪", "<span class=\"faudes_fmath\">∪</span>");
579 buff= StringSubstitute(buff, "&dcup;", "<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, "⇐", "<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>");
621 std::map< std::string , std::map< std::string , PageRecord > > mRefSectPages;
626 int clevel = rTr. Level();
633 if(text.size()>0) continue;
636 if(!rTr. Peek(token)) break;
640 if(!token. IsBegin( "ReferencePage")) {
672 std::transform(indexfile.begin(), indexfile.end(), indexfile.begin(), tolower);
686 std::size_t spos = title.find(section);
687 if(spos==0 && title.size()>section.size())
689 for(spos=0; spos< mFrefPage.size(); spos++){
732 std::vector<PageRecord>::iterator pit;
742 if(pit->mSummary== "") {
764 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
771 std::string section= tit->second->Name();
772 std::transform(section.begin(), section.end(), section.begin(), tolower);
773 if(section!=key) continue;
776 if(tit->second->TextDoc()== "") continue;
778 *pIndexFile << "<tr><td valign=\"top\">";
779 TypeHtml(pIndexFile,tit->second->Name());
780 *pIndexFile << "</td><td valign=\"top\">";
781 TypeHtml(pIndexFile,tit->second->TextDoc());
782 *pIndexFile << "</td></tr>" << std::endl;
787 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
789 *pIndexFile << "</table>" << std::endl;
799 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
806 std::string section= fit->second->Name();
807 std::transform(section.begin(), section.end(), section.begin(), tolower);
808 if(section!=key) continue;
811 if(fit->second->TextDoc()== "") continue;
813 *pIndexFile << "<tr><td valign=\"top\">";
815 *pIndexFile << "</td><td valign=\"top\">";
816 TypeHtml(pIndexFile,fit->second->TextDoc());
817 *pIndexFile << "</td></tr>" << std::endl;
822 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
824 *pIndexFile << "</table>" << std::endl;
836 std::set< std::string > sections;
837 std::map< std::string , std::string > link;
838 std::map< std::string , std::string > summary;
839 std::vector< PageRecord >::iterator pit;
841 std::string chap=pit->mChapter;
842 std::transform(chap.begin(), chap.end(), chap.begin(), tolower);
843 std::string sect=pit->mSection;
844 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
845 std::string page=pit->mPage;
846 std::transform(page.begin(), page.end(), page.begin(), tolower);
849 if(chap!= "reference") continue;
850 if(sect== "none") continue;
851 if(sect== "") continue;
852 if(page!= "index") continue;
859 std::string pname = pit->mSection;
861 std::string psumm = pit->mSummary;
862 if(psumm== "") psumm = pit->mTitle;
864 sections.insert(pname);
865 link[pname]=pit->mLink;
866 summary[pname]=psumm;
870 std::vector< std::string > sortvec;
871 if(sections.find( "CoreFaudes")!=sections.end())
872 sortvec.push_back( "CoreFaudes");
873 std::set< std::string >::iterator sit;
874 for(sit=sections.begin(); sit != sections.end(); sit++) {
875 if(*sit== "CoreFaudes") continue;
876 sortvec.push_back(*sit);
880 *pIndexFile << "<table class=\"registry_toc\">" << std::endl;
883 std::vector< std::string >::iterator vit;
885 for(vit=sortvec.begin(); vit != sortvec.end(); vit++) {
887 std::string sname = *vit;
889 std::string ssumm = summary[sname];
891 *pIndexFile << "<tr>" << std::endl;
892 *pIndexFile << "<td valign=\"top\"><a href=\"" << shtml << "\">" << sname << "</a></td>";
893 *pIndexFile << "<td valign=\"top\">";
894 *pIndexFile << ssumm;
895 *pIndexFile << "</td></tr>"<< std::endl;
900 if(!found) *pIndexFile << "<tr><td><i>no matches found</i></td></tr>" << std::endl;
903 *pIndexFile << "</table>" << std::endl;
923 std::string section= tit->second->KeywordAt(0);
924 std::transform(section.begin(), section.end(), section.begin(), tolower);
925 if(section!=key) continue;
928 std::string tyname = tit->second->Name();
929 std::string tyhtml = tit->second->HtmlDoc();
931 if(tyhtml== "") continue;
932 if(tyhtml== "none") continue;
936 *pIndexFile << "<li class=\"registry_heading\">Types</li>" << std::endl;
942 if(head) *pIndexFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
952 std::string lkey=key;
953 std::transform(lkey.begin(), lkey.end(), lkey.begin(), tolower);
962 std::string section= fit->second->KeywordAt(0);
963 std::transform(section.begin(), section.end(), section.begin(), tolower);
964 if(section!=lkey) continue;
967 if(fit->second->TextDoc()== "") continue;
969 std::string fname = fit->second->Name();
970 std::string fhtml = fit->second->HtmlDoc();
971 if(fhtml== "") continue;
975 *pIndexFile << "<li class=\"registry_heading\">Functions</li>" << std::endl;
979 *pIndexFile << "<li class=\"registry_item\"> "<< fname << "</li>" << std::endl;
987 if(head) *pIndexFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
998 std::map< std::string , std::string > sectlink;
999 std::vector< PageRecord >::iterator pit;
1001 std::string chap=pit->mChapter;
1002 std::transform(chap.begin(), chap.end(), chap.begin(), tolower);
1003 std::string sect=pit->mSection;
1004 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1006 if(chap!= "reference") continue;
1007 if(sect== "none") continue;
1008 if(sect== "") continue;
1010 std::string pname = pit->mSection;
1012 std::string phtml = sect+ "_index.html";
1014 sectlink[pname]=phtml;
1018 std::vector< std::string > sections;
1019 if(sectlink[ "CoreFaudes"]!= "") sections.push_back( "CoreFaudes");
1020 std::map< std::string , std::string >::iterator sit;
1021 for(sit=sectlink.begin(); sit!=sectlink.end(); sit++) {
1022 std::string psect=sit->first;
1023 if(psect== "CoreFaudes") continue;
1024 sections.push_back(psect);
1028 if(sections.size()!=0)
1029 *pIndexFile << "<li class=\"registry_heading\">Sections</li>" << std::endl;
1033 for(vit=0; vit<sections.size(); vit++) {
1034 std::string psect=sections.at(vit);
1035 std::string plink=sectlink[psect];
1036 if(plink== "") continue;
1038 std::string sect=psect;
1039 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1040 std::map< std::string , std::map< std::string , PageRecord > > ::iterator spit = mRefSectPages.find(sect);
1043 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1044 for(;pit!=spit->second.end();pit++) {
1045 std::string ppage = pit->second.mPage;
1046 std::transform(ppage.begin(), ppage.end(), ppage.begin(), tolower);
1047 if(ppage== "index") continue;
1048 if(ppage== "0_index") continue;
1049 if(ppage== "00_index") continue;
1059 *pIndexFile << "<li class=\"registry_pitem\">" << std::endl
1060 << "<a href=\"" << plink << "\">" << psect << "</a>" << std::endl
1061 << "<a href=\"" << plink << "\" class=\"registry_blinda\"> </a>" << std::endl
1062 << "<ul>" << std::endl
1063 << "<li class=\"registry_heading\">" << psect << "</li>" << std::endl;
1064 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1065 for(;pit!=spit->second.end();pit++) {
1067 std::string ppage = PrettyPage(pit->second.mPage);
1069 std::string ipage = ppage;
1070 std::transform(ipage.begin(), ipage.end(), ipage.begin(), tolower);
1072 if(ipage== "index") ppage= "Introduction";
1074 *pIndexFile << "<li class=\"registry_item\"><a href=\"" << pit->second.mLink << "\">"
1075 << ppage << "</a></li>" << std::endl;
1078 *pIndexFile << "</ul></li>" << std::endl;
1082 if(sections.size()!=0)
1083 *pIndexFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1101 std::string sect=key;
1102 std::transform(sect.begin(), sect.end(), sect.begin(), tolower);
1103 std::string plink=sect+ "_index.html";
1104 std::string psect=key;
1105 std::map< std::string , std::map< std::string , PageRecord > > ::iterator spit = mRefSectPages.find(sect);
1108 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1109 for(;pit!=spit->second.end();pit++) {
1110 std::string ppage = pit->second.mPage;
1111 psect=pit->second.mSection;
1112 std::transform(ppage.begin(), ppage.end(), ppage.begin(), tolower);
1113 if(ppage== "index") continue;
1114 if(ppage== "0_index") continue;
1115 if(ppage== "00_index") continue;
1124 if(key== "") psect= "Reference";
1127 *pIndexFile << "<li class=\"registry_heading\">" << psect << "</li>" << std::endl;
1128 std::map< std::string , PageRecord >::iterator pit = spit->second.begin();
1129 for(;pit!=spit->second.end();pit++) {
1131 std::string ppage = PrettyPage(pit->second.mPage);
1133 std::string ipage = ppage;
1134 std::transform(ipage.begin(), ipage.end(), ipage.begin(), tolower);
1136 if(ipage== "index") ppage= "Introduction";
1138 *pIndexFile << "<li class=\"registry_item\"><a href=\"" << pit->second.mLink << "\">"
1139 << ppage << "</a></li>" << std::endl;
1160 *pOutFile << "<div class=\"registry_signature\">" << std::endl;
1161 *pOutFile << "<h5><strong>Signature:</strong></h5>" << std::endl;
1166 *pOutFile << "<p>" << fdef. Name() << "(";
1168 for( int j=0; j < sigi. Size(); j++) {
1169 if(j!=0) *pOutFile << ", ";
1173 *pOutFile << " <i>" << parj. Name() << "</i></span>";
1175 *pOutFile << ")</p>" << std::endl;
1180 *pOutFile << std::endl << "</div>" << std::endl;
1197 *pOutFile << "<p>" << fdef. TextDoc() << "</p>" << std::endl;
1212 *pOutFile << "<p>" << tdef. TextDoc() << "<p>" << std::endl;
1244 int clevel = rTr. Level();
1251 if(text.size()>0) continue;
1254 if(!rTr. Peek(token)) break;
1258 if(token. IsBegin( "ReferencePage")) {
1271 if(!token. IsBegin( "fliterature")) {
1283 while(!rTr. Eos( "fliterature")) {
1287 if(token. IsBegin( "fauthors")) {
1299 if(token. IsBegin( "fjournal")) {
1336 std::map<std::string,LiteratureRecord>::iterator lit;
1342 if(lit->second.mAuthors!= "") {
1347 if(lit->second.mTitle!= "") {
1352 if(lit->second.mJournal!= "") {
1357 if(lit->second.mPublisher!= "") {
1362 if(lit->second.mYear!= "") {
1367 if(lit->second.mLink!= "") {
1381 std::map<std::string,LiteratureRecord>::iterator lit;
1385 if(rLabel!=lit->second.mLabel) continue;
1387 *pStream << "<p>" << std::endl;
1388 *pStream << "<a id=\"" << "lit_" << lit->second.mLabel << "\">[" << lit->second.mLabel << "]</a>" << std::endl;
1389 *pStream << lit->second.mAuthors << ": ";
1390 *pStream << "<i>" << lit->second.mTitle << "</i>";
1391 if(lit->second.mJournal!= "") *pStream << ", " << lit->second.mJournal;
1392 if(lit->second.mPublisher!= "") *pStream << ", " << lit->second.mPublisher;
1393 if(lit->second.mYear!= "") *pStream << ", " << lit->second.mYear;
1394 *pStream << ".</p>" << std::endl;
1400 void CiteHtml(std::ostream* pStream, const std::string& rLabel) {
1402 std::string link= "reference_literature.html";
1404 std::map<std::string,LiteratureRecord>::iterator lit;
1406 if(lit!= mLiterature.end()) link=lit->second.mLink;
1408 *pStream << "<a href=\"" << link << "\">[" << rLabel << "]</a>";
1420 while(src. Peek(btag)) {
1422 if(!btag. IsBegin( "ReferencePage")) {
1443 std::cerr << "ref2html: skipping undefined page at " << src. FileLine() << std::endl;
1453 std::cerr << "ref2html: extracting page to \"" << dstfile << "\"" << std::endl;
1457 std::string srctext;
1474 while(src. Peek(btag)) {
1476 if(!btag. IsBegin( "ImageFile")) {
1484 std::cerr << "ref2html: skipping undefined image file at " << src. FileLine() << std::endl;
1492 std::cerr << "ref2html: skipping invalid image file at " << src. FileLine() << std::endl;
1497 std::string dstfile;
1498 std::transform(name.begin(), name.end(), name.begin(), tolower);
1501 std::cerr << "ref2html: extracting image file to \"" << dstfile << "\"" << std::endl;
1504 fsout.exceptions(std::ios::badbit|std::ios::failbit);
1506 fsout.open(dstfile.c_str(), std::ios::out | std::ios::binary);
1510 catch (std::ios::failure&) {
1511 std::cerr << "ref2html: file io error when writing \"" << dstfile << "\"" << std::endl;
1525 std::map< std::string , std::string > pages;
1526 std::vector< PageRecord >::iterator pit;
1529 if(pit->mChapter!= "luafaudes") continue;
1530 if(pit->mSection== "none") continue;
1531 if(pit->mSection== "") continue;
1532 if(pit->mPage== "") continue;
1534 std::string pname = pit->mPage;
1536 std::string phtml = pit->mLink;
1541 std::map< std::string , std::string >::iterator sit;
1542 for(sit=pages.begin(); sit!=pages.end(); sit++) {
1547 if(pages.size()==0) {
1548 *pIndexFile << "<li class=\"registry_item\">" << "none" << "</li>" << std::endl;
1559 int clevel = rTr. Level();
1575 if(!rTr. Peek(token)) break;
1607 *rTw. Streamp() << "<span class=\"faudes_dmath\">";
1618 *rTw. Streamp()<< "<span class=\"faudes_imath\">";
1625 if(token. IsBegin( "ffnct_reference")) {
1626 rTr. ReadBegin( "ffnct_reference", token);
1628 *rTw. Streamp() << "<div class=\"registry_function\"> " << std::endl;
1629 *rTw. Streamp() << "<h2>" << "<a id=\"" << ffnct << "\">" << ffnct << "</a></h2>" << std::endl;
1632 *rTw. Streamp() << "</div>" << std::endl;
1633 rTr. ReadEnd( "ffnct_reference");
1637 if(token. IsBegin( "ftype_reference")) {
1638 rTr. ReadBegin( "ftype_reference", token);
1640 *rTw. Streamp() << "<div class=\"registry_type\"> " << std::endl;
1641 *rTw. Streamp() << "<h2>" << "<a id=\"" << ftype << "\">" << ftype << "</a></h2>" << std::endl;
1644 *rTw. Streamp() << "</div>" << std::endl;
1645 rTr. ReadEnd( "ftype_reference");
1649 if(token. IsBegin( "fdetails")) {
1651 *rTw. Streamp() << "<h5>Detailed description:</h5>";
1656 if(token. IsBegin( "fconditions")) {
1658 *rTw. Streamp() << "<h5>Parameter Conditions:</h5>";
1663 if(token. IsBegin( "fexample")) {
1665 *rTw. Streamp() << "<h5>Example:</h5>";
1670 if(token. IsBegin( "falltypes")) {
1677 if(token. IsBegin( "fallfncts")) {
1684 if(token. IsBegin( "fallsects")) {
1691 if(token. IsBegin( "fluasects")) {
1698 if(token. IsBegin( "falllit")) {
1705 if(token. IsBegin( "fliterature")) {
1713 if(token. IsBegin( "fcontributors")) {
1739 if(token. IsBegin( "fsummary")) {
1863 *pOutFile << "<table id=\"registry_page\">" << std::endl;
1864 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
1865 *pOutFile << "<td id=\"registry_index\">" << std::endl;
1866 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1867 *pOutFile << "<li class=\"registry_heading\">libFAUDES</li>" << std::endl;
1868 ListItemHtml(pOutFile, "reference_index.html", "Reference");
1869 ListItemHtml(pOutFile, "reference_types.html", "Type Index");
1870 ListItemHtml(pOutFile, "reference_functions.html", "Function Index");
1871 ListItemHtml(pOutFile, "reference_literature.html", "Literature");
1872 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1874 *pOutFile << "</ul></td>" << std::endl;
1875 *pOutFile << "<td id=\"registry_content\">" << std::endl;
1880 *pOutFile << "<table id=\"registry_page\">" << std::endl;
1881 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
1882 *pOutFile << "<td id=\"registry_index\">" << std::endl;
1883 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1884 *pOutFile << "<li class=\"registry_heading\">luafaudes</li>" << std::endl;
1886 << "<script language=\"JavaScript\"> var luafaudes=function() { "
1887 << " popupWin = window.open('luafaudes_repl.html','open_window',"
1888 << " 'resizable,dependent, width=720, height=480, left=0, top=0'); } "
1889 << "</script>" << std::endl;
1891 ListItemHtml(pOutFile, "javascript:luafaudes();", "Lua-Console");
1892 ListItemHtml(pOutFile, "faudes_luaext.html", "Lua-Extensions");
1893 ListItemHtml(pOutFile, "faudes_luatech.html", "Technical Detail");
1894 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1895 *pOutFile << "<li class=\"registry_heading\">Tutorials</li>" << std::endl;
1897 *pOutFile << "</ul></td>" << std::endl;
1898 *pOutFile << "<td id=\"registry_content\">" << std::endl;
1913 *pOutFile << "</td>" << std::endl;
1914 *pOutFile << "</tr>" << std::endl;
1915 *pOutFile << "</table>" << std::endl;
1922 *pOutFile << "</td>" << std::endl;
1923 *pOutFile << "</tr>" << std::endl;
1924 *pOutFile << "</table>" << std::endl;
1929 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
1930 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
1931 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
1932 *pOutFile << "<div class=\"registry_trigger\"> <span>>></span>" << std::endl;
1933 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1935 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1937 *pOutFile << "</ul></div>" << std::endl;
1942 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
1943 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
1944 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
1945 *pOutFile << "<div class=\"registry_trigger\"> <span>>></span>" << std::endl;
1946 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1947 *pOutFile << "<li class=\"registry_heading\">luafaudes</li>" << std::endl;
1948 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luafaudes.html\">Introduction</a></li>" << std::endl;
1949 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luaext.html\">Lua-Extansions</a></li>" << std::endl;
1950 *pOutFile << "<li class=\"registry_item\"><a href=\"faudes_luatech.html\">Techn. Details</a></li>" << std::endl;
1951 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1952 *pOutFile << "<li class=\"registry_item\"><a href=\"#\">Top of Page</a></li>" << std::endl;
1953 *pOutFile << "</ul></div>" << std::endl;
1991 *pOutFile << "<table id=\"registry_page\">" << std::endl;
1992 *pOutFile << "<tr id=\"registry_row\">" << std::endl;
1993 *pOutFile << "<td id=\"registry_index\">" << std::endl;
1994 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
1995 *pOutFile << "<li class=\"registry_heading\">libFAUDES</li>" << std::endl;
1997 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
1998 *pOutFile << "<li class=\"registry_heading\">Sections</li>" << std::endl;
1999 ListItemHtml(pOutFile, "group__ContainerClasses.html", "Sets");
2000 ListItemHtml(pOutFile, "group__GeneratorClasses.html", "Generators");
2001 ListItemHtml(pOutFile, "group__GeneratorFunctions.html", "Functions");
2002 ListItemHtml(pOutFile, "group__AllPlugins.html", "PlugIns");
2003 ListItemHtml(pOutFile, "group__Tutorials.html", "Tutorials");
2004 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
2005 *pOutFile << "<li class=\"registry_heading\">Index</li>" << std::endl;
2008 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
2009 *pOutFile << "</ul></td>" << std::endl;
2010 *pOutFile << "<td id=\"registry_content\">" << std::endl;
2026 *pOutFile << "</td>" << std::endl;
2027 *pOutFile << "</tr>" << std::endl;
2028 *pOutFile << "</table>" << std::endl;
2031 *pOutFile << "</div>" << std::endl << "</div>" << std::endl;
2032 *pOutFile << "<div id=\"cxwrapper1000\">" << std::endl;
2033 *pOutFile << "<div id=\"dxwrapper1000\">" << std::endl;
2034 *pOutFile << "<div class=\"registry_trigger\"> <span>>></span>" << std::endl;
2035 *pOutFile << "<ul class=\"registry_list\">" << std::endl;
2036 *pOutFile << "<li class=\"registry_heading\">C++ API</li>" << std::endl;
2037 *pOutFile << "<li class=\"registry_item\"><a href=\"index.html\">Introduction</a></li>" << std::endl;
2038 *pOutFile << "<li class=\"registry_item\"><a href=\"group__ContainerClasses.html\">Sets</a></li>" << std::endl;
2039 *pOutFile << "<li class=\"registry_item\"><a href=\"group__GeneratorClasses.html\">Generators</a></li>" << std::endl;
2040 *pOutFile << "<li class=\"registry_item\"><a href=\"group__GeneratorFunctions.html\">Functions</a></li>" << std::endl;
2041 *pOutFile << "<li class=\"registry_item\"><a href=\"group__AllPlugins.html\">PlugIns</a></li>" << std::endl;
2042 *pOutFile << "<li class=\"registry_item\"><a href=\"group__Tutorials.html\">Tutorials</a></li>" << std::endl;
2043 *pOutFile << "<li class=\"registry_item\"><a href=\"classes.html\">Classes</a></li>" << std::endl;
2044 *pOutFile << "<li class=\"registry_item\"><a href=\"files.html\">Files</a></li>" << std::endl;
2045 *pOutFile << "<li class=\"registry_blanc\"> </li>" << std::endl;
2046 *pOutFile << "<li class=\"registry_item\"><a href=\"#\">Top of Page</a></li>" << std::endl;
2047 *pOutFile << "</ul></div>" << std::endl;
2073 for(i=1; i<argc; i++) {
2074 std::string option(argv[i]);
2076 if(option== "-rti") {
2082 if(option== "-flx") {
2088 if(option== "-css") {
2094 if(option== "-cnav") {
2100 if(option== "-inc") {
2106 if(option== "-rel") {
2112 if(option== "-chapter") {
2118 if(option== "-section") {
2124 if(option== "-extract") {
2130 if(option== "-toc") {
2137 if(option== "-doxheader") {
2144 if(option== "-doxfooter") {
2151 if(option== "-app") {
2156 if((option== "-?") || (option== "--help")) {
2162 if(option.at(0)== '-') {
2171 for(;i<argc-1; i++) {
2172 std::string option(argv[i]);
2174 if(option.at(0)== '-') {
2175 usage_exit( "missplaced/unknown option " + option);
2183 std::string option(argv[i]);
2185 if(option.at(0)== '-') {
2186 usage_exit( "missplaced/unknown option " + option);
2206 std::string section=fit->second->KeywordAt(0);
2207 std::transform(section.begin(), section.end(), section.begin(), tolower);
2219 std::string section=fit->second->KeywordAt(0);
2220 std::transform(section.begin(), section.end(), section.begin(), tolower);
2237 usage_exit( "extract mode requires one source file");
2240 usage_exit( "extract mode requires destination directory");
2242 std::cerr << "ref2html: extract pages from " << * mSrcFiles.begin() << std::endl;
2254 usage_exit( "toc mode requires destination file");
2257 std::ostream* hout= &std::cout;
2260 fout.open( mDstFile.c_str(), std::ios::out);
2264 std::set< std::string >::iterator sit= mSrcFiles.begin();
2266 std::cerr << "ref2html: process toc " << *sit << std::endl;
2281 if(dodhd || dodft) {
2283 usage_exit( "header-footer mode requires destination file");
2286 std::ostream* hout= &std::cout;
2289 fout.open( mDstFile.c_str(), std::ios::out);
2300 std::set< std::string > srcfiles;
2301 std::set< std::string >::iterator sit= mSrcFiles.begin();
2305 std::set< std::string >::iterator dit=dirfiles.begin();
2306 for(;dit!=dirfiles.end();++dit) {
2309 std::string src= PrependPath(*sit,base + ".fref");
2311 if(ext!= "fref") continue;
2313 srcfiles.insert(src);
2320 usage_exit( "multiple source files require destination directory");
2328 std::string src= *sit;
2333 std::cout << "ref2html: processing " << src << " to " << dst << std::endl;
2335 fout.open(dst.c_str(), std::ios::out);
const std::string & HtmlDoc(void) const
const std::string & Name(void) const Get name of the entety to document (aka faudes-type or faudes-function).
const std::string & TextDoc(void) const
A FunctionDefinition defines the interface to a faudes-function.
const Signature & Variant(const std::string &rName) const Return reference to Signature by name.
int VariantsSize(void) const Return number of supported Signature instances.
Iterator End(void) const STL interator to the internal function-name map.
static FunctionRegistry * G() Method to access the single global instance of the registry.
std::map< std::string, FunctionDefinition * >::const_iterator Iterator Convenience typedef to access registry entries.
const FunctionDefinition & Definition(const std::string &rFunctionName) const Look up the function definition by faudes-function name.
void MergeDocumentation(TokenReader &rTr) Scan token input for function documentation.
Structure to model a parameter type within the Signature of a Function.
const std::string & Type(void) const Get type.
const ParamAttr & Attribute(void) const Get Attribute.
static std::string AStr(Parameter::ParamAttr attr) Convenience method to produce a textual representation of an io attribute.
const std::string & Name(void) const Get name.
int Size(void) const Return number of parameters.
const Parameter & At(int n) const Get parameter type by position.
A TokenReader reads sequential tokens from a file or string.
std::string FileLine(void) const Return "filename:line".
void ReadCharacterData(std::string &rData) Read plain text.
void ReadText(const std::string &rLabel, std::string &rText) Read plain text.
bool Eos(const std::string &rLabel) Peek a token and check whether it ends the specified section.
void SeekBegin(const std::string &rLabel) Find specified begin label.
int Level(void) const Return current level of section nesting.
void ReadEnd(const std::string &rLabel) Close the current section by matching the previous ReadBegin().
void Rewind(void) Rewind stream.
void ReadSection(std::string &rSectionString) Read XML section.
void ReadBegin(const std::string &rLabel) Open a section by specified label.
bool Get(Token &token) Get next token.
bool Peek(Token &token) Peek next token.
bool ExistsBegin(const std::string &rLabel) Search for specified element.
std::string FileName(void) const Access the filename.
A TokenWriter writes sequential tokens to a file, a string or stdout.
void WriteCharacterData(const std::string &rCharData) Write character data.
void Write(Token &rToken) Write next token.
void Endl(void) Write endl separator.
std::ostream * Streamp(void) Access C++ stream.
void WriteEnd(const std::string &rLabel) Write end label.
void Flush(void) Flush any buffers.
void WriteBegin(const std::string &rLabel) Write begin label.
Tokens model atomic data for stream IO.
bool IsBinary(void) const Test token Type.
const std::string & PreceedingSpace(void) const Preceeding space when writing to stream.
const std::string & StringValue(void) const Get string value of a name token.
void ClrEnd(void) Clear End type (resolve empty section)
bool ExistsAttributeString(const std::string &name) Test attibute existence.
bool IsBegin(void) const Test token Type.
void SetEmpty(const std::string &rName) Initialize as empty-tag token.
void ClrAttribute(const std::string &name) Clear attribute.
void SetBegin(const std::string &rName) Initialize as Begin token.
void InsAttributeString(const std::string &name, const std::string &value) Insert named attribute with string value.
bool IsEnd(void) const Test token Type.
const std::string & AttributeStringValue(const std::string &name) Access attribute value.
A TypeDefinition defines a faudes-type in that it specifies a faudes-type name to identify the type a...
const TypeDefinition & Definition(const std::string &rTypeName) const Look up the type definition by faudes-type name.
static TypeRegistry * G() Method to access the single global instance of the registry.
Iterator End(void) const STL interator to the internal type-name map.
std::map< std::string, TypeDefinition * >::const_iterator Iterator Convenience typedef to access registry entries.
Includes all libFAUDES headers, no plugins.
void LoadRegistry(const std::string &rPath) Load all registered types and functions.
libFAUDES resides within the namespace faudes.
std::string VersionString() Return FAUDES_VERSION as std::string.
std::string PrependPath(const std::string &rLeft, const std::string &rRight) Prepend one path before another.
std::string ExtractBasename(const std::string &rFullPath) Extract file basename from full path.
std::string PluginsString() Return FAUDES_PLUGINS as std::string.
std::string ExtractFilename(const std::string &rFullPath) Extract file name from full path.
std::string ExtractSuffix(const std::string &rFullPath) Extract extension from full path, i.e.
std::string ContributorsString() Return contributors as std::string.
std::set< std::string > ReadDirectory(const std::string &rDirectory) Read the contents of the specified directors.
std::string StringSubstitute(const std::string &rString, const std::string &rFrom, const std::string &rTo) Substitute globally in string.
bool DirectoryExists(const std::string &rDirectory) Test existence of directory.
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.32f
--- 2024.12.22
--- c++ api documentaion by doxygen
|