Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated instructions based on Google Docs Changes #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions code.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<ul class="small"><li>', suffix = "</li>";
prefix = '<ul><li>', suffix = "</li>";

suffix += "</ul>";
}
Expand All @@ -113,7 +113,7 @@ function processItem(item, listCounters, images) {
suffix = "</li>";
}

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) {
Expand Down Expand Up @@ -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('<b>' + text + '</b>');
output.push('<strong>' + text + '</strong>');
}
else if(item.isItalic()) {
output.push('<blockquote>' + text + '</blockquote>');
Expand All @@ -188,7 +188,7 @@ function processText(item, output) {
output.push('<i>');
}
if (partAtts.BOLD) {
output.push('<b>');
output.push('<strong>');
}
if (partAtts.UNDERLINE) {
output.push('<u>');
Expand All @@ -211,7 +211,7 @@ function processText(item, output) {
output.push('</i>');
}
if (partAtts.BOLD) {
output.push('</b>');
output.push('</strong>');
}
if (partAtts.UNDERLINE) {
output.push('</u>');
Expand Down