mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
Restore lost update
This commit is contained in:
parent
f642df1c77
commit
dc972d15ac
@ -46,10 +46,9 @@ using namespace Poco::CppParser;
|
||||
std::string DocWriter::_language;
|
||||
DocWriter::StringMap DocWriter::_strings;
|
||||
Poco::Logger* DocWriter::_pLogger(0);
|
||||
const std::string DocWriter::RFC_URI("http://www.ietf.org/rfc/rfc");
|
||||
const std::string DocWriter::nbsp(" "); // Invalid HTML entity for XML. Replace with  
|
||||
const std::string DocWriter::copy("©"); // Invalid HTML entity for XML. Replace © with ©
|
||||
const std::string DocWriter::mdash("—"); // Invalid HTML entity for XML. Replace — with —
|
||||
const std::string DocWriter::RFC_URI("https://www.ietf.org/rfc/rfc");
|
||||
const std::string DocWriter::GITHUB_POCO_URI("https://github.com/pocoproject/poco");
|
||||
|
||||
|
||||
DocWriter::DocWriter(const NameSpace::SymbolTable& symbols, const std::string& path, bool prettifyCode, bool noFrames):
|
||||
_prettifyCode(prettifyCode),
|
||||
@ -138,12 +137,12 @@ void DocWriter::writeNavigation()
|
||||
if (!ostr.good()) throw Poco::CreateFileException(path);
|
||||
writeHeader(ostr, tr("Navigation"), "js/iframeResizer.contentWindow.min.js");
|
||||
beginBody(ostr);
|
||||
ostr << "<h3 class='overview'><a href='index.html' target='_top'>" << htmlize(software) << "</a></h3>\n";
|
||||
ostr << "<h3 class=\"overview\"><a href=\"index.html\" target=\"_top\">" << htmlize(software) << "</a></h3>\n";
|
||||
|
||||
if (!_pages.empty())
|
||||
{
|
||||
ostr << "<h4>" << tr("Guides") << "</h4>\n";
|
||||
ostr << "<ul class='collapsibleList'>\n";
|
||||
ostr << "<ul class=\"collapsibleList\">\n";
|
||||
std::set<std::string> categories;
|
||||
for (PageMap::const_iterator it = _pages.begin(); it != _pages.end(); ++it)
|
||||
{
|
||||
@ -153,7 +152,7 @@ void DocWriter::writeNavigation()
|
||||
{
|
||||
std::string node = "category-";
|
||||
node += *it;
|
||||
ostr << "<li id='" << node << "'>";
|
||||
ostr << "<li id=\"" << node << "\">";
|
||||
ostr << tr(*it) << "\n";
|
||||
writeCategoryIndex(ostr, *it, "_top");
|
||||
ostr << "</li>\n";
|
||||
@ -180,14 +179,14 @@ void DocWriter::writeNavigation()
|
||||
}
|
||||
ostr << "</ul>\n";
|
||||
ostr << "<h4>" << tr("Packages") << "</h4>\n";
|
||||
ostr << "<ul class='collapsibleList'>\n";
|
||||
ostr << "<ul class=\"collapsibleList\">\n";
|
||||
std::set<std::string> libs;
|
||||
libraries(libs);
|
||||
for (std::set<std::string>::const_iterator itl = libs.begin(); itl != libs.end(); ++itl)
|
||||
{
|
||||
std::string node = "library-";
|
||||
node += *itl;
|
||||
ostr << "<li id='" << node << "'>" << *itl << "\n";
|
||||
ostr << "<li id=\"" << node << "\">" << *itl << "\n";
|
||||
std::set<std::string> pkgs;
|
||||
packages(*itl, pkgs);
|
||||
ostr << "<ul>\n";
|
||||
@ -204,10 +203,9 @@ void DocWriter::writeNavigation()
|
||||
writePackage(uri, *itl, *itp);
|
||||
}
|
||||
ostr << "</ul>\n";
|
||||
ostr << "</li>\n";
|
||||
}
|
||||
ostr << "</ul>\n";
|
||||
ostr << "<div>" << nbsp << "</div>\n"; // workaround to avoid cutting off a few pixels from last line
|
||||
ostr << "<div> </div>\n"; // workaround to avoid cutting off a few pixels from last line
|
||||
endBody(ostr);
|
||||
ostr << "<script>CollapsibleLists.apply(true)</script>" << std::endl;
|
||||
writeFooter(ostr);
|
||||
@ -222,7 +220,7 @@ void DocWriter::writePageIndex(std::ostream& ostr)
|
||||
categories.insert(it->second.category);
|
||||
}
|
||||
|
||||
ostr << "<table class='index'>" << std::endl;
|
||||
ostr << "<table class=\"index\">" << std::endl;
|
||||
int column = 0;
|
||||
for (std::set<std::string>::const_iterator it = categories.begin(); it != categories.end(); ++it)
|
||||
{
|
||||
@ -266,7 +264,7 @@ void DocWriter::writeNameSpaceIndex(std::ostream& ostr)
|
||||
}
|
||||
}
|
||||
|
||||
ostr << "<table class='index'>" << std::endl;
|
||||
ostr << "<table class=\"index\">" << std::endl;
|
||||
int column = 0;
|
||||
for (std::map<std::string, const NameSpace*>::const_iterator it = nsMap.begin(); it != nsMap.end(); ++it)
|
||||
{
|
||||
@ -311,12 +309,12 @@ void DocWriter::writeEclipseTOC()
|
||||
std::ofstream ostr(p.toString().c_str());
|
||||
if (!ostr.good()) throw Poco::CreateFileException(path);
|
||||
|
||||
ostr << "<?xml version='1.0' encoding='UTF-8'?>" << std::endl;
|
||||
ostr << "<toc id='poco' label='" << htmlize(software) << " " << tr("Reference") << "' topic='" << dir << "welcome.html'>" << std::endl;
|
||||
ostr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
|
||||
ostr << "<toc id=\"poco\" label=\"" << htmlize(software) << " " << tr("Reference") << "\" topic=\"" << dir << "welcome.html\">" << std::endl;
|
||||
|
||||
if (!_pages.empty())
|
||||
{
|
||||
ostr << "<topic label='" << tr("Guides") << "'>" << std::endl;
|
||||
ostr << "<topic label=\"" << tr("Guides") << "\">" << std::endl;
|
||||
std::set<std::string> categories;
|
||||
for (PageMap::const_iterator it = _pages.begin(); it != _pages.end(); ++it)
|
||||
{
|
||||
@ -324,12 +322,12 @@ void DocWriter::writeEclipseTOC()
|
||||
}
|
||||
for (std::set<std::string>::const_iterator it = categories.begin(); it != categories.end(); ++it)
|
||||
{
|
||||
ostr << "<topic label='" << *it << "'>" << std::endl;
|
||||
ostr << "<topic label=\"" << *it << "\">" << std::endl;
|
||||
for (PageMap::const_iterator itp = _pages.begin(); itp != _pages.end(); ++itp)
|
||||
{
|
||||
if (itp->second.category == *it)
|
||||
{
|
||||
ostr << "<topic label='" << itp->second.title << "' href='" << dir << itp->second.fileName << "'/>" << std::endl;
|
||||
ostr << "<topic label=\"" << itp->second.title << "\" href=\"" << dir << itp->second.fileName << "\"/>" << std::endl;
|
||||
}
|
||||
}
|
||||
ostr << "</topic>" << std::endl;
|
||||
@ -337,7 +335,7 @@ void DocWriter::writeEclipseTOC()
|
||||
ostr << "</topic>" << std::endl;
|
||||
}
|
||||
|
||||
ostr << "<topic label='" << tr("Namespaces") << "'>" << std::endl;
|
||||
ostr << "<topic label=\"" << tr("Namespaces") << "\">" << std::endl;
|
||||
|
||||
std::map<std::string, Symbol*> namespaces; // sort namespaces by full name
|
||||
for (NameSpace::SymbolTable::const_iterator it = _symbols.begin(); it != _symbols.end(); ++it)
|
||||
@ -349,17 +347,17 @@ void DocWriter::writeEclipseTOC()
|
||||
}
|
||||
for (std::map<std::string, Symbol*>::const_iterator it = namespaces.begin(); it != namespaces.end(); ++it)
|
||||
{
|
||||
ostr << "<topic label='" << it->second->fullName() << "' href='" << dir << baseNameFor(it->second) << ".html" << "'/>" << std::endl;
|
||||
ostr << "<topic label=\"" << it->second->fullName() << "\" href=\"" << dir << baseNameFor(it->second) << ".html" << "\"/>" << std::endl;
|
||||
}
|
||||
ostr << "</topic>" << std::endl;
|
||||
|
||||
ostr << "<topic label='" << tr("Packages") << "'>" << std::endl;
|
||||
ostr << "<topic label=\"" << tr("Packages") << "\">" << std::endl;
|
||||
|
||||
std::set<std::string> libs;
|
||||
libraries(libs);
|
||||
for (std::set<std::string>::const_iterator itl = libs.begin(); itl != libs.end(); ++itl)
|
||||
{
|
||||
ostr << "<topic label='" << *itl << "'>" << std::endl;
|
||||
ostr << "<topic label=\"" << *itl << "\">" << std::endl;
|
||||
std::set<std::string> pkgs;
|
||||
packages(*itl, pkgs);
|
||||
for (std::set<std::string>::const_iterator itp = pkgs.begin(); itp != pkgs.end(); ++itp)
|
||||
@ -370,14 +368,14 @@ void DocWriter::writeEclipseTOC()
|
||||
uri += makeFileName(*itp);
|
||||
uri += "-index.html";
|
||||
|
||||
ostr << "<topic label='" << *itp << "' href='" << dir << uri << "'/>" << std::endl;
|
||||
ostr << "<topic label=\"" << *itp << "\" href=\"" << dir << uri << "\"/>" << std::endl;
|
||||
}
|
||||
ostr << "</topic>" << std::endl;
|
||||
}
|
||||
|
||||
ostr << "</topic>" << std::endl;
|
||||
|
||||
ostr << "<topic label='" << tr("All_Symbols") << "' href='" << dir << "index-all.html'/>" << std::endl;
|
||||
ostr << "<topic label=\"" << tr("All_Symbols") << "\" href=\"" << dir << "index-all.html\"/>" << std::endl;
|
||||
|
||||
ostr << "</toc>" << std::endl;
|
||||
}
|
||||
@ -632,32 +630,28 @@ void DocWriter::writeHeader(std::ostream& ostr, const std::string& title, const
|
||||
std::string company(app.config().getString("PocoDoc.company", "Applied Informatics"));
|
||||
std::string charset(app.config().getString("PocoDoc.charset", "utf-8"));
|
||||
DateTime now;
|
||||
ostr << "<!DOCTYPE html ";
|
||||
ostr << "PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' ";
|
||||
ostr << "'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd' >" << std::endl;
|
||||
ostr << "<html xmlns='http://www.w3.org/1999/xhtml' ";
|
||||
ostr << "xmlns:MSHelp='http://msdn.microsoft.com/mshelp' ";
|
||||
ostr << "xmlns:mshelp='http://msdn.microsoft.com/mshelp' >" << std::endl;
|
||||
ostr << "<!DOCTYPE html>" << std::endl;
|
||||
ostr << "<html>" << std::endl;
|
||||
ostr << "<head>" << std::endl;
|
||||
ostr << "<title>" << htmlize(title) << "</title>" << std::endl;
|
||||
ostr << "<meta http-equiv='content-type' content='text/html; charset=" << charset << "'/>" << std::endl;
|
||||
ostr << "<meta name='author' content='" << htmlize(company) << "'/>" << std::endl;
|
||||
ostr << "<meta name='generator' content='" << app.config().getString("PocoDoc.generator", "PocoDoc") << "'/>" << std::endl;
|
||||
ostr << "<link rel='stylesheet' href='css/styles.css' type='text/css'/>" << std::endl;
|
||||
ostr << "<meta http-equiv=\"content-type\" content=\"text/html; charset=" << charset << "\"/>" << std::endl;
|
||||
ostr << "<meta name=\"author\" content=\"" << htmlize(company) << "\"/>" << std::endl;
|
||||
ostr << "<meta name=\"generator\" content=\"" << app.config().getString("PocoDoc.generator", "PocoDoc") << "\"/>" << std::endl;
|
||||
ostr << "<link rel=\"stylesheet\" href=\"css/styles.css\" type=\"text/css\"/>" << std::endl;
|
||||
if (_prettifyCode)
|
||||
{
|
||||
ostr << "<link href='css/prettify.css' type='text/css' rel='stylesheet'/>" << std::endl;
|
||||
ostr << "<script type='text/javascript' src='js/prettify.js'></script>" << std::endl;
|
||||
ostr << "<link href=\"css/prettify.css\" type=\"text/css\" rel=\"stylesheet\"/>" << std::endl;
|
||||
ostr << "<script type=\"text/javascript\" src=\"js/prettify.js\"></script>" << std::endl;
|
||||
}
|
||||
if (!extraScript.empty())
|
||||
{
|
||||
ostr << "<script type='text/javascript' src='" << extraScript << "'></script>" << std::endl;
|
||||
ostr << "<script type=\"text/javascript\" src=\"" << extraScript << "\"></script>" << std::endl;
|
||||
}
|
||||
ostr << "<script type='text/javascript' src='js/CollapsibleLists.compressed.js'></script>" << std::endl;
|
||||
ostr << "<script type=\"text/javascript\" src=\"js/CollapsibleLists.compressed.js\"></script>" << std::endl;
|
||||
ostr << "</head>" << std::endl;
|
||||
ostr << "<body";
|
||||
if (_prettifyCode)
|
||||
ostr << " onload='prettyPrint()'";
|
||||
ostr << " onload=\"prettyPrint()\"";
|
||||
ostr << ">" << std::endl;
|
||||
}
|
||||
|
||||
@ -681,9 +675,9 @@ void DocWriter::writeCopyright(std::ostream& ostr)
|
||||
std::string companyURI(app.config().getString("PocoDoc.companyURI", "http://www.appinf.com/"));
|
||||
std::string licenseURI(app.config().getString("PocoDoc.licenseURI", ""));
|
||||
DateTime now;
|
||||
ostr << "<p class='footer'>";
|
||||
ostr << "<p class=\"footer\">";
|
||||
ostr << htmlize(software) << " " << htmlize(version) << "<br />\n";
|
||||
ostr << tr("Copyright") << " " << copy << " " << now.year() << ", ";
|
||||
ostr << tr("Copyright") << " © " << now.year() << ", ";
|
||||
writeTargetLink(ostr, companyURI, htmlize(company), "_blank");
|
||||
if (!licenseURI.empty())
|
||||
{
|
||||
@ -701,18 +695,18 @@ void DocWriter::writeTitle(std::ostream& ostr, const std::string& category, cons
|
||||
{
|
||||
Application& app = Application::instance();
|
||||
std::string headerImage(app.config().getString("PocoDoc.headerImage", ""));
|
||||
ostr << "<div class='header'>\n";
|
||||
ostr << "<div class=\"header\">\n";
|
||||
if (!headerImage.empty())
|
||||
{
|
||||
ostr << "<img src='" << headerImage << "' alt=''>\n";
|
||||
ostr << "<img src=\"" << headerImage << "\" alt=\"\">\n";
|
||||
}
|
||||
ostr << "<h1 class='category'>";
|
||||
ostr << "<h1 class=\"category\">";
|
||||
if (category.empty())
|
||||
ostr << nbsp ;
|
||||
ostr << " ";
|
||||
else
|
||||
ostr << htmlize(category);
|
||||
ostr << "</h1>\n";
|
||||
ostr << "<h1 class='title'>" << htmlize(title) << "</h1>";
|
||||
ostr << "<h1 class=\"title\">" << htmlize(title) << "</h1>";
|
||||
ostr << "\n</div>\n";
|
||||
}
|
||||
|
||||
@ -721,21 +715,21 @@ void DocWriter::writeTitle(std::ostream& ostr, const NameSpace* pNameSpace, cons
|
||||
{
|
||||
Application& app = Application::instance();
|
||||
std::string headerImage(app.config().getString("PocoDoc.headerImage", ""));
|
||||
ostr << "<div class='header'>\n";
|
||||
ostr << "<div class=\"header\">\n";
|
||||
if (!headerImage.empty())
|
||||
{
|
||||
ostr << "<img src='" << headerImage << "' alt=''>\n";
|
||||
ostr << "<img src=\"" << headerImage << "\" alt=\"\">\n";
|
||||
}
|
||||
const std::string& nameSpace = pNameSpace->fullName();
|
||||
if (!nameSpace.empty())
|
||||
{
|
||||
ostr << "<h1 class='namespace'>";
|
||||
ostr << "<h1 class=\"namespace\">";
|
||||
writeLink(ostr, uriFor(pNameSpace), nameSpace, "namespace");
|
||||
ostr << "</h1>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
ostr << "<h1 class='namespace'>::</h1>\n";
|
||||
ostr << "<h1 class=\"namespace\">::</h1>\n";
|
||||
}
|
||||
|
||||
std::string::size_type posFirstOpen = title.find_first_of('<');
|
||||
@ -762,16 +756,16 @@ void DocWriter::writeTitle(std::ostream& ostr, const NameSpace* pNameSpace, cons
|
||||
|
||||
if (isTemplate)
|
||||
{
|
||||
ostr << "<h1 class='template'>"
|
||||
ostr << "<h1 class=\"template\">"
|
||||
<< htmlize(templateParam)
|
||||
<< "</h1>\n"
|
||||
<< "<h1 class='symbol'>"
|
||||
<< "<h1 class=\"symbol\">"
|
||||
<< htmlize(templateParamSpec)
|
||||
<< "</h1>";
|
||||
}
|
||||
else
|
||||
{
|
||||
ostr << "<h1 class='symbol'>"
|
||||
ostr << "<h1 class=\"symbol\">"
|
||||
<< htmlize(title)
|
||||
<< "</h1>";
|
||||
}
|
||||
@ -797,15 +791,15 @@ void DocWriter::writeNavigationFrame(std::ostream& ostr, const std::string& grou
|
||||
query += "-";
|
||||
query += item;
|
||||
}
|
||||
ostr << "<div id='navigation'>\n";
|
||||
ostr << "<iframe src='navigation.html" << query << "' onload='iFrameResize(this);' scrolling='no'></iframe>\n";
|
||||
ostr << "<div id=\"navigation\">\n";
|
||||
ostr << "<iframe src=\"navigation.html" << query << "\" onload=\"iFrameResize(this);\" scrolling=\"no\"></iframe>\n";
|
||||
ostr << "</div>\n";
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::beginBody(std::ostream& ostr)
|
||||
{
|
||||
ostr << "<div class='body'>\n";
|
||||
ostr << "<div class=\"body\">\n";
|
||||
}
|
||||
|
||||
|
||||
@ -817,7 +811,7 @@ void DocWriter::endBody(std::ostream& ostr)
|
||||
|
||||
void DocWriter::beginContent(std::ostream& ostr)
|
||||
{
|
||||
ostr << "<div id='content'>\n";
|
||||
ostr << "<div id=\"content\">\n";
|
||||
}
|
||||
|
||||
|
||||
@ -829,7 +823,7 @@ void DocWriter::endContent(std::ostream& ostr)
|
||||
|
||||
void DocWriter::writeDescription(std::ostream& ostr, const std::string& text)
|
||||
{
|
||||
ostr << "<div class='description'>\n"
|
||||
ostr << "<div class=\"description\">\n"
|
||||
<< "<p>";
|
||||
|
||||
_titleId = 0;
|
||||
@ -951,7 +945,7 @@ void DocWriter::writeDescriptionLine(std::ostream& ostr, const std::string& text
|
||||
{
|
||||
case TEXT_PARAGRAPH:
|
||||
ostr << "</p>\n<pre";
|
||||
if (_prettifyCode) ostr << " class='prettyprint'";
|
||||
if (_prettifyCode) ostr << " class=\"prettyprint\"";
|
||||
ostr << ">";
|
||||
writeLiteral(ostr, text);
|
||||
state = TEXT_LITERAL;
|
||||
@ -1008,7 +1002,7 @@ void DocWriter::writeSummary(std::ostream& ostr, const std::string& text, const
|
||||
writeText(ostr, beg, it);
|
||||
if (!uri.empty())
|
||||
{
|
||||
ostr << nbsp ;
|
||||
ostr << " ";
|
||||
writeImageLink(ostr, uri, "arrow.png", tr("more"));
|
||||
}
|
||||
ostr << "</p>\n";
|
||||
@ -1043,7 +1037,7 @@ std::string DocWriter::htmlizeName(const std::string& name)
|
||||
for (std::string::const_iterator it = name.begin(); it != name.end(); ++it)
|
||||
{
|
||||
if (*it == ' ')
|
||||
result += nbsp ;
|
||||
result += " ";
|
||||
else
|
||||
result += htmlize(*it);
|
||||
}
|
||||
@ -1074,7 +1068,7 @@ void DocWriter::writeText(std::ostream& ostr, const std::string& text)
|
||||
++it;
|
||||
}
|
||||
while (it != end && std::isspace(*it)) ++it;
|
||||
ostr << "</p><" << heading << ">" << format("<a id='%d'>", _titleId++) << htmlize(std::string(it, end)) << "</a></" << heading << "><p>" << std::endl;
|
||||
ostr << "</p><" << heading << ">" << format("<a id=\"%d\">", _titleId++) << htmlize(std::string(it, end)) << "</a></" << heading << "><p>" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1138,6 +1132,39 @@ void DocWriter::writeText(std::ostream& ostr, std::string::const_iterator begin,
|
||||
}
|
||||
begin = it;
|
||||
}
|
||||
if (token == "GH")
|
||||
{
|
||||
std::string uri(GITHUB_POCO_URI);
|
||||
std::string::const_iterator it(begin);
|
||||
std::string spc;
|
||||
nextToken(begin, end, spc);
|
||||
if (spc == ":")
|
||||
{
|
||||
std::string proj;
|
||||
nextToken(begin, end, proj);
|
||||
uri = projectURI(proj);
|
||||
nextToken(begin, end, spc);
|
||||
}
|
||||
if (spc == " ")
|
||||
{
|
||||
std::string hash;
|
||||
nextToken(begin, end, hash);
|
||||
if (hash == "#")
|
||||
{
|
||||
std::string n;
|
||||
nextToken(begin, end, n);
|
||||
if (!n.empty() && std::isdigit(n[0]))
|
||||
{
|
||||
uri += "/issues/";
|
||||
uri += n;
|
||||
writeTargetLink(ostr, uri, token + " #" + n, "_blank");
|
||||
nextToken(begin, end, token);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
begin = it;
|
||||
}
|
||||
if (token == "http")
|
||||
{
|
||||
std::string::const_iterator it(begin);
|
||||
@ -1294,7 +1321,7 @@ bool DocWriter::writeSpecial(std::ostream& ostr, std::string& token, std::string
|
||||
}
|
||||
else if (token == "--" && !_literalMode)
|
||||
{
|
||||
ostr << mdash;
|
||||
ostr << "—";
|
||||
}
|
||||
else if (token == "iff" && !_literalMode)
|
||||
{
|
||||
@ -1706,7 +1733,7 @@ void DocWriter::writeType(std::ostream& ostr, const TypeDef* pType)
|
||||
if (pType->getAccess() != Symbol::ACC_PUBLIC)
|
||||
writeIcon(ostr, "protected");
|
||||
ostr << "</h3>\n";
|
||||
ostr << "<p class='decl'>";
|
||||
ostr << "<p class=\"decl\">";
|
||||
writeDecl(ostr, pType->declaration());
|
||||
ostr << ";</p>\n";
|
||||
writeDescription(ostr, pType->getDocumentation());
|
||||
@ -1751,7 +1778,7 @@ void DocWriter::writeEnum(std::ostream& ostr, const Enum* pEnum)
|
||||
{
|
||||
const std::string& name = (*it)->name();
|
||||
const std::string& value = (*it)->value();
|
||||
ostr << "<p class='decl'>";
|
||||
ostr << "<p class=\"decl\">";
|
||||
writeAnchor(ostr, name, *it);
|
||||
if (!value.empty())
|
||||
ostr << " = " << htmlize(value);
|
||||
@ -1858,7 +1885,7 @@ void DocWriter::writeFunction(std::ostream& ostr, const Function* pFunc)
|
||||
if (pFunc->flags() & Function::FN_INLINE)
|
||||
writeIcon(ostr, "inline");
|
||||
ostr << "</h3>\n";
|
||||
ostr << "<p class='decl'>";
|
||||
ostr << "<p class=\"decl\">";
|
||||
const std::string& decl = pFunc->declaration();
|
||||
writeDecl(ostr, decl);
|
||||
if (!std::isalnum(decl[decl.length() - 1]))
|
||||
@ -1907,7 +1934,7 @@ void DocWriter::writeFunction(std::ostream& ostr, const Function* pFunc)
|
||||
writeDescription(ostr, doc);
|
||||
if (pOverridden)
|
||||
{
|
||||
ostr << "<div class='description'><p><b>" << tr("See_also") << ":</b> ";
|
||||
ostr << "<div class=\"description\"><p><b>" << tr("See_also") << ":</b> ";
|
||||
writeLink(ostr, pOverridden, pOverridden->fullName() + "()");
|
||||
ostr << "</p></div>\n";
|
||||
}
|
||||
@ -1951,7 +1978,7 @@ void DocWriter::writeVariable(std::ostream& ostr, const Variable* pVar)
|
||||
if (pVar->flags() & Function::FN_STATIC)
|
||||
writeIcon(ostr, "static");
|
||||
ostr << "</h3>\n";
|
||||
ostr << "<p class='decl'>";
|
||||
ostr << "<p class=\"decl\">";
|
||||
writeDecl(ostr, pVar->declaration());
|
||||
ostr << ";</p>\n";
|
||||
writeDescription(ostr, pVar->getDocumentation());
|
||||
@ -1974,48 +2001,48 @@ void DocWriter::writeNameListItem(std::ostream& ostr, const std::string& str, co
|
||||
|
||||
void DocWriter::writeLink(std::ostream& ostr, const std::string& uri, const std::string& text)
|
||||
{
|
||||
ostr << "<a href='" << uri << "'>" << htmlize(text) << "</a>";
|
||||
ostr << "<a href=\"" << uri << "\">" << htmlize(text) << "</a>";
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeLink(std::ostream& ostr, const Symbol* pSymbol, const std::string& name)
|
||||
{
|
||||
ostr << "<a href='" << uriFor(pSymbol) << "' title='" << titleFor(pSymbol) << "'>" << htmlizeName(name) << "</a>";
|
||||
ostr << "<a href=\"" << uriFor(pSymbol) << "\" title=\"" << titleFor(pSymbol) << "\">" << htmlizeName(name) << "</a>";
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeLink(std::ostream& ostr, const std::string& uri, const std::string& text, const std::string& linkClass)
|
||||
{
|
||||
ostr << "<a href='" << uri << "' class='" << linkClass << "'>" << htmlize(text) << "</a>";
|
||||
ostr << "<a href=\"" << uri << "\" class=\"" << linkClass << "\">" << htmlize(text) << "</a>";
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeTargetLink(std::ostream& ostr, const std::string& uri, const std::string& text, const std::string& target)
|
||||
{
|
||||
if (_noFrames && target != "_blank")
|
||||
ostr << "<a href='" << uri << "'>" << text << "</a>";
|
||||
ostr << "<a href=\"" << uri << "\">" << text << "</a>";
|
||||
else if (!target.empty())
|
||||
ostr << "<a href='" << uri << "' target='" << target << "'>" << text << "</a>";
|
||||
ostr << "<a href=\"" << uri << "\" target=\"" << target << "\">" << text << "</a>";
|
||||
else
|
||||
ostr << "<a href='" << uri << "'>" << htmlize(text) << "</a>";
|
||||
ostr << "<a href=\"" << uri << "\">" << htmlize(text) << "</a>";
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeImageLink(std::ostream& ostr, const std::string& uri, const std::string& image, const std::string& alt)
|
||||
{
|
||||
ostr << "<a href='" << uri << "'>";
|
||||
ostr << "<img src='images/" << image << "' alt='" + alt + "' /> ";
|
||||
ostr << "<a href=\"" << uri << "\">";
|
||||
ostr << "<img src=\"images/" << image << "\" alt=\"" + alt + "\" /> ";
|
||||
ostr << "</a>";
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeImage(std::ostream& ostr, const std::string& uri, const std::string& caption)
|
||||
{
|
||||
ostr << "<div class='image'>" << std::endl;
|
||||
ostr << "<img src='" << uri << "' alt='" + caption + "' title='" << htmlize(caption) << "' /> " << std::endl;
|
||||
ostr << "<div class=\"image\">" << std::endl;
|
||||
ostr << "<img src=\"" << uri << "\" alt=\"" + caption + "\" title=\"" << htmlize(caption) << "\" /> " << std::endl;
|
||||
if (!caption.empty())
|
||||
{
|
||||
ostr << "<div class='imagecaption'>" << htmlize(caption) << "</div>";
|
||||
ostr << "<div class=\"imagecaption\">" << htmlize(caption) << "</div>";
|
||||
}
|
||||
ostr << "</div>" << std::endl;
|
||||
}
|
||||
@ -2023,19 +2050,19 @@ void DocWriter::writeImage(std::ostream& ostr, const std::string& uri, const std
|
||||
|
||||
void DocWriter::writeIcon(std::ostream& ostr, const std::string& icon)
|
||||
{
|
||||
ostr << " <img src='images/" << icon << ".png' alt='" + icon + "' title='" << icon << "' class='icon' /> ";
|
||||
ostr << " <img src=\"images/" << icon << ".png\" alt=\"" + icon + "\" title=\"" << icon << "\" class=\"icon\" /> ";
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeAnchor(std::ostream& ostr, const std::string& text, const Symbol* pSymbol)
|
||||
{
|
||||
ostr << "<a id='" << pSymbol->id() << "'>" << htmlize(text) << "</a>";
|
||||
ostr << "<a id=\"" << pSymbol->id() << "\">" << htmlize(text) << "</a>";
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeDeprecated(std::ostream& ostr, const std::string& what)
|
||||
{
|
||||
ostr << "<div class='description'>" << std::endl;
|
||||
ostr << "<div class=\"description\">" << std::endl;
|
||||
ostr << "<p><b>" << tr("Deprecated") << ".</b> <i>" << tr("This") << " " << what << " " << tr("is_deprecated") << ".</i></p>" << std::endl;
|
||||
ostr << "</div>" << std::endl;
|
||||
}
|
||||
@ -2168,9 +2195,9 @@ void DocWriter::writePage(Page& page)
|
||||
while (ch != -1 && ch != '\n') { category += (char) ch; ch = istr.get(); }
|
||||
|
||||
while (std::isspace(ch)) ch = istr.get();
|
||||
while (ch != -1)
|
||||
while (ch != -1)
|
||||
{
|
||||
text += (char) ch;
|
||||
text += (char) ch;
|
||||
if (ch == '\n') text += ' ';
|
||||
ch = istr.get();
|
||||
}
|
||||
@ -2189,7 +2216,7 @@ void DocWriter::writePage(Page& page)
|
||||
beginBody(ostr);
|
||||
writeNavigationFrame(ostr, "category", category);
|
||||
beginContent(ostr);
|
||||
if (!toc.empty())
|
||||
if (!toc.empty())
|
||||
{
|
||||
writeTOC(ostr, toc);
|
||||
}
|
||||
@ -2235,35 +2262,41 @@ void DocWriter::scanTOC(const std::string& text, TOC& toc)
|
||||
|
||||
void DocWriter::writeTOC(std::ostream& ostr, const TOC& toc)
|
||||
{
|
||||
ostr << "<div class='toc'>" << std::endl;
|
||||
ostr << "<ul class='collapsibleList'><li>" << tr("TOC") << std::endl;
|
||||
ostr << "<div class=\"toc\">" << std::endl;
|
||||
ostr << "<ul class=\"collapsibleList\"><li>" << tr("TOC") << std::endl;
|
||||
int lastLevel = 0;
|
||||
std::vector<int> levelStack;
|
||||
levelStack.push_back(0);
|
||||
for (TOC::const_iterator it = toc.begin(); it != toc.end(); ++it)
|
||||
{
|
||||
int level = it->level;
|
||||
if (level > lastLevel)
|
||||
if (level > levelStack.back())
|
||||
{
|
||||
levelStack.push_back(level);
|
||||
ostr << "<ul>" << std::endl;
|
||||
}
|
||||
else if (level < lastLevel)
|
||||
else if (level < levelStack.back())
|
||||
{
|
||||
for (int i = level; i < lastLevel; i++)
|
||||
ostr << "</li>" << std::endl;
|
||||
while (level < levelStack.back())
|
||||
{
|
||||
ostr << "</li></ul></li>" << std::endl;
|
||||
levelStack.pop_back();
|
||||
ostr << "</ul></li>" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
ostr << "</li>" << std::endl;
|
||||
}
|
||||
ostr << "<li class='level" << level << "'><a href='#" << it->id << "'>" << htmlize(it->title) << "</a>" << std::endl;
|
||||
ostr << "<li class=\"level" << level << "\"><a href=\"#" << it->id << "\">" << htmlize(it->title) << "</a>" << std::endl;
|
||||
lastLevel = level;
|
||||
}
|
||||
while (lastLevel-- > 1)
|
||||
while (!levelStack.empty())
|
||||
{
|
||||
ostr << "</li></ul>" << std::endl;
|
||||
levelStack.pop_back();
|
||||
}
|
||||
ostr << "</li></ul></li></ul></div>" << std::endl;
|
||||
ostr << "</div>" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@ -2375,3 +2408,18 @@ void DocWriter::loadStrings(const std::string& language)
|
||||
loadString("Types", "Types", language);
|
||||
loadString("Variables", "Variables", language);
|
||||
}
|
||||
|
||||
|
||||
std::string DocWriter::projectURI(const std::string& proj)
|
||||
{
|
||||
Application& app = Application::instance();
|
||||
std::string key("PocoDoc.projects.");
|
||||
key += proj;
|
||||
std::string uri = app.config().getString(key, "");
|
||||
if (uri.empty())
|
||||
{
|
||||
app.logger().warning("No project URI found for %s", proj);
|
||||
uri = GITHUB_POCO_URI;
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
@ -185,14 +185,13 @@ protected:
|
||||
static const std::string& tr(const std::string& id);
|
||||
static void loadStrings(const std::string& language);
|
||||
static void loadString(const std::string& id, const std::string& def, const std::string& language);
|
||||
static std::string projectURI(const std::string& id);
|
||||
|
||||
static Poco::Logger& logger();
|
||||
|
||||
static const std::string RFC_URI;
|
||||
static const std::string nbsp;
|
||||
static const std::string copy;
|
||||
static const std::string mdash;
|
||||
|
||||
static const std::string GITHUB_POCO_URI;
|
||||
|
||||
private:
|
||||
bool _prettifyCode;
|
||||
bool _noFrames;
|
||||
|
@ -60,7 +60,6 @@ using Poco::Util::OptionCallback;
|
||||
using Poco::Util::HelpFormatter;
|
||||
using Poco::Util::AbstractConfiguration;
|
||||
|
||||
static std::string osName = Environment::osName();
|
||||
|
||||
class Preprocessor
|
||||
{
|
||||
@ -112,7 +111,7 @@ private:
|
||||
class PocoDocApp: public Application
|
||||
{
|
||||
public:
|
||||
PocoDocApp():
|
||||
PocoDocApp():
|
||||
_helpRequested(false),
|
||||
_writeEclipseTOC(false)
|
||||
{
|
||||
@ -220,15 +219,11 @@ protected:
|
||||
{
|
||||
Path pp(file);
|
||||
pp.setExtension("i");
|
||||
std::string comp = "PocoDoc.compiler";
|
||||
if (Environment::osFamilyWindows())
|
||||
comp += ".windows";
|
||||
else
|
||||
comp += ".unix";
|
||||
std::string exec = config().getString(comp + ".exec");
|
||||
std::string opts = config().getString(comp + ".options");
|
||||
std::string path = config().getString(comp + ".path", "");
|
||||
bool usePipe = config().getBool(comp + ".usePipe", false);
|
||||
|
||||
std::string exec = config().getString("PocoDoc.compiler.exec");
|
||||
std::string opts = config().getString("PocoDoc.compiler.options");
|
||||
std::string path = config().getString("PocoDoc.compiler.path", "");
|
||||
bool usePipe = config().getBool("PocoDoc.compiler.usePipe", false);
|
||||
std::string popts;
|
||||
for (std::string::const_iterator it = opts.begin(); it != opts.end(); ++it)
|
||||
{
|
||||
@ -262,12 +257,15 @@ protected:
|
||||
return new Preprocessor(proc, new std::ifstream(pp.getFileName().c_str()), pp.getFileName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void parse(const std::string& file)
|
||||
{
|
||||
logger().information("Preprocessing " + file);
|
||||
#ifndef POCO_ENABLE_CPP11
|
||||
std::auto_ptr<Preprocessor> pPreProc(preprocess(file));
|
||||
#else
|
||||
std::unique_ptr<Preprocessor> pPreProc(preprocess(file));
|
||||
|
||||
#endif // POCO_ENABLE_CPP11
|
||||
logger().information("Parsing " + file);
|
||||
if (pPreProc->stream().good())
|
||||
{
|
||||
@ -276,7 +274,7 @@ protected:
|
||||
}
|
||||
else throw Poco::OpenFileException("cannot read from preprocessor");
|
||||
}
|
||||
|
||||
|
||||
int parseAll()
|
||||
{
|
||||
int errors = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user