|
@ -5,16 +5,8 @@ from datetime import datetime |
|
|
import dateutil.parser |
|
|
import dateutil.parser |
|
|
import pypandoc |
|
|
import pypandoc |
|
|
|
|
|
|
|
|
try: |
|
|
from urllib.parse import urlparse, urlunparse, urlencode, quote |
|
|
# python2 |
|
|
from urllib.request import urlopen, URLError, HTTPError |
|
|
from urllib.request import urlopen |
|
|
|
|
|
from urllib.error import URLError, HTTPError |
|
|
|
|
|
from urllib.parse import urlencode |
|
|
|
|
|
from urllib.parse import urlparse, urlunparse |
|
|
|
|
|
except ImportError: |
|
|
|
|
|
# python3 |
|
|
|
|
|
from urllib.parse import urlparse, urlunparse, urlencode, quote |
|
|
|
|
|
from urllib.request import urlopen, URLError, HTTPError |
|
|
|
|
|
|
|
|
|
|
|
from jinja2 import FileSystemLoader, Environment |
|
|
from jinja2 import FileSystemLoader, Environment |
|
|
from etherpump.commands.common import * |
|
|
from etherpump.commands.common import * |
|
@ -25,7 +17,7 @@ import dateutil.parser |
|
|
publication: |
|
|
publication: |
|
|
Generate a single document from etherpumps using a template. |
|
|
Generate a single document from etherpumps using a template. |
|
|
|
|
|
|
|
|
Built-in templates: publication.html |
|
|
Built-in templates: publication.html |
|
|
|
|
|
|
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
@ -118,7 +110,7 @@ def main (args): |
|
|
pg.add_argument("--prev", default=None, help="prev link, default: None") |
|
|
pg.add_argument("--prev", default=None, help="prev link, default: None") |
|
|
|
|
|
|
|
|
args = p.parse_args(args) |
|
|
args = p.parse_args(args) |
|
|
|
|
|
|
|
|
tmpath = args.templatepath |
|
|
tmpath = args.templatepath |
|
|
# Default path for template is the built-in data/templates |
|
|
# Default path for template is the built-in data/templates |
|
|
if tmpath == None: |
|
|
if tmpath == None: |
|
@ -155,11 +147,11 @@ def main (args): |
|
|
ret['versions'] = [wrappath(x) for x in paths] |
|
|
ret['versions'] = [wrappath(x) for x in paths] |
|
|
lastedited = None |
|
|
lastedited = None |
|
|
for p in paths: |
|
|
for p in paths: |
|
|
mtime = os.stat(p).st_mtime |
|
|
mtime = os.stat(p).st_mtime |
|
|
if lastedited == None or mtime > lastedited: |
|
|
if lastedited == None or mtime > lastedited: |
|
|
lastedited = mtime |
|
|
lastedited = mtime |
|
|
ret["lastedited_iso"] = datetime.fromtimestamp(lastedited).strftime("%Y-%m-%dT%H:%M:%S") |
|
|
ret["lastedited_iso"] = datetime.fromtimestamp(lastedited).strftime("%Y-%m-%dT%H:%M:%S") |
|
|
ret["lastedited_raw"] = mtime |
|
|
ret["lastedited_raw"] = mtime |
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
def loadmeta(p): |
|
|
def loadmeta(p): |
|
@ -225,7 +217,7 @@ def main (args): |
|
|
if p: |
|
|
if p: |
|
|
if not has_version(p, x): |
|
|
if not has_version(p, x): |
|
|
print ("Grouping file {0} with pad {1}".format(x, p['padid']), file=sys.stderr) |
|
|
print ("Grouping file {0} with pad {1}".format(x, p['padid']), file=sys.stderr) |
|
|
p['versions'].append(wrappath(x)) |
|
|
p['versions'].append(wrappath(x)) |
|
|
else: |
|
|
else: |
|
|
print ("Skipping existing version {0} ({1})...".format(x, p['padid']), file=sys.stderr) |
|
|
print ("Skipping existing version {0} ({1})...".format(x, p['padid']), file=sys.stderr) |
|
|
removelist.append(x) |
|
|
removelist.append(x) |
|
@ -263,7 +255,7 @@ def main (args): |
|
|
elif args.order == "custom": |
|
|
elif args.order == "custom": |
|
|
|
|
|
|
|
|
# TODO: make this list non-static, but a variable that can be given from the CLI |
|
|
# TODO: make this list non-static, but a variable that can be given from the CLI |
|
|
|
|
|
|
|
|
customorder = [ |
|
|
customorder = [ |
|
|
'nooo.relearn.preamble', |
|
|
'nooo.relearn.preamble', |
|
|
'nooo.relearn.activating.the.archive', |
|
|
'nooo.relearn.activating.the.archive', |
|
|