Skip to content

Commit

Permalink
Add support for new Google Docs published link format
Browse files Browse the repository at this point in the history
and update the menu directions in the first step of the corresponding help page. (The other screenshots should also be updated at some point, but they’re less important.)
  • Loading branch information
charmander committed Sep 6, 2024
1 parent 20e6933 commit f22559d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
Binary file modified assets/img/help/help-gdocs-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/help/help-gdocs-1.webp
Binary file not shown.
Binary file modified assets/img/help/help-gdocs-1@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/help/help-gdocs-1@2x.webp
Binary file not shown.
6 changes: 3 additions & 3 deletions weasyl/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ def create_visual(userid, submission,


_GOOGLE_DOCS_EMBED = re.compile(
r"\bdocs\.google\.com/document/d/e/([0-9a-z_\-]+)/pub\b",
re.IGNORECASE,
r"\bdocs\.google\.com/document/d/((?:e/)?[0-9a-z_\-]+)/pub\b",
re.ASCII | re.IGNORECASE,
)


Expand All @@ -280,7 +280,7 @@ def _normalize_google_docs_embed(embedlink):
if match is None:
raise WeasylError('googleDocsEmbedLinkInvalid', level='info')

return f"https://docs.google.com/document/d/e/{match.group(1)}/pub?embedded=true"
return f"https://docs.google.com/document/d/{match.group(1)}/pub?embedded=true"


@_create_submission(expected_type=2)
Expand Down
4 changes: 2 additions & 2 deletions weasyl/templates/help/gdocs.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ <h3>How do I find the embed link?</h3>
<ol>
<li>
<figure class="help-image">
<figcaption>In the <kbd><samp>File</samp></kbd> menu of your document, there is a <kbd><samp>Publish to the web</samp></kbd> option.</figcaption>
<figcaption>In the <kbd><samp>File</samp><samp>Share</samp></kbd> menu of your document, there is a <kbd><samp>Publish to web</samp></kbd> option.</figcaption>
<picture>
<source type="image/webp" srcset="${resource_path('img/help/help-gdocs-1.webp')}, ${resource_path('img/help/help-gdocs-1@2x.webp')} 2x">
<img src="${resource_path('img/help/help-gdocs-1.png')}" width="215" height="555" alt="">
<img src="${resource_path('img/help/help-gdocs-1.png')}" width="590" height="230" alt="">
</picture>
</figure>

Expand Down
4 changes: 4 additions & 0 deletions weasyl/test/web/test_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ def test_visual_reupload_thumbnail_and_cover(app, submission_user):
'https://docs.google.com/document/d/e/2PACX-1Hheu7cs9fxBIMdFSNozPOKsXS79QEoUNhx2AFli6BkxBD9QG9QmjO68C17nx_wcEOq4uC2AdVcGGr14/pub?embedded=true',
'https://docs.google.com/document/d/e/2PACX-1Hheu7cs9fxBIMdFSNozPOKsXS79QEoUNhx2AFli6BkxBD9QG9QmjO68C17nx_wcEOq4uC2AdVcGGr14/pub?embedded=true',
),
(
'https://docs.google.com/document/d/zd9LMaQo_rfD-ZUhI1WPDK2nhCI3Z3LmchHpLogIVqCd/pub',
'https://docs.google.com/document/d/zd9LMaQo_rfD-ZUhI1WPDK2nhCI3Z3LmchHpLogIVqCd/pub?embedded=true',
),
(
'docs.google.com/document/d/e/2PACX-1Hheu7cs9fxBIMdFSNozPOKsXS79QEoUNhx2AFli6BkxBD9QG9QmjO68C17nx_wcEOq4uC2AdVcGGr14/pub',
'https://docs.google.com/document/d/e/2PACX-1Hheu7cs9fxBIMdFSNozPOKsXS79QEoUNhx2AFli6BkxBD9QG9QmjO68C17nx_wcEOq4uC2AdVcGGr14/pub?embedded=true',
Expand Down

0 comments on commit f22559d

Please sign in to comment.