\r
<arg value="--pageHeader" />\r
<arg value="${basedir}/docs/site_header.html" />\r
-\r
+ \r
<arg value="--pageFooter" />\r
<arg value="${basedir}/docs/site_footer.html" />\r
\r
+ <arg value="--analyticsSnippet" />\r
+ <arg value="${basedir}/docs/site_analytics.html" />\r
+ \r
+ <arg value="--adSnippet" />\r
+ <arg value="${basedir}/docs/site_ads.html" />\r
+\r
<arg value="--alias" />\r
<arg value="index=overview" />\r
\r
sb.trimToSize();\r
\r
String htmlHeader = FileUtils.readContent(new File(params.pageHeader), "\n");\r
+ \r
+ String htmlAdSnippet = null;\r
+ if (!StringUtils.isEmpty(params.adSnippet)) {\r
+ File snippet = new File(params.adSnippet);\r
+ if (snippet.exists()) {\r
+ htmlAdSnippet = FileUtils.readContent(snippet, "\n");\r
+ }\r
+ }\r
String htmlFooter = FileUtils.readContent(new File(params.pageFooter), "\n");\r
- final String links = sb.toString();\r
- final String header = MessageFormat.format(htmlHeader, Constants.FULL_NAME, links);\r
+ String links = sb.toString();\r
+ String header = MessageFormat.format(htmlHeader, Constants.FULL_NAME, links);\r
+ if (!StringUtils.isEmpty(params.analyticsSnippet)) {\r
+ File snippet = new File(params.analyticsSnippet);\r
+ if (snippet.exists()) {\r
+ String htmlSnippet = FileUtils.readContent(snippet, "\n");\r
+ header = header.replace("<!-- ANALYTICS -->", htmlSnippet);\r
+ }\r
+ } \r
final String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());\r
final String footer = MessageFormat.format(htmlFooter, "generated " + date);\r
for (File file : markdownFiles) {\r
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(\r
new File(destinationFolder, fileName)), Charset.forName("UTF-8"));\r
writer.write(header);\r
+ if (!StringUtils.isEmpty(htmlAdSnippet)) {\r
+ writer.write(htmlAdSnippet);\r
+ }\r
writer.write(content);\r
writer.write(footer);\r
reader.close();\r
@Parameter(names = { "--pageFooter" }, description = "Page Footer HTML Snippet", required = true)\r
public String pageFooter;\r
\r
+ @Parameter(names = { "--adSnippet" }, description = "Ad HTML Snippet", required = false)\r
+ public String adSnippet;\r
+\r
+ @Parameter(names = { "--analyticsSnippet" }, description = "Analytics HTML Snippet", required = false)\r
+ public String analyticsSnippet;\r
+\r
@Parameter(names = { "--skip" }, description = "Filename to skip", required = false)\r
public List<String> skips = new ArrayList<String>();\r
\r