diff --git a/addon/gdc.gs b/addon/gdc.gs index 9426c9a..f798527 100644 --- a/addon/gdc.gs +++ b/addon/gdc.gs @@ -112,6 +112,9 @@ gdc.config = function(config) { if (config.suppressInfo === true) { gdc.suppressInfo = true; } + if (config.formatISODate === true) { + gdc.formatISODate = true; + } }; // Setup for each conversion run. @@ -371,7 +374,9 @@ var INLINE_DRAWING = DocumentApp.ElementType.INLINE_DRAWING, INLINE_IMAGE = DocumentApp.ElementType.INLINE_IMAGE, UNSUPPORTED = DocumentApp.ElementType.UNSUPPORTED, - EQUATION = DocumentApp.ElementType.EQUATION; + EQUATION = DocumentApp.ElementType.EQUATION, + + DATE = DocumentApp.ElementType.DATE; // Heading links and ids gleaned from the TOC, if present. gdc.hasToc = false; @@ -911,6 +916,15 @@ gdc.handleEquation = function() { gdc.alert('equation: use MathJax/LaTeX if your publishing platform supports it.'); }; +gdc.handleDate = function(child) { + let d = child.asDate(); + if (gdc.formatISODate) { + gdc.writeStringToBuffer(d.getTimestamp().toISOString().split("T")[0]); + } else { + gdc.writeStringToBuffer(d.getDisplayText()); + } +} + // Warns/alerts that there are some inline drawings -- no API for that yet :( . gdc.handleInlineDrawing = function() { if (!gdc.handledInlineDrawing) { @@ -1726,6 +1740,9 @@ md.handleChildElement = function(child) { case EQUATION: gdc.handleEquation(); break; + case DATE: + gdc.handleDate(child); + break; case UNSUPPORTED: gdc.log('child element: UNSUPPORTED'); break; diff --git a/addon/sidebar.html b/addon/sidebar.html index 26d27c1..c70906c 100644 --- a/addon/sidebar.html +++ b/addon/sidebar.html @@ -126,6 +126,11 @@ Suppress top comment +
+
@@ -175,6 +180,7 @@ config.wrapHTML = false; config.renderHTMLTags = false; config.suppressInfo= false; + config.formatISODate = false; // Config settings from UI. if (document.getElementById('demote_headings').checked) { @@ -192,6 +198,9 @@ if (document.getElementById('suppress_info').checked) { config.suppressInfo = true; } + if (document.getElementById('format_iso_date').checked) { + config.formatISODate = true; + } }; // Make the calls to the server, and send some callbacks for diff --git a/html-verification.md b/html-verification.md index ec65f8d..a847d18 100644 --- a/html-verification.md +++ b/html-verification.md @@ -1,7 +1,9 @@ + + diff --git a/markdown-verification.md b/markdown-verification.md index 94bd652..c469c10 100644 --- a/markdown-verification.md +++ b/markdown-verification.md @@ -1,7 +1,9 @@ + + ## Notes