From 49832d0a051b72c43394102d942ef1d4b6c420b2 Mon Sep 17 00:00:00 2001 From: Jim Birch Date: Tue, 14 Jul 2015 22:30:56 -0500 Subject: [PATCH 1/5] Updated instructions based on Google Docs Changes --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 513cc64..d781a8f 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,15 @@ 1. Open your Google Doc and go to Tools menu, select Script Editor. You should see a new window open with a nice code editor. 2. Copy and paste the code from here: [GoogleDocs2Html][1] - 3. Then from the "Select Editor" menu, choose ConvertGoogleDocToCleanHtml - 4. Click the play button to run the script. - 5. You will get an email containing the HTML output of - the Google Doc with inline images. - 6. You can easily forward that email to anyone or copy and paste in a Wordpress post. - + 3. Go to the File menu and Save the file the script as GoogleDoc2Html. + 4. Then from the Run menu, choose ConvertGoogleDocToCleanHtml + 5. A popup window will appear titled, Authorization required. + Click continue to grant the following permissions: + Know who you are on Google + View your email address + View and manage your documents in Google Drive + Send email as you + 6. You will get an email at your Google Account containing the HTML + output of the Google Doc with inline images. [1]: https://raw.githubusercontent.com/oazabir/GoogleDoc2Html/master/code.js From 5ea1967401fe9c1b795430956b440f2da74a7d58 Mon Sep 17 00:00:00 2001 From: Jim Birch Date: Tue, 14 Jul 2015 22:33:27 -0500 Subject: [PATCH 2/5] Remove small class from UL. Changed to --- code.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code.js b/code.js index b852e6a..bb99cea 100644 --- a/code.js +++ b/code.js @@ -99,7 +99,7 @@ function processItem(item, listCounters, images) { if (gt === DocumentApp.GlyphType.BULLET || gt === DocumentApp.GlyphType.HOLLOW_BULLET || gt === DocumentApp.GlyphType.SQUARE_BULLET) { - prefix = '
  • ', suffix = "
  • "; + prefix = '
    • ', suffix = "
    • "; suffix += "
    "; } @@ -162,7 +162,7 @@ function processText(item, output) { if (indices.length <= 1) { // Assuming that a whole para fully italic is a quote if(item.isBold()) { - output.push('' + text + ''); + output.push('' + text + ''); } else if(item.isItalic()) { output.push('
    ' + text + '
    '); @@ -188,7 +188,7 @@ function processText(item, output) { output.push(''); } if (partAtts.BOLD) { - output.push(''); + output.push(''); } if (partAtts.UNDERLINE) { output.push(''); @@ -211,7 +211,7 @@ function processText(item, output) { output.push(''); } if (partAtts.BOLD) { - output.push(''); + output.push(''); } if (partAtts.UNDERLINE) { output.push(''); From 27a559acedc6384cf204b223913702cedcfda9a9 Mon Sep 17 00:00:00 2001 From: Jim Birch Date: Wed, 14 Oct 2015 22:12:37 -0500 Subject: [PATCH 3/5] Changes List items to check if it is undefined before asking for its type - @stanleyshilov --- code.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code.js b/code.js index bb99cea..9f1fdfa 100644 --- a/code.js +++ b/code.js @@ -113,7 +113,7 @@ function processItem(item, listCounters, images) { suffix = ""; } - if (item.isAtDocumentEnd() || item.getNextSibling().getType() != DocumentApp.ElementType.LIST_ITEM) { + if (item.isAtDocumentEnd() || (item.getNextSibling() && (item.getNextSibling().getType() != DocumentApp.ElementType.LIST_ITEM))) { if (gt === DocumentApp.GlyphType.BULLET || gt === DocumentApp.GlyphType.HOLLOW_BULLET || gt === DocumentApp.GlyphType.SQUARE_BULLET) { From 52b4c3ca440be62cfefb98bc71dd5ebef9ac3c24 Mon Sep 17 00:00:00 2001 From: Joe Murphy Date: Fri, 13 Sep 2019 17:00:14 -0400 Subject: [PATCH 4/5] Accommodate https links Add logic that lets the script parse and return links that start with "https://" in addition to links that start with "http://" --- code.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code.js b/code.js index 9f1fdfa..3bf8222 100644 --- a/code.js +++ b/code.js @@ -170,6 +170,9 @@ function processText(item, output) { else if (text.trim().indexOf('http://') == 0) { output.push('' + text + ''); } + else if (text.trim().indexOf('https://') == 0) { + output.push('' + text + ''); + } else { output.push(text); } @@ -203,6 +206,9 @@ function processText(item, output) { else if (partText.trim().indexOf('http://') == 0) { output.push('' + partText + ''); } + else if (partText.trim().indexOf('https://') == 0) { + output.push('' + partText + ''); + } else { output.push(partText); } From 6a2fcd373c746b8e4c93c623f8eef4e1e378898d Mon Sep 17 00:00:00 2001 From: Jim Birch <5177009+thejimbirch@users.noreply.github.com> Date: Tue, 1 Dec 2020 09:31:24 -0500 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d781a8f..c1d6e1d 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,4 @@ 6. You will get an email at your Google Account containing the HTML output of the Google Doc with inline images. - [1]: https://raw.githubusercontent.com/oazabir/GoogleDoc2Html/master/code.js + [1]: https://raw.githubusercontent.com/thejimbirch/GoogleDoc2Html/master/code.js