PocoDoc update: new frame-less design, style changes, cleanup

This commit is contained in:
Guenter Obiltschnig 2014-10-21 20:23:29 +02:00
parent 558091d53f
commit 1c145978da
31 changed files with 286 additions and 752 deletions

View File

@ -22,9 +22,9 @@
</pages>
<resources>
${PocoBase}/PocoDoc/resources/css,
${PocoBase}/PocoDoc/resources/js,
${PocoBase}/PocoDoc/resources/images,
${PocoBase}/PocoDoc/resources/index.html,
${PocoBase}/PocoDoc/resources/welcome.thtml,
${PocoBase}/PocoDoc/resources/index.thtml,
${PocoBuild}/*/doc/images
</resources>
<compiler>

View File

@ -23,10 +23,9 @@
</pages>
<resources>
${PocoBase}/PocoDoc/resources/css,
${PocoBase}/PocoDoc/resources/js,
${PocoBase}/PocoDoc/resources/images,
${PocoBase}/PocoDoc/resources/platform/index.html,
${PocoBase}/PocoDoc/resources/platform/welcome.thtml,
${PocoBase}/PocoDoc/resources/platform/images,
${PocoBase}/PocoDoc/resources/index.thtml,
${PocoBuild}/*/doc/images
</resources>
<compiler>

File diff suppressed because one or more lines are too long

View File

@ -1,30 +0,0 @@
<?php
$category = "index-all.html";
$page = "welcome.html";
if (array_key_exists('c', $_GET))
{
$category = 'category-' . $_GET['c'] . '-index.html';
}
if (array_key_exists('p', $_GET))
{
$page = $_GET['p'] . '.html';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>POCO C++ Libraries</title>
</head>
<frameset cols="25%,75%" title="">
<frameset rows="40%,60%" title="">
<frame src="overview.html" title="Overview" name="overviewFrame" />
<frame src="<?php echo $category; ?>" title="Index" name="indexFrame" />
</frameset>
<frame src="<?php echo $page; ?>" title="Details" name="detailsFrame" />
</frameset>
<noframes>
<h1>Frames Required</h1>
<p>This document is designed to be viewed using the frames feature.
If you see this message, you are using a non-frame-capable web client.</p>
</noframes>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

View File

@ -1,18 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>POCO C++ Libraries</title>
</head>
<frameset cols="25%,75%" title="">
<frameset rows="40%,60%" title="">
<frame src="overview.html" title="Overview" name="overviewFrame" />
<frame src="index-all.html" title="Index" name="indexFrame" />
</frameset>
<frame src="welcome.html" title="Details" name="detailsFrame" />
</frameset>
<noframes>
<h1>Frames Required</h1>
<p>This document is designed to be viewed using the frames feature.
If you see this message, you are using a non-frame-capable web client.</p>
</noframes>
</html>

View File

@ -1,22 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-07"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
<script type="text/javascript" src="js/iframeResizer.min.js"></script>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<body>
<div class="header">
<h1 class="category">POCO C++ Libraries</h1>
<h1 class="title">Reference Library</h1>
</div>
<div class="body">
<div id="navigation">
<iframe src="navigation.html" onload="iFrameResize(this);" scrolling="no"></iframe>
</div>
<div id="content">
<h2>User Guides And Tutorials</h2>
${PocoDoc.pageIndex}
@ -26,5 +27,6 @@ ${PocoDoc.nameSpaceIndex}
<p class="footer">${PocoDoc.software} ${PocoDoc.version}<br />
Copyright &copy; ${PocoDoc.year}, <a href="${PocoDoc.companyURI}" target="_top">${PocoDoc.company}</a></p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,16 @@
/*
CollapsibleLists.js
An object allowing lists to dynamically expand and collapse
Created by Stephen Morley - http://code.stephenmorley.org/ - and released under
the terms of the CC0 1.0 Universal legal code:
http://creativecommons.org/publicdomain/zero/1.0/legalcode
Modified by Guenter Obiltschnig (added expansion via URI query string)
*/
var CollapsibleLists=new function(){function e(e){var t=e.getElementsByTagName("ul");for(var n=0;n<t.length;n++){var r=t[n];while(r.nodeName!="LI")r=r.parentNode;if(r==e)t[n].style.display="block"}e.className=e.className.replace(/(^| )collapsibleList(Open|Closed)( |$)/,"");if(t.length>0){e.className+=" collapsibleList"+(open?"Open":"Closed")}}function t(e){return function(t){if(!t)t=window.event;var r=t.target?t.target:t.srcElement;while(r.nodeName!="LI")r=r.parentNode;if(r==e)n(e)}}function n(e){var t=e.className.match(/(^| )collapsibleListClosed( |$)/);var n=e.getElementsByTagName("ul");for(var r=0;r<n.length;r++){var i=n[r];while(i.nodeName!="LI")i=i.parentNode;if(i==e)n[r].style.display=t?"block":"none"}e.className=e.className.replace(/(^| )collapsibleList(Open|Closed)( |$)/,"");if(n.length>0){e.className+=" collapsibleList"+(t?"Open":"Closed")}}function r(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),n=t.exec(location.search);return n===null?"":decodeURIComponent(n[1].replace(/\+/g," "))}this.apply=function(t){var n=document.getElementsByTagName("ul");for(var i=0;i<n.length;i++){if(n[i].className.match(/(^| )collapsibleList( |$)/)){this.applyTo(n[i],true);if(!t){var s=n[i].getElementsByTagName("ul");for(var o=0;o<s.length;o++){s[o].className+=" collapsibleList"}}}var u=r("expand");if(u){var a=document.getElementById(u);if(a){e(a)}}}};this.applyTo=function(e,r){var i=e.getElementsByTagName("li");for(var s=0;s<i.length;s++){if(!r||e==i[s].parentNode){if(i[s].addEventListener){i[s].addEventListener("mousedown",function(e){e.preventDefault()},false)}else{i[s].attachEvent("onselectstart",function(){event.returnValue=false})}if(i[s].addEventListener){i[s].addEventListener("click",t(i[s]),false)}else{i[s].attachEvent("onclick",t(i[s]))}n(i[s])}}}}

File diff suppressed because one or more lines are too long

9
PocoDoc/resources/js/iframeResizer.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,30 +0,0 @@
<?php
$category = "index-all.html";
$page = "welcome.html";
if (array_key_exists('c', $_GET))
{
$category = 'category-' . $_GET['c'] . '-index.html';
}
if (array_key_exists('p', $_GET))
{
$page = $_GET['p'] . '.html';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Applied Informatics C++ Libraries and Tools Reference Library</title>
</head>
<frameset cols="25%,75%" title="">
<frameset rows="40%,60%" title="">
<frame src="overview.html" title="Overview" name="overviewFrame" />
<frame src="<?php echo $category; ?>" title="Index" name="indexFrame" />
</frameset>
<frame src="<?php echo $page; ?>" title="Details" name="detailsFrame" />
</frameset>
<noframes>
<h1>Frames Required</h1>
<p>This document is designed to be viewed using the frames feature.
If you see this message, you are using a non-frame-capable web client.</p>
</noframes>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,18 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Applied Informatics C++ Libraries and Tools Reference Library</title>
</head>
<frameset cols="25%,75%" title="">
<frameset rows="40%,60%" title="">
<frame src="overview.html" title="Overview" name="overviewFrame" />
<frame src="index-all.html" title="Index" name="indexFrame" />
</frameset>
<frame src="welcome.html" title="Details" name="detailsFrame" />
</frameset>
<noframes>
<h1>Frames Required</h1>
<p>This document is designed to be viewed using the frames feature.
If you see this message, you are using a non-frame-capable web client.</p>
</noframes>
</html>

View File

@ -1,32 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Welcome</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-07"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<img src="images/headerlogo.png" alt="Logo" align="right" border="0" style="padding-right: 20px;">
<h1 class="category">Applied Informatics</h1>
<h1 class="title">C++ Libraries and Tools Reference Library</h1>
</div>
<div class="body">
<h2>User Guides And Tutorials</h2>
${PocoDoc.pageIndex}
<h2>API Reference by Namespace</h2>
${PocoDoc.nameSpaceIndex}
<p class="footer">${PocoDoc.software} ${PocoDoc.version}<br />
Copyright &copy; ${PocoDoc.year}, <a href="${PocoDoc.companyURI}" target="_top">${PocoDoc.company}</a></p>
</div>
${PocoDoc.googleAnalyticsCode}
</body>
</html>

View File

@ -1,9 +1,9 @@
//
// DocWriter.cpp
//
// $Id: //poco/1.4/PocoDoc/src/DocWriter.cpp#3 $
// $Id: //poco/1.4/PocoDoc/src/DocWriter.cpp#4 $
//
// Copyright (c) 2005-2009, Applied Informatics Software Engineering GmbH.
// Copyright (c) 2005-2014, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
@ -103,7 +103,6 @@ void DocWriter::write()
++nameSpaces;
logger().information("Generating namespace " + it->second->fullName());
writeNameSpace(static_cast<const NameSpace*>(it->second));
writeNameSpaceIndex(static_cast<const NameSpace*>(it->second));
break;
case Symbol::SYM_STRUCT:
++classes;
@ -115,8 +114,7 @@ void DocWriter::write()
}
}
logger().information("Generating overview and index");
writeOverview();
writeIndex();
writeNavigation();
logger().information(NumberFormatter::format(nameSpaces) + " namespaces, " + NumberFormatter::format(classes) + " classes.");
Application& app = Application::instance();
app.config().setInt("PocoDoc.statistics.namespaces", nameSpaces);
@ -130,22 +128,22 @@ void DocWriter::write()
}
void DocWriter::writeOverview()
void DocWriter::writeNavigation()
{
Application& app = Application::instance();
std::string software(app.config().getString("PocoDoc.software", ""));
std::string path(pathFor("overview.html"));
std::string path(pathFor("navigation.html"));
std::ofstream ostr(path.c_str());
if (!ostr.good()) throw Poco::CreateFileException(path);
writeHeader(ostr, tr("Overview"));
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";
if (!_pages.empty())
{
ostr << "<h4>" << tr("Guides") << "</h4>\n";
ostr << "<ul>\n";
ostr << "<ul class=\"collapsibleList\">\n";
std::set<std::string> categories;
for (PageMap::const_iterator it = _pages.begin(); it != _pages.end(); ++it)
{
@ -153,13 +151,12 @@ void DocWriter::writeOverview()
}
for (std::set<std::string>::const_iterator it = categories.begin(); it != categories.end(); ++it)
{
std::string fileName("category-");
fileName.append(makeFileName(*it));
fileName.append("-index.html");
ostr << "<li>";
writeTargetLink(ostr, fileName, tr(*it), "indexFrame");
std::string node = "category-";
node += *it;
ostr << "<li id=\"" << node << "\">";
ostr << tr(*it) << "\n";
writeCategoryIndex(ostr, *it, "_top");
ostr << "</li>\n";
writeCategoryIndex(*it, fileName);
}
ostr << "</ul>\n";
}
@ -178,36 +175,40 @@ void DocWriter::writeOverview()
for (std::map<std::string, Symbol*>::const_iterator it = namespaces.begin(); it != namespaces.end(); ++it)
{
ostr << "<li>";
writeTargetLink(ostr, baseNameFor(it->second) + "-index.html", it->second->fullName(), "indexFrame");
writeTargetLink(ostr, baseNameFor(it->second) + ".html", it->second->fullName(), "_top");
ostr << "</li>\n";
}
ostr << "</ul>\n";
ostr << "<h4>" << tr("Packages") << "</h4>\n";
ostr << "<ul>\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)
{
ostr << "<li><b>" << *itl << "</b><br />\n";
std::string node = "library-";
node += *itl;
ostr << "<li id=\"" << node << "\">" << *itl << "\n";
std::set<std::string> pkgs;
packages(*itl, pkgs);
ostr << "<ul>\n";
for (std::set<std::string>::const_iterator itp = pkgs.begin(); itp != pkgs.end(); ++itp)
{
std::string uri("package-");
uri += makeFileName(*itl);
uri += '.';
uri += makeFileName(*itp);
uri += "-index.html";
writeTargetLink(ostr, uri, *itp, "indexFrame");
ostr << "<br />\n";
writePackageIndex(uri, *itl, *itp);
uri += ".html";
ostr << "<li>";
writeTargetLink(ostr, uri, *itp, "_top");
ostr << "</li>\n";
writePackage(uri, *itl, *itp);
}
ostr << "</ul>\n";
}
ostr << "</ul>\n";
ostr << "<h4>";
writeTargetLink(ostr, "index-all.html", tr("All_Symbols"), "indexFrame");
ostr << "</h4>\n";
ostr << "<div>&nbsp;</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);
}
@ -220,7 +221,7 @@ void DocWriter::writePageIndex(std::ostream& ostr)
categories.insert(it->second.category);
}
ostr << "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" << 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)
{
@ -228,9 +229,10 @@ void DocWriter::writePageIndex(std::ostream& ostr)
{
ostr << "<tr>" << std::endl;
}
ostr << "<td valign=\"top\"><div style=\"margin-right: 16px; margin-bottom: 16px;\">" << std::endl;
ostr << "<td>" << std::endl;
ostr << "<h4>" << htmlize(tr(*it)) << "</h4>";
writeCategoryIndex(ostr, *it, "");
ostr << "</div></td>" << std::endl;
ostr << "</td>" << std::endl;
++column;
if (column == PAGE_INDEX_COLUMNS)
{
@ -263,7 +265,7 @@ void DocWriter::writeNameSpaceIndex(std::ostream& ostr)
}
}
ostr << "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" << 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)
{
@ -272,9 +274,9 @@ void DocWriter::writeNameSpaceIndex(std::ostream& ostr)
{
ostr << "<tr>" << std::endl;
}
ostr << "<td valign=\"top\"><p style=\"margin-right: 16px; margin-bottom: 0px; margin-bottom: 0px;\">" << std::endl;
ostr << "<td>" << std::endl;
writeLink(ostr, uriFor(pNameSpace), pNameSpace->fullName());
ostr << "</p></td>" << std::endl;
ostr << "</td>" << std::endl;
++column;
if (column == NAMESPACE_INDEX_COLUMNS)
{
@ -284,7 +286,7 @@ void DocWriter::writeNameSpaceIndex(std::ostream& ostr)
}
if (column != 0)
{
while (column < PAGE_INDEX_COLUMNS)
while (column < NAMESPACE_INDEX_COLUMNS)
{
ostr << "<td></td>" << std::endl;
++column;
@ -380,105 +382,6 @@ void DocWriter::writeEclipseTOC()
}
void DocWriter::writeIndex()
{
std::string path(pathFor("index-all.html"));
std::ofstream ostr(path.c_str());
if (!ostr.good()) throw Poco::CreateFileException(path);
writeHeader(ostr, tr("Symbol_Index"));
beginBody(ostr);
ostr << "<h4>" << tr("All_Symbols") << "</h4>\n";
ostr << "<p class=\"index\">";
std::string prevName;
std::string prevNameSpace;
for (NameSpace::SymbolTable::const_iterator it = _symbols.begin(); it != _symbols.end(); ++it)
{
const std::string& name = it->second->name();
const std::string& nameSpace = it->second->nameSpace()->fullName();
if (it->second->getAccess() != Symbol::ACC_PRIVATE && (name != prevName || nameSpace != prevNameSpace) && name[0] != '#')
{
writeTargetLink(ostr, uriFor(it->second), htmlizeName(name), "detailsFrame");
if (!nameSpace.empty())
ostr << "&nbsp;(" << nameSpace << ")";
ostr << "<br />\n";
prevName = name;
prevNameSpace = nameSpace;
}
}
ostr << "</p>";
endBody(ostr);
writeFooter(ostr);
}
void DocWriter::writeNameSpaceIndex(const NameSpace* pNameSpace)
{
std::string path(pathFor(baseNameFor(pNameSpace) + "-index.html"));
std::ofstream ostr(path.c_str());
if (!ostr.good()) throw Poco::CreateFileException(path);
writeHeader(ostr, tr("Namespace") + " " + pNameSpace->fullName());
beginBody(ostr);
ostr << "<h4>";
writeTargetLink(ostr, uriFor(pNameSpace), pNameSpace->fullName(), "detailsFrame");
ostr << "</h4>\n";
ostr << "<p class=\"index\">";
std::string prevName;
for (NameSpace::Iterator it = pNameSpace->begin(); it != pNameSpace->end(); ++it)
{
const std::string& name = it->second->name();
if (name != prevName)
{
writeTargetLink(ostr, uriFor(it->second), name, "detailsFrame");
ostr << "<br />\n";
prevName = name;
}
}
ostr << "</p>";
endBody(ostr);
writeFooter(ostr);
}
void DocWriter::writePackageIndex(const std::string& file, const std::string& library, const std::string& package)
{
std::string path(pathFor(file));
std::ofstream ostr(path.c_str());
if (!ostr.good()) throw Poco::CreateFileException(path);
writeHeader(ostr, tr("Package_Index"));
beginBody(ostr);
ostr << "<h4>" << package << " (" << library << ")</h4>\n";
ostr << "<p class=\"index\">";
std::string prevName;
std::string prevNameSpace;
for (NameSpace::SymbolTable::const_iterator it = _symbols.begin(); it != _symbols.end(); ++it)
{
Symbol* pSym = it->second;
Function* pFunc = dynamic_cast<Function*>(pSym);
Struct* pStruct = dynamic_cast<Struct*>(pSym);
bool isClass = pStruct && pStruct->getAccess() == Symbol::ACC_PUBLIC;
bool isFunc = pFunc && pFunc->isFunction();
if (isClass || isFunc)
{
if (pSym->getLibrary() == library && pSym->getPackage() == package)
{
const std::string& name = pSym->name();
const std::string& nameSpace = pSym->nameSpace()->fullName();
if (name != prevName || nameSpace != prevNameSpace)
{
writeTargetLink(ostr, uriFor(pSym), htmlizeName(name), "detailsFrame");
ostr << "<br />\n";
prevName = name;
prevNameSpace = nameSpace;
}
}
}
}
ostr << "</p>";
endBody(ostr);
writeFooter(ostr);
}
void DocWriter::writeClass(const Struct* pStruct)
{
_pNameSpace = pStruct;
@ -491,9 +394,11 @@ void DocWriter::writeClass(const Struct* pStruct)
else
header += tr("Struct") + " ";
header += pStruct->fullName();
writeHeader(ostr, header);
writeHeader(ostr, header, "js/iframeResizer.min.js");
writeTitle(ostr, pStruct->nameSpace(), pStruct->declaration() + (pStruct->isFinal() ? " final" : ""));
beginBody(ostr);
writeNavigationFrame(ostr, "library", pStruct->getLibrary());
beginContent(ostr);
writeFileInfo(ostr, pStruct);
const std::string& doc = pStruct->getDocumentation();
if (pStruct->attrs().has("deprecated"))
@ -522,6 +427,7 @@ void DocWriter::writeClass(const Struct* pStruct)
writeMethods(ostr, pStruct);
writeVariables(ostr, pStruct);
writeCopyright(ostr);
endContent(ostr);
endBody(ostr);
writeFooter(ostr);
}
@ -533,9 +439,11 @@ void DocWriter::writeNameSpace(const NameSpace* pNameSpace)
std::string path(pathFor(fileNameFor(pNameSpace)));
std::ofstream ostr(path.c_str());
if (!ostr.good()) throw Poco::CreateFileException(path);
writeHeader(ostr, tr("Namespace") + " " + pNameSpace->fullName());
writeHeader(ostr, tr("Namespace") + " " + pNameSpace->fullName(), "js/iframeResizer.min.js");
writeTitle(ostr, pNameSpace->nameSpace(), std::string("namespace ") + pNameSpace->name());
beginBody(ostr);
writeNavigationFrame(ostr, "", "");
beginContent(ostr);
writeSubTitle(ostr, tr("Overview"));
writeNameSpacesSummary(ostr, pNameSpace);
writeClassesSummary(ostr, pNameSpace);
@ -548,6 +456,107 @@ void DocWriter::writeNameSpace(const NameSpace* pNameSpace)
writeFunctions(ostr, pNameSpace);
writeVariables(ostr, pNameSpace);
writeCopyright(ostr);
endContent(ostr);
endBody(ostr);
writeFooter(ostr);
}
void DocWriter::writePackage(const std::string& file, const std::string& library, const std::string& package)
{
std::string path(pathFor(file));
std::ofstream ostr(path.c_str());
if (!ostr.good()) throw Poco::CreateFileException(path);
writeHeader(ostr, tr("Package_Index"), "js/iframeResizer.min.js");
writeTitle(ostr, tr("Library") + " " + library, tr("Package") + " " + package);
beginBody(ostr);
writeNavigationFrame(ostr, "library", library);
beginContent(ostr);
writeSubTitle(ostr, tr("Overview"));
ostr << "<p><b>" << tr("Classes") << ":</b> " << std::endl;
bool first = true;
std::string prevName;
std::string prevNameSpace;
bool haveFunctions = false;
for (NameSpace::SymbolTable::const_iterator it = _symbols.begin(); it != _symbols.end(); ++it)
{
Symbol* pSym = it->second;
Struct* pStruct = dynamic_cast<Struct*>(pSym);
Function* pFunc = dynamic_cast<Function*>(pSym);
if (pFunc && pFunc->isFunction() && pFunc->getLibrary() == library && pFunc->getPackage() == package) haveFunctions = true;
bool isClass = pStruct && pStruct->getAccess() == Symbol::ACC_PUBLIC;
if (isClass)
{
if (pSym->getLibrary() == library && pSym->getPackage() == package)
{
const std::string& name = pSym->name();
const std::string& nameSpace = pSym->nameSpace()->fullName();
if (name != prevName || nameSpace != prevNameSpace)
{
writeNameListItem(ostr, it->second->name(), it->second, pSym->nameSpace(), first);
prevName = name;
prevNameSpace = nameSpace;
}
}
}
}
ostr << "</p>" << std::endl;
prevName.clear();
prevNameSpace.clear();
if (haveFunctions)
{
ostr << "<p><b>" << tr("Functions") << ":</b> " << std::endl;
first = true;
for (NameSpace::SymbolTable::const_iterator it = _symbols.begin(); it != _symbols.end(); ++it)
{
Symbol* pSym = it->second;
Function* pFunc = dynamic_cast<Function*>(pSym);
if (pFunc && pFunc->isFunction())
{
if (pSym->getLibrary() == library && pSym->getPackage() == package)
{
const std::string& name = pSym->name();
const std::string& nameSpace = pSym->nameSpace()->fullName();
if (name != prevName || nameSpace != prevNameSpace)
{
writeNameListItem(ostr, it->second->name(), it->second, pSym->nameSpace(), first);
prevName = name;
prevNameSpace = nameSpace;
}
}
}
}
ostr << "</p>" << std::endl;
}
prevName.clear();
prevNameSpace.clear();
writeSubTitle(ostr, tr("Classes"));
for (NameSpace::SymbolTable::const_iterator it = _symbols.begin(); it != _symbols.end(); ++it)
{
Symbol* pSym = it->second;
Struct* pStruct = dynamic_cast<Struct*>(pSym);
bool isClass = pStruct && pStruct->getAccess() == Symbol::ACC_PUBLIC;
if (isClass)
{
if (pSym->getLibrary() == library && pSym->getPackage() == package)
{
const std::string& name = pSym->name();
const std::string& nameSpace = pSym->nameSpace()->fullName();
if (name != prevName || nameSpace != prevNameSpace)
{
writeClassSummary(ostr, pStruct);
prevName = name;
prevNameSpace = nameSpace;
}
}
}
}
writeCopyright(ostr);
endContent(ostr);
endBody(ostr);
writeFooter(ostr);
}
@ -616,22 +625,18 @@ std::string DocWriter::makeFileName(const std::string& str)
}
void DocWriter::writeHeader(std::ostream& ostr, const std::string& title)
void DocWriter::writeHeader(std::ostream& ostr, const std::string& title, const std::string& extraScript)
{
Application& app = Application::instance();
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 PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << std::endl;
ostr << "<html xmlns=\"http://www.w3.org/1999/xhtml\">" << 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=\"publisher\" content=\"" << htmlize(company) << "\"/>" << std::endl;
ostr << "<meta name=\"copyright\" content=\"Copyright (c) " << now.year() << ", " << htmlize(company) << "\"/>" << std::endl;
ostr << "<meta name=\"language\" content=\"en\"/>" << std::endl;
ostr << "<meta name=\"date\" content=\"" << DateTimeFormatter::format(now, "%Y-%m-%d") << "\"/>" << 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)
@ -639,8 +644,13 @@ void DocWriter::writeHeader(std::ostream& ostr, const std::string& title)
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=\"js/CollapsibleLists.compressed.js\"></script>" << std::endl;
ostr << "</head>" << std::endl;
ostr << "<body bgcolor=\"#ffffff\" leftmargin=\"0\" topmargin=\"0\"";
ostr << "<body";
if (_prettifyCode)
ostr << " onload=\"prettyPrint()\"";
ostr << ">" << std::endl;
@ -689,10 +699,13 @@ void DocWriter::writeTitle(std::ostream& ostr, const std::string& category, cons
ostr << "<div class=\"header\">\n";
if (!headerImage.empty())
{
ostr << "<img src=\"" << headerImage << "\" alt=\"\" align=\"right\" border=\"0\" style=\"padding-right: 20px;\">\n";
ostr << "<img src=\"" << headerImage << "\" alt=\"\">\n";
}
ostr << "<h1 class=\"category\">";
ostr << htmlize(category);
if (category.empty())
ostr << "&nbsp;";
else
ostr << htmlize(category);
ostr << "</h1>\n";
ostr << "<h1 class=\"title\">" << htmlize(title) << "</h1>";
ostr << "\n</div>\n";
@ -706,7 +719,7 @@ void DocWriter::writeTitle(std::ostream& ostr, const NameSpace* pNameSpace, cons
ostr << "<div class=\"header\">\n";
if (!headerImage.empty())
{
ostr << "<img src=\"" << headerImage << "\" alt=\"\" align=\"right\" border=\"0\" style=\"padding-right: 20px;\">\n";
ostr << "<img src=\"" << headerImage << "\" alt=\"\">\n";
}
const std::string& nameSpace = pNameSpace->fullName();
if (!nameSpace.empty())
@ -715,6 +728,10 @@ void DocWriter::writeTitle(std::ostream& ostr, const NameSpace* pNameSpace, cons
writeLink(ostr, uriFor(pNameSpace), nameSpace, "namespace");
ostr << "</h1>\n";
}
else
{
ostr << "<h1 class=\"namespace\">::</h1>\n";
}
std::string::size_type posFirstOpen = title.find_first_of('<');
bool isTemplate = (posFirstOpen != std::string::npos);
@ -765,6 +782,22 @@ void DocWriter::writeSubTitle(std::ostream& ostr, const std::string& title)
}
void DocWriter::writeNavigationFrame(std::ostream& ostr, const std::string& group, const std::string& item)
{
std::string query;
if (!group.empty() && !item.empty())
{
query = "?expand=";
query += group;
query += "-";
query += item;
}
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";
@ -777,6 +810,18 @@ void DocWriter::endBody(std::ostream& ostr)
}
void DocWriter::beginContent(std::ostream& ostr)
{
ostr << "<div id=\"content\">\n";
}
void DocWriter::endContent(std::ostream& ostr)
{
ostr << "\n</div>\n";
}
void DocWriter::writeDescription(std::ostream& ostr, const std::string& text)
{
ostr << "<div class=\"description\">\n"
@ -959,7 +1004,7 @@ void DocWriter::writeSummary(std::ostream& ostr, const std::string& text, const
if (!uri.empty())
{
ostr << "&nbsp;";
writeImageLink(ostr, uri, "arrow.gif", tr("more"));
writeImageLink(ostr, uri, "arrow.png", tr("more"));
}
ostr << "</p>\n";
}
@ -1024,7 +1069,7 @@ void DocWriter::writeText(std::ostream& ostr, const std::string& text)
++it;
}
while (it != end && std::isspace(*it)) ++it;
ostr << "</p><" << heading << ">" << format("<a name=\"%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;
}
}
@ -1954,7 +1999,7 @@ void DocWriter::writeTargetLink(std::ostream& ostr, const std::string& uri, cons
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 + "\" style=\"vertical-align:baseline;\" border=\"0\" /> ";
ostr << "<img src=\"images/" << image << "\" alt=\"" + alt + "\" /> ";
ostr << "</a>";
}
@ -1962,7 +2007,7 @@ void DocWriter::writeImageLink(std::ostream& ostr, const std::string& uri, const
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) << "\" border=\"0\" /> " << std::endl;
ostr << "<img src=\"" << uri << "\" alt=\"" + caption + "\" title=\"" << htmlize(caption) << "\" /> " << std::endl;
if (!caption.empty())
{
ostr << "<div class=\"imagecaption\">" << htmlize(caption) << "</div>";
@ -1973,13 +2018,13 @@ 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 << ".gif\" alt=\"" + icon + "\" title=\"" << icon << "\" style=\"vertical-align:baseline;\" border=\"0\" /> ";
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 name=\"" << pSymbol->id() << "\">" << htmlize(text) << "</a>";
ostr << "<a id=\"" << pSymbol->id() << "\">" << htmlize(text) << "</a>";
}
@ -2134,15 +2179,19 @@ void DocWriter::writePage(Page& page)
std::string path(pathFor(page.fileName));
std::ofstream ostr(path.c_str());
if (!ostr.good()) throw Poco::CreateFileException(path);
writeHeader(ostr, title);
writeHeader(ostr, title, "js/iframeResizer.min.js");
writeTitle(ostr, tr(category), title);
beginBody(ostr);
writeNavigationFrame(ostr, "category", category);
beginContent(ostr);
if (!toc.empty())
{
writeTOC(ostr, toc);
}
writeDescription(ostr, text);
writeCopyright(ostr);
endContent(ostr);
endBody(ostr);
writeFooter(ostr);
}
@ -2181,12 +2230,34 @@ void DocWriter::scanTOC(const std::string& text, TOC& toc)
void DocWriter::writeTOC(std::ostream& ostr, const TOC& toc)
{
ostr << "<h2>" << tr("TOC") << "</h2>" << std::endl;
ostr << "<div class=\"toc\"><ul>" << std::endl;
ostr << "<div class=\"toc\">" << std::endl;
int lastLevel = 0;
for (TOC::const_iterator it = toc.begin(); it != toc.end(); ++it)
{
ostr << "<li class=\"level" << it->level << "\"><a href=\"#" << it->id << "\">" << htmlize(it->title) << "</a></li>" << std::endl;
int level = it->level;
if (level > lastLevel)
{
ostr << "<ul>" << std::endl;
}
else if (level < lastLevel)
{
for (int i = level; i < lastLevel; i++)
{
ostr << "</ul></li>" << std::endl;
}
}
else
{
ostr << "</li>" << std::endl;
}
ostr << "<li class=\"level" << level << "\"><a href=\"#" << it->id << "\">" << htmlize(it->title) << "</a>" << std::endl;
lastLevel = level;
}
ostr << "</ul></div>" << std::endl;
while (lastLevel-- > 1)
{
ostr << "</li></ul>" << std::endl;
}
ostr << "</li></ul></div>" << std::endl;
}
@ -2196,7 +2267,8 @@ void DocWriter::writeCategoryIndex(const std::string& category, const std::strin
if (!ostr.good()) throw Poco::CreateFileException(fileName);
writeHeader(ostr, tr(category));
beginBody(ostr);
writeCategoryIndex(ostr, category, "detailsFrame");
ostr << "<h4>" << htmlize(tr(category)) << "</h4>";
writeCategoryIndex(ostr, category, "_top");
endBody(ostr);
writeFooter(ostr);
}
@ -2204,9 +2276,7 @@ void DocWriter::writeCategoryIndex(const std::string& category, const std::strin
void DocWriter::writeCategoryIndex(std::ostream& ostr, const std::string& category, const std::string& target)
{
ostr << "<h4>" << htmlize(tr(category)) << "</h4>";
ostr << "<ul>";
ostr << "<ul>\n";
for (PageMap::const_iterator it = _pages.begin(); it != _pages.end(); ++it)
{
if (it->second.category == category)
@ -2216,7 +2286,7 @@ void DocWriter::writeCategoryIndex(std::ostream& ostr, const std::string& catego
ostr << "</li>\n";
}
}
ostr << "</ul>";
ostr << "</ul>\n";
}

View File

@ -1,7 +1,7 @@
//
// DocWriter.h
//
// $Id: //poco/1.4/PocoDoc/src/DocWriter.h#1 $
// $Id: //poco/1.4/PocoDoc/src/DocWriter.h#2 $
//
// Definition of the DocWriter class.
//
@ -108,10 +108,8 @@ protected:
void writeClass(const Poco::CppParser::Struct* pStruct);
void writeNameSpace(const Poco::CppParser::NameSpace* pNameSpace);
void writeOverview();
void writeIndex();
void writeNameSpaceIndex(const Poco::CppParser::NameSpace* pNameSpace);
void writePackageIndex(const std::string& file, const std::string& library, const std::string& package);
void writeNavigation();
void writePackage(const std::string& file, const std::string& library, const std::string& package);
std::string pathFor(const std::string& file);
static std::string fileNameFor(const Poco::CppParser::Symbol* pNameSpace);
@ -121,7 +119,8 @@ protected:
static std::string headerFor(const Poco::CppParser::Symbol* pSymbol);
static std::string titleFor(const Poco::CppParser::Symbol* pSymbol);
void writeHeader(std::ostream& ostr, const std::string& title);
void writeHeader(std::ostream& ostr, const std::string& title, const std::string& extraScript = "");
void writeNavigationFrame(std::ostream& ostr, const std::string& group, const std::string& item);
static void writeFooter(std::ostream& ostr);
void writeCopyright(std::ostream& ostr);
static void writeTitle(std::ostream& ostr, const std::string& category, const std::string& title);
@ -129,6 +128,8 @@ protected:
static void writeSubTitle(std::ostream& ostr, const std::string& title);
static void beginBody(std::ostream& ostr);
static void endBody(std::ostream& ostr);
static void beginContent(std::ostream& ostr);
static void endContent(std::ostream& ostr);
void writeDescription(std::ostream& ostr, const std::string& text);
void writeDescriptionLine(std::ostream& ostr, const std::string& text, TextState& state);
void writeSummary(std::ostream& ostr, const std::string& text, const std::string& uri);

View File

@ -3,7 +3,7 @@
//
// $Id: //poco/1.4/PocoDoc/src/PocoDoc.cpp#2 $
//
// Copyright (c) 2005-2007, Applied Informatics Software Engineering GmbH.
// Copyright (c) 2005-2014, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0