mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
PocoDoc - merge changes from macchina.io to allow for insertion of custom HTML into generated pages
This commit is contained in:
@@ -47,7 +47,8 @@
|
|||||||
<charset>utf-8</charset>
|
<charset>utf-8</charset>
|
||||||
<software>POCO C++ Libraries</software>
|
<software>POCO C++ Libraries</software>
|
||||||
<company>Applied Informatics Software Engineering GmbH and Contributors</company>
|
<company>Applied Informatics Software Engineering GmbH and Contributors</company>
|
||||||
<companyURI>http://pocoproject.org/</companyURI>
|
<companyURI>https://pocoproject.org/
|
||||||
|
</companyURI>
|
||||||
</PocoDoc>
|
</PocoDoc>
|
||||||
<Translations>
|
<Translations>
|
||||||
<EN>
|
<EN>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<meta name="generator" content="PocoDoc"/>
|
<meta name="generator" content="PocoDoc"/>
|
||||||
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
|
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
|
||||||
<script type="text/javascript" src="js/iframeResizer.min.js"></script>
|
<script type="text/javascript" src="js/iframeResizer.min.js"></script>
|
||||||
|
${PocoDoc.customHeadHTML}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@@ -28,5 +29,6 @@ ${PocoDoc.nameSpaceIndex}
|
|||||||
Copyright © ${PocoDoc.year}, <a href="${PocoDoc.companyURI}" target="_top">${PocoDoc.company}</a></p>
|
Copyright © ${PocoDoc.year}, <a href="${PocoDoc.companyURI}" target="_top">${PocoDoc.company}</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
${PocoDoc.customBodyHTML}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ void DocWriter::writeNavigation()
|
|||||||
std::string path(pathFor("navigation.html"));
|
std::string path(pathFor("navigation.html"));
|
||||||
std::ofstream ostr(path.c_str());
|
std::ofstream ostr(path.c_str());
|
||||||
if (!ostr.good()) throw Poco::CreateFileException(path);
|
if (!ostr.good()) throw Poco::CreateFileException(path);
|
||||||
writeHeader(ostr, tr("Navigation"), "js/iframeResizer.contentWindow.min.js");
|
writeHeader(ostr, tr("Navigation"), "js/iframeResizer.contentWindow.min.js", NO_CUSTOM_HTML);
|
||||||
beginBody(ostr);
|
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";
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ void DocWriter::writeNavigation()
|
|||||||
ostr << "<div> </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);
|
endBody(ostr);
|
||||||
ostr << "<script>CollapsibleLists.apply(true)</script>" << std::endl;
|
ostr << "<script>CollapsibleLists.apply(true)</script>" << std::endl;
|
||||||
writeFooter(ostr);
|
writeFooter(ostr, NO_TRACKING | NO_CUSTOM_HTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ std::string DocWriter::makeFileName(const std::string& str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DocWriter::writeHeader(std::ostream& ostr, const std::string& title, const std::string& extraScript)
|
void DocWriter::writeHeader(std::ostream& ostr, const std::string& title, const std::string& extraScript, int options)
|
||||||
{
|
{
|
||||||
Application& app = Application::instance();
|
Application& app = Application::instance();
|
||||||
std::string company(app.config().getString("PocoDoc.company", "Applied Informatics"));
|
std::string company(app.config().getString("PocoDoc.company", "Applied Informatics"));
|
||||||
@@ -651,6 +651,10 @@ void DocWriter::writeHeader(std::ostream& ostr, const std::string& title, const
|
|||||||
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;
|
||||||
|
if ((options & NO_CUSTOM_HTML) == 0)
|
||||||
|
{
|
||||||
|
ostr << app.config().getString("PocoDoc.customHeadHTML", "");
|
||||||
|
}
|
||||||
ostr << "</head>" << std::endl;
|
ostr << "</head>" << std::endl;
|
||||||
ostr << "<body";
|
ostr << "<body";
|
||||||
if (_prettifyCode)
|
if (_prettifyCode)
|
||||||
@@ -659,11 +663,20 @@ void DocWriter::writeHeader(std::ostream& ostr, const std::string& title, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DocWriter::writeFooter(std::ostream& ostr)
|
void DocWriter::writeFooter(std::ostream& ostr, int options)
|
||||||
{
|
{
|
||||||
Application& app = Application::instance();
|
Application& app = Application::instance();
|
||||||
std::string googleAnalyticsCode(app.config().getString("PocoDoc.googleAnalyticsCode", ""));
|
if ((options & NO_TRACKING) == 0)
|
||||||
ostr << googleAnalyticsCode;
|
{
|
||||||
|
std::string googleAnalyticsCode(app.config().getString("PocoDoc.googleAnalyticsCode", ""));
|
||||||
|
ostr << googleAnalyticsCode;
|
||||||
|
std::string hubSpotCode(app.config().getString("PocoDoc.hubSpotCode", ""));
|
||||||
|
ostr << hubSpotCode;
|
||||||
|
}
|
||||||
|
if ((options & NO_CUSTOM_HTML) == 0)
|
||||||
|
{
|
||||||
|
ostr << app.config().getString("PocoDoc.customBodyHTML", "");
|
||||||
|
}
|
||||||
ostr << "</body>" << std::endl;
|
ostr << "</body>" << std::endl;
|
||||||
ostr << "</html>" << std::endl;
|
ostr << "</html>" << std::endl;
|
||||||
}
|
}
|
||||||
@@ -674,8 +687,8 @@ void DocWriter::writeCopyright(std::ostream& ostr)
|
|||||||
Application& app = Application::instance();
|
Application& app = Application::instance();
|
||||||
std::string software(app.config().getString("PocoDoc.software", ""));
|
std::string software(app.config().getString("PocoDoc.software", ""));
|
||||||
std::string version(app.config().getString("PocoDoc.version", ""));
|
std::string version(app.config().getString("PocoDoc.version", ""));
|
||||||
std::string company(app.config().getString("PocoDoc.company", "Applied Informatics"));
|
std::string company(app.config().getString("PocoDoc.company", "Applied Informatics Software Engineering GmbH"));
|
||||||
std::string companyURI(app.config().getString("PocoDoc.companyURI", "http://www.appinf.com/"));
|
std::string companyURI(app.config().getString("PocoDoc.companyURI", "https://macchina.io/"));
|
||||||
std::string licenseURI(app.config().getString("PocoDoc.licenseURI", ""));
|
std::string licenseURI(app.config().getString("PocoDoc.licenseURI", ""));
|
||||||
DateTime now;
|
DateTime now;
|
||||||
ostr << "<p class=\"footer\">";
|
ostr << "<p class=\"footer\">";
|
||||||
@@ -1286,7 +1299,7 @@ bool DocWriter::writeSpecial(std::ostream& ostr, std::string& token, std::string
|
|||||||
{
|
{
|
||||||
_htmlMode = false;
|
_htmlMode = false;
|
||||||
}
|
}
|
||||||
else if (token == "<?")
|
else if (token == "<?" || token == "<?=")
|
||||||
{
|
{
|
||||||
std::string prop;
|
std::string prop;
|
||||||
nextToken(begin, end, token);
|
nextToken(begin, end, token);
|
||||||
@@ -1299,6 +1312,19 @@ bool DocWriter::writeSpecial(std::ostream& ostr, std::string& token, std::string
|
|||||||
Application& app = Application::instance();
|
Application& app = Application::instance();
|
||||||
ostr << htmlize(app.config().getString(prop, std::string("NOT FOUND: ") + prop));
|
ostr << htmlize(app.config().getString(prop, std::string("NOT FOUND: ") + prop));
|
||||||
}
|
}
|
||||||
|
else if (token == "<?-")
|
||||||
|
{
|
||||||
|
std::string prop;
|
||||||
|
nextToken(begin, end, token);
|
||||||
|
while (!token.empty() && token != "?>")
|
||||||
|
{
|
||||||
|
prop.append(token);
|
||||||
|
nextToken(begin, end, token);
|
||||||
|
}
|
||||||
|
Poco::trimInPlace(prop);
|
||||||
|
Application& app = Application::instance();
|
||||||
|
ostr << app.config().getString(prop, "");
|
||||||
|
}
|
||||||
else if (_htmlMode)
|
else if (_htmlMode)
|
||||||
{
|
{
|
||||||
ostr << token;
|
ostr << token;
|
||||||
|
|||||||
@@ -82,6 +82,12 @@ protected:
|
|||||||
NAMESPACE_INDEX_COLUMNS = 4
|
NAMESPACE_INDEX_COLUMNS = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
NO_CUSTOM_HTML = 1,
|
||||||
|
NO_TRACKING = 2
|
||||||
|
};
|
||||||
|
|
||||||
struct TOCEntry
|
struct TOCEntry
|
||||||
{
|
{
|
||||||
std::string title;
|
std::string title;
|
||||||
@@ -117,9 +123,9 @@ protected:
|
|||||||
static std::string headerFor(const Poco::CppParser::Symbol* pSymbol);
|
static std::string headerFor(const Poco::CppParser::Symbol* pSymbol);
|
||||||
static std::string titleFor(const Poco::CppParser::Symbol* pSymbol);
|
static std::string titleFor(const Poco::CppParser::Symbol* pSymbol);
|
||||||
|
|
||||||
void writeHeader(std::ostream& ostr, const std::string& title, const std::string& extraScript = "");
|
void writeHeader(std::ostream& ostr, const std::string& title, const std::string& extraScript = "", int options = 0);
|
||||||
void writeNavigationFrame(std::ostream& ostr, const std::string& group, const std::string& item);
|
void writeNavigationFrame(std::ostream& ostr, const std::string& group, const std::string& item);
|
||||||
static void writeFooter(std::ostream& ostr);
|
static void writeFooter(std::ostream& ostr, int options = 0);
|
||||||
void writeCopyright(std::ostream& ostr);
|
void writeCopyright(std::ostream& ostr);
|
||||||
static void writeTitle(std::ostream& ostr, const std::string& category, const std::string& title);
|
static void writeTitle(std::ostream& ostr, const std::string& category, const std::string& title);
|
||||||
static void writeTitle(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, const std::string& title);
|
static void writeTitle(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, const std::string& title);
|
||||||
|
|||||||
@@ -457,6 +457,9 @@ protected:
|
|||||||
config().setString("PocoDoc.date", Poco::DateTimeFormatter::format(now, "%Y-%m-%d"));
|
config().setString("PocoDoc.date", Poco::DateTimeFormatter::format(now, "%Y-%m-%d"));
|
||||||
config().setString("PocoDoc.year", Poco::DateTimeFormatter::format(now, "%Y"));
|
config().setString("PocoDoc.year", Poco::DateTimeFormatter::format(now, "%Y"));
|
||||||
config().setString("PocoDoc.googleAnalyticsCode", generateGoogleAnalyticsCode());
|
config().setString("PocoDoc.googleAnalyticsCode", generateGoogleAnalyticsCode());
|
||||||
|
config().setString("PocoDoc.hubSpotCode", generateHubSpotCode());
|
||||||
|
if (!config().has("PocoDoc.customHeadHTML")) config().setString("PocoDoc.customHeadHTML", "");
|
||||||
|
if (!config().has("PocoDoc.customBodyHTML")) config().setString("PocoDoc.customBodyHTML", "");
|
||||||
Poco::Stopwatch sw;
|
Poco::Stopwatch sw;
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
try
|
try
|
||||||
@@ -484,17 +487,27 @@ protected:
|
|||||||
std::string googleAnalyticsId(config().getString("PocoDoc.googleAnalyticsId", ""));
|
std::string googleAnalyticsId(config().getString("PocoDoc.googleAnalyticsId", ""));
|
||||||
if (!googleAnalyticsId.empty())
|
if (!googleAnalyticsId.empty())
|
||||||
{
|
{
|
||||||
ostr << "<!-- Begin Google Analytics -->\n";
|
ostr << "<script>\n";
|
||||||
ostr << "<script type=\"text/javascript\">\n";
|
ostr << " (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";
|
||||||
ostr << "var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n";
|
ostr << " (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n";
|
||||||
ostr << "document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n";
|
ostr << " m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";
|
||||||
|
ostr << " })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n";
|
||||||
|
ostr << "\n";
|
||||||
|
ostr << " ga('create', '" << googleAnalyticsId << "', 'auto');\n";
|
||||||
|
ostr << " ga('set', 'anonymizeIp', true);\n";
|
||||||
|
ostr << " ga('send', 'pageview');\n";
|
||||||
ostr << "</script>\n";
|
ostr << "</script>\n";
|
||||||
ostr << "<script type=\"text/javascript\">\n";
|
}
|
||||||
ostr << "try {\n";
|
return ostr.str();
|
||||||
ostr << "var pageTracker = _gat._getTracker(\"" << googleAnalyticsId << "\");\n";
|
}
|
||||||
ostr << "pageTracker._trackPageview();\n";
|
|
||||||
ostr << "} catch(err) {}</script>\n";
|
std::string generateHubSpotCode()
|
||||||
ostr << "<!-- End Google Analytics -->\n";
|
{
|
||||||
|
std::stringstream ostr;
|
||||||
|
std::string hubSpotId(config().getString("PocoDoc.hubSpotId", ""));
|
||||||
|
if (!hubSpotId.empty())
|
||||||
|
{
|
||||||
|
ostr << "<script type=\"text/javascript\" id=\"hs-script-loader\" async defer src=\"//js.hs-scripts.com/" << hubSpotId << ".js\"></script>\n";
|
||||||
}
|
}
|
||||||
return ostr.str();
|
return ostr.str();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ standard library. The contributors attempt to find a good balance
|
|||||||
between using advanced C++ features and keeping the classes
|
between using advanced C++ features and keeping the classes
|
||||||
comprehensible and the code clean, consistent and easy to maintain.
|
comprehensible and the code clean, consistent and easy to maintain.
|
||||||
|
|
||||||
|
<%
|
||||||
|
<?-PocoDoc.adContent?>
|
||||||
|
%>
|
||||||
|
|
||||||
!!! The Foundation Library
|
!!! The Foundation Library
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ team and may not always be up to date.*>
|
|||||||
Up-to-date [[https://conan.io Conan]] packages are available via
|
Up-to-date [[https://conan.io Conan]] packages are available via
|
||||||
[[https://bintray.com/pocoproject/conan/Poco%3Apocoproject Bintray]].
|
[[https://bintray.com/pocoproject/conan/Poco%3Apocoproject Bintray]].
|
||||||
|
|
||||||
|
<%
|
||||||
|
<?-PocoDoc.adContent?>
|
||||||
|
%>
|
||||||
|
|
||||||
!!Source Code Distribution Format
|
!!Source Code Distribution Format
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ case `uname` in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
spec=""
|
spec=""
|
||||||
docConfig=$POCO_BASE/PocoDoc/cfg/mkdoc-poco.xml
|
docConfig=""
|
||||||
while [ "$1" != "" ] ;
|
while [ "$1" != "" ] ;
|
||||||
do
|
do
|
||||||
if [ "$1" = "-C" ] ; then
|
if [ "$1" = "-C" ] ; then
|
||||||
shift
|
shift
|
||||||
docConfig=$1
|
docConfig="$docConfig -C $1"
|
||||||
shift
|
shift
|
||||||
elif [ "$1" = "-v" ] ; then
|
elif [ "$1" = "-v" ] ; then
|
||||||
shift
|
shift
|
||||||
@@ -43,6 +43,10 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -z "$docConfig" ] ; then
|
||||||
|
docConfig="-C $POCO_BASE/PocoDoc/cfg/mkdoc-poco.xml"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$spec" != "" ] ; then
|
if [ "$spec" != "" ] ; then
|
||||||
relspec="-f release/spec/${spec}.release"
|
relspec="-f release/spec/${spec}.release"
|
||||||
tag="-$spec"
|
tag="-$spec"
|
||||||
@@ -105,4 +109,4 @@ export PATH=$tools/PocoDoc/bin/$osname/$osarch:$PATH
|
|||||||
echo PATH=$PATH
|
echo PATH=$PATH
|
||||||
|
|
||||||
echo "Building documentation $release (using $docConfig)"
|
echo "Building documentation $release (using $docConfig)"
|
||||||
mkdocumentation $reltag $relspec -C $docConfig -v $version
|
mkdocumentation $reltag $relspec $docConfig -v $version
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ make=make
|
|||||||
include=`dirname $0`
|
include=`dirname $0`
|
||||||
build=$POCO_BASE/stage/docbuild
|
build=$POCO_BASE/stage/docbuild
|
||||||
dist=$POCO_BASE/releases
|
dist=$POCO_BASE/releases
|
||||||
docConfig=$POCO_BASE/PocoDoc/cfg/mkdocumentation.xml
|
docConfig=""
|
||||||
read version <$POCO_BASE/VERSION
|
read version <$POCO_BASE/VERSION
|
||||||
|
|
||||||
osname=`uname -s | tr ' ' '_'`
|
osname=`uname -s | tr ' ' '_'`
|
||||||
@@ -57,7 +57,7 @@ do
|
|||||||
shift
|
shift
|
||||||
elif [ "$1" = "-C" ] ; then
|
elif [ "$1" = "-C" ] ; then
|
||||||
shift
|
shift
|
||||||
docConfig=$1
|
docConfig="$docConfig --config=$1"
|
||||||
shift
|
shift
|
||||||
elif [ "$1" = "-v" ] ; then
|
elif [ "$1" = "-v" ] ; then
|
||||||
shift
|
shift
|
||||||
@@ -69,6 +69,10 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -z "$docConfig" ] ; then
|
||||||
|
docConfig=$POCO_BASE/PocoDoc/cfg/mkdocumentation.xml
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$specfile" != "" ] ; then
|
if [ "$specfile" != "" ] ; then
|
||||||
while read c
|
while read c
|
||||||
do
|
do
|
||||||
@@ -130,8 +134,7 @@ echo "PocoDoc.output=$docPath" >>$build/PocoDoc.ini
|
|||||||
echo "PocoDoc.version=$docVersion" >> $build/PocoDoc.ini
|
echo "PocoDoc.version=$docVersion" >> $build/PocoDoc.ini
|
||||||
echo "Includes=$includes" >> $build/PocoDoc.ini
|
echo "Includes=$includes" >> $build/PocoDoc.ini
|
||||||
|
|
||||||
echo "PocoDoc --config=$docConfig --config=$build/PocoDoc.ini"
|
PocoDoc $docConfig --config=$build/PocoDoc.ini
|
||||||
PocoDoc --config=$docConfig --config=$build/PocoDoc.ini
|
|
||||||
|
|
||||||
cd $dist
|
cd $dist
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user