mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-10 21:58:48 +01:00
docs; update generator
- copies files in doc/site/static/ to output - update output formatting to include potential differences in markdown generator (local generate had >, so cover both to remain consistent) - copy rss xml (could be in static too, but for now...)
This commit is contained in:
@ -130,6 +130,7 @@ def format_file(path, skip_up_to_date):
|
||||
|
||||
# Use special formatting for example output and errors.
|
||||
html = html.replace('<span class="c1">//> ', '<span class="output">')
|
||||
html = html.replace('<span class="c1">//&gt; ', '<span class="output">')
|
||||
html = html.replace('<span class="c1">//! ', '<span class="error">')
|
||||
|
||||
modified = datetime.fromtimestamp(os.path.getmtime(in_path))
|
||||
@ -167,6 +168,24 @@ def check_sass():
|
||||
print("Built build/docs/style.css")
|
||||
|
||||
|
||||
def copy_static():
|
||||
shutil.copy2("doc/site/blog/rss.xml", "build/docs/blog/rss.xml")
|
||||
|
||||
for root, dirnames, filenames in os.walk('doc/site/static'):
|
||||
for filename in filenames:
|
||||
source = os.path.join(root, filename)
|
||||
source_mod = os.path.getmtime(source)
|
||||
dest = os.path.join("build/docs", filename)
|
||||
dest_mod = 0
|
||||
if os.path.exists(dest):
|
||||
dest_mod = os.path.getmtime('build/docs/style.css')
|
||||
|
||||
if source_mod < dest_mod:
|
||||
return
|
||||
|
||||
shutil.copy2(source, dest)
|
||||
print('Copied ' + filename)
|
||||
|
||||
def format_files(skip_up_to_date):
|
||||
check_sass()
|
||||
|
||||
@ -175,6 +194,7 @@ def format_files(skip_up_to_date):
|
||||
f = os.path.relpath(os.path.join(root, filename), 'doc/site')
|
||||
format_file(f, skip_up_to_date)
|
||||
|
||||
copy_static()
|
||||
|
||||
def run_server():
|
||||
port = 8000
|
||||
|
||||
Reference in New Issue
Block a user