Repository: freemarker-docgen
Updated Branches:
  refs/heads/master b2155dece -> 70fd660d9


Added setting for adding EU Cookie  Consent to generate pages


Project: http://git-wip-us.apache.org/repos/asf/freemarker-docgen/repo
Commit: http://git-wip-us.apache.org/repos/asf/freemarker-docgen/commit/70fd660d
Tree: http://git-wip-us.apache.org/repos/asf/freemarker-docgen/tree/70fd660d
Diff: http://git-wip-us.apache.org/repos/asf/freemarker-docgen/diff/70fd660d

Branch: refs/heads/master
Commit: 70fd660d9aff5714f7ec13d47527cfaaa0b9c348
Parents: b2155de
Author: ddekany <[email protected]>
Authored: Tue May 22 20:37:54 2018 +0200
Committer: ddekany <[email protected]>
Committed: Tue May 22 20:37:54 2018 +0200

----------------------------------------------------------------------
 src/main/org/freemarker/docgen/Transform.java      | 10 ++++++++++
 src/main/org/freemarker/docgen/templates/page.ftlh |  3 +++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/freemarker-docgen/blob/70fd660d/src/main/org/freemarker/docgen/Transform.java
----------------------------------------------------------------------
diff --git a/src/main/org/freemarker/docgen/Transform.java 
b/src/main/org/freemarker/docgen/Transform.java
index 908a050..16be68b 100644
--- a/src/main/org/freemarker/docgen/Transform.java
+++ b/src/main/org/freemarker/docgen/Transform.java
@@ -343,6 +343,9 @@ import freemarker.template.utility.StringUtil;
  *         insert the Google Analytics <tt>script</tt> element. If this path is
  *         relative, it's relative to the source directory.
  *
+ *         <li><p><tt>cookineConsentScriptURL</tt> (string): The URL used as 
the <tt>src</tt> attribute of the
+ *         EU cookie consent <tt>script</tt> tag. This is usually a CDN URL.
+ *
  *         <li><p><tt>showXXELogo</tt> (boolean): Specifies if an
  *           "Edited with XXE" logo should be shown on the generated pages.
  *           Defaults to <tt>false</tt>.
@@ -461,6 +464,7 @@ public final class Transform {
     static final String SETTING_SIMPLE_NAVIGATION_MODE = 
"simpleNavigationMode";
     static final String SETTING_DEPLOY_URL = "deployUrl";
     static final String SETTING_ONLINE_TRACKER_HTML = "onlineTrackerHTML";
+    static final String SETTING_COOKIE_CONSENT_SCRIPT_URL = 
"cookieConsentScriptURL";
     static final String SETTING_REMOVE_NODES_WHEN_ONLINE = 
"removeNodesWhenOnline";
     static final String SETTING_INTERNAL_BOOKMARKS = "internalBookmarks";
     static final String SETTING_EXTERNAL_BOOKMARKS = "externalBookmarks";
@@ -536,6 +540,7 @@ public final class Transform {
             = SETTING_DEPLOY_URL;
     private static final String VAR_ONLINE_TRACKER_HTML
             = SETTING_ONLINE_TRACKER_HTML;
+    private static final String VAR_COOKIE_CONSENT_SCRIPT_URL = 
SETTING_COOKIE_CONSENT_SCRIPT_URL;
     private static final String VAR_COPYRIGHT_COMMENT = "copyrightComment";
     private static final String VAR_COPYRIGHT_JAVA_COMMENT = 
"copyrightJavaComment";
     private static final String VAR_SHOW_EDITORAL_NOTES
@@ -716,6 +721,7 @@ public final class Transform {
     private String deployUrl;
 
     private String onlineTrackerHTML;
+    private String cookieConstentScriptURL;
 
     private Set<String> removeNodesWhenOnline;
 
@@ -1044,6 +1050,8 @@ public final class Transform {
                     String eol = TextUtil.detectEOL(onlineTrackerHTML, "\n");
                     onlineTrackerHTML = onlineTrackerHTML.trim();
                     onlineTrackerHTML += eol;
+                } else if 
(settingName.equals(SETTING_COOKIE_CONSENT_SCRIPT_URL)) {
+                    cookieConstentScriptURL = castSettingToString(cfgFile, 
settingName, settingValue);
                 } else if 
(settingName.equals(SETTING_REMOVE_NODES_WHEN_ONLINE)) {
                     removeNodesWhenOnline = Collections.unmodifiableSet(new 
HashSet<String>(
                             castSettingToStringList(cfgFile, settingName, 
settingValue)));
@@ -1335,6 +1343,8 @@ public final class Transform {
             fmConfig.setSharedVariable(
                     VAR_ONLINE_TRACKER_HTML, onlineTrackerHTML);
             fmConfig.setSharedVariable(
+                    VAR_COOKIE_CONSENT_SCRIPT_URL, cookieConstentScriptURL);
+            fmConfig.setSharedVariable(
                     VAR_SHOW_EDITORAL_NOTES, showEditoralNotes);
             fmConfig.setSharedVariable(
                     VAR_SHOW_XXE_LOGO, showXXELogo);

http://git-wip-us.apache.org/repos/asf/freemarker-docgen/blob/70fd660d/src/main/org/freemarker/docgen/templates/page.ftlh
----------------------------------------------------------------------
diff --git a/src/main/org/freemarker/docgen/templates/page.ftlh 
b/src/main/org/freemarker/docgen/templates/page.ftlh
index 7cc990c..217ec54 100644
--- a/src/main/org/freemarker/docgen/templates/page.ftlh
+++ b/src/main/org/freemarker/docgen/templates/page.ftlh
@@ -77,6 +77,9 @@
       <#if !offline && onlineTrackerHTML??>
         ${onlineTrackerHTML?noEsc}
       </#if>
+      <#if !offline && cookieConsentScriptURL??>
+        <script type="text/javascript" 
src="${cookieConsentScriptURL}"></script>
+      </#if>
     </head>
   </#compress>
 </#macro>

Reply via email to