Compare commits
2 Commits
master
...
integral-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fa929af41 | ||
|
|
33a12cca03 |
@ -275,7 +275,7 @@ def main (args):
|
|||||||
|
|
||||||
if "text" in versions_by_type:
|
if "text" in versions_by_type:
|
||||||
try:
|
try:
|
||||||
with open (versions_by_type["text"]["path"]) as f:
|
with open (versions_by_type["text"]["path"], encoding="utf-8") as f:
|
||||||
p["text"] = f.read()
|
p["text"] = f.read()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
p['text'] = ''
|
p['text'] = ''
|
||||||
@ -294,14 +294,13 @@ def main (args):
|
|||||||
|
|
||||||
# Not sure this goes here but fixing relpaths with output is quite nice...
|
# Not sure this goes here but fixing relpaths with output is quite nice...
|
||||||
if args.output:
|
if args.output:
|
||||||
outpath = Path(args.output).parent
|
outpath = str(Path(args.output).parent)
|
||||||
for v in p["versions"]:
|
for v in p["versions"]:
|
||||||
if v["type"] != "pad":
|
if v["type"] != "pad":
|
||||||
vpath = Path(v["path"])
|
|
||||||
try:
|
try:
|
||||||
# 2 types (pathlib or os.path)
|
# 2 types (pathlib or os.path)
|
||||||
# v["path"] = vpath.parent.relative_to(outpath).joinpath(vpath.name)
|
# v["path"] = vpath.parent.relative_to(outpath).joinpath(vpath.name)
|
||||||
v["path"] = os.path.join(os.path.relpath(vpath.parent, outpath), vpath.name)
|
v["path"] = os.path.relpath(v["path"], outpath)
|
||||||
|
|
||||||
# path or url??? if it's a file based publishing ethos, it should be path non?
|
# path or url??? if it's a file based publishing ethos, it should be path non?
|
||||||
# puttting this here since templates are using url...
|
# puttting this here since templates are using url...
|
||||||
@ -310,9 +309,8 @@ def main (args):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if not p["link"].startswith("http"):
|
if not p["link"].startswith("http"):
|
||||||
vpath = Path(p["link"])
|
|
||||||
try:
|
try:
|
||||||
p["link"] = os.path.join(os.path.relpath(vpath.parent, outpath), vpath.name)
|
p["link"] = os.path.relpath(p["link"], outpath)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -320,7 +318,7 @@ def main (args):
|
|||||||
|
|
||||||
|
|
||||||
if args.output:
|
if args.output:
|
||||||
with open(args.output, "w") as f:
|
with open(args.output, "w", encoding="utf-8") as f:
|
||||||
print (template.render(vars(args)), file=f)
|
print (template.render(vars(args)), file=f)
|
||||||
else:
|
else:
|
||||||
print (template.render(vars(args)))
|
print (template.render(vars(args)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user