Package org.forgerock.doc.maven.utils
Class HtmlUtils
java.lang.Object
org.forgerock.doc.maven.utils.HtmlUtils
Utility methods to prepare built HTML docs for publication.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addCustomCss
(File cssFile, File srcDir, String documentSrcName) Add custom CSS with XML wrapper to document source directories.static void
addHtaccess
(String baseDir, File htaccess) Add a.htaccess
file to the base directory, for publication on an Apache HTTPD server.static void
fixResourceLinks
(String htmlDir, String resourcesDirBaseName) Fix links to arbitrary resources in HTML files.updateHtml
(String baseDir, Map<String, String> replacements) Replace HTML tags with additional content.
-
Method Details
-
addHtaccess
Add a.htaccess
file to the base directory, for publication on an Apache HTTPD server.According to Apache documentation on How directives are applied, "The configuration directives found in a .htaccess file are applied to the directory in which the .htaccess file is found, and to all subdirectories thereof." So there is no need to copy the file recursively to all directories.
- Parameters:
baseDir
- Base directory under which to add the filehtaccess
-.htaccess
file to copy- Throws:
IOException
- Something went wrong during copy procedure.
-
addCustomCss
public static void addCustomCss(File cssFile, File srcDir, String documentSrcName) throws IOException Add custom CSS with XML wrapper to document source directories.See custom.css.source for details.
- Parameters:
cssFile
- The CSS file to wrap in XML.srcDir
- The source directory for DocBook XML documents.documentSrcName
- The top-level entry file to DocBook XML documents.- Throws:
IOException
- Something went wrong adding CSS.
-
updateHtml
public static List<File> updateHtml(String baseDir, Map<String, String> replacements) throws IOExceptionReplace HTML tags with additional content.- Parameters:
baseDir
- Base directory under which to find HTML files recursivelyreplacements
- Keys are tags to replace. Values are replacements, including the original tag.- Returns:
- List of files updated
- Throws:
IOException
- Something went wrong reading or writing files.
-
fixResourceLinks
Fix links to arbitrary resources in HTML files.Chunked HTML and webhelp have extra directories in the path. Links like
../resources/file.txt
that work in the source do not work as is in these formats. Instead the links need an extra .. as in../../resources/file.txt
.- Parameters:
htmlDir
- Path to a directory containing HTML.resourcesDirBaseName
- Base name of the resources directory.- Throws:
IOException
- Something went wrong updating links.
-