Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/bin/generate_static_pages.py

Issue 29933596: Issue 5333 - Allow cms to generate relative pages (Closed) Base URL: https://hg.adblockplus.org/cms/
Patch Set: Add documentation, remove extraneous global Created Nov. 9, 2018, 8:16 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cms/converters.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/bin/generate_static_pages.py
===================================================================
--- a/cms/bin/generate_static_pages.py
+++ b/cms/bin/generate_static_pages.py
@@ -112,7 +112,7 @@
return False
-def generate_pages(repo, output_dir):
+def generate_pages(repo, output_dir, relative=False):
known_files = set()
def write_file(path_parts, contents, binary=False):
@@ -171,7 +171,7 @@
# Second pass: actually generate pages this time
for locale, page in pagelist:
- pagedata = process_page(source, locale, page)
+ pagedata = process_page(source, locale, page, relative=relative)
# Make sure links to static files are versioned
pagedata = re.sub(r'(<script\s[^<>]*\bsrc="/[^"<>]+)', r'\1?%s' % source.version, pagedata)
@@ -206,5 +206,7 @@
parser = ArgumentParser('Convert website source to static website')
parser.add_argument('source', help="Path to website's repository")
parser.add_argument('output', help='Path to desired output directory')
+ parser.add_argument('--relative', help='Generate relative links',
+ action='store_true')
args = parser.parse_args()
- generate_pages(args.source, args.output)
+ generate_pages(args.source, args.output, args.relative)
« no previous file with comments | « no previous file | cms/converters.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld