Compare commits
2 Commits
master
...
integral-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fa929af41 | ||
|
|
33a12cca03 |
@ -4,9 +4,8 @@ pppadump
|
|||||||
|
|
||||||
Bunch of scripts to extract documents from an [etherpad](http://etherpad.org/) instance and produce templated static files.
|
Bunch of scripts to extract documents from an [etherpad](http://etherpad.org/) instance and produce templated static files.
|
||||||
|
|
||||||
Forked from [constant](https://constantvzw.org/site/)'s [active archives](http://activearchives.org/wiki/Main_Page) [etherdump](https://gitlab.constantvzw.org/aa/etherdump) mixed with logic devised for [varia](https://varia.zone)'s [etherpump](https://git.vvvvvvaria.org/varia/etherpump) project.
|
Forked from [constant](https://constantvzw.org/site/)'s [active archives](http://activearchives.org/wiki/Main_Page) [etherdump](https://gitlab.constantvzw.org/aa/etherdump) mixed with logic devised for [varia](https://varia.zone)'s [etherpump](https://git.vvvvvvaria.org/varia/etherpump) project
|
||||||
|
|
||||||
It's all about \_\_MAGICWRORDS__ 🪄✨
|
|
||||||
|
|
||||||
|
|
||||||
Requirements / dependencies
|
Requirements / dependencies
|
||||||
|
|||||||
@ -98,8 +98,6 @@ def main (args):
|
|||||||
|
|
||||||
p.add_argument("--files", default=False, action="store_true", help="include files (experimental)")
|
p.add_argument("--files", default=False, action="store_true", help="include files (experimental)")
|
||||||
|
|
||||||
p.add_argument("--filebased", default=False, action="store_true", help="uses (reconstructed) urls instead of file paths")
|
|
||||||
|
|
||||||
pg = p.add_argument_group('template variables')
|
pg = p.add_argument_group('template variables')
|
||||||
pg.add_argument("--feedurl", default="feed.xml", help="rss: to use as feeds own (self) link, default: feed.xml")
|
pg.add_argument("--feedurl", default="feed.xml", help="rss: to use as feeds own (self) link, default: feed.xml")
|
||||||
pg.add_argument("--siteurl", default=None, help="rss: to use as channel's site link, default: the etherpad url")
|
pg.add_argument("--siteurl", default=None, help="rss: to use as channel's site link, default: the etherpad url")
|
||||||
@ -294,53 +292,29 @@ def main (args):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Below is somehow a mess since one the one hand I'm trying to keep the file based publiching
|
# Not sure this goes here but fixing relpaths with output is quite nice...
|
||||||
# ethos while my setup is not really (reverse proxy, etc.)
|
|
||||||
# Fix (1): settings.json has indexurl which stands for the base URL
|
|
||||||
# Fix (2): added argument <p.add_argument("--filebased", default=False, action="store_true", help="uses (reconstructed) urls instead of file paths")>
|
|
||||||
|
|
||||||
if args.output:
|
if args.output:
|
||||||
|
outpath = str(Path(args.output).parent)
|
||||||
if args.filebased:
|
|
||||||
|
|
||||||
# work with paths
|
|
||||||
|
|
||||||
outpath = 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:
|
||||||
v["path"] = os.path.join(os.path.relpath(vpath.parent, outpath), vpath.name)
|
# 2 types (pathlib or os.path)
|
||||||
|
# v["path"] = vpath.parent.relative_to(outpath).joinpath(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?
|
||||||
|
# puttting this here since templates are using url...
|
||||||
v["url"] = v["path"]
|
v["url"] = v["path"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
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
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
# work with URLs
|
|
||||||
|
|
||||||
indexurl = info["indexurl"]
|
|
||||||
outpath = Path(args.output).parent
|
|
||||||
|
|
||||||
for v in p["versions"]:
|
|
||||||
|
|
||||||
if v["type"] != "pad":
|
|
||||||
|
|
||||||
vpath = Path(v["url"])
|
|
||||||
|
|
||||||
# strip output dir....
|
|
||||||
relpath = Path(*vpath.parts[1:])
|
|
||||||
|
|
||||||
v["url"] = os.path.join(indexurl, relpath.as_posix())
|
|
||||||
|
|
||||||
|
|
||||||
if args.output:
|
if args.output:
|
||||||
|
|||||||
@ -73,7 +73,6 @@ def main(args):
|
|||||||
p.add_argument("arg", nargs="*", default=[], help="optional positional args: path etherpadurl")
|
p.add_argument("arg", nargs="*", default=[], help="optional positional args: path etherpadurl")
|
||||||
p.add_argument("--path", default=None, help="path to initialize")
|
p.add_argument("--path", default=None, help="path to initialize")
|
||||||
p.add_argument("--padurl", default=None, help="")
|
p.add_argument("--padurl", default=None, help="")
|
||||||
p.add_argument("--indexurl", default=None, help="")
|
|
||||||
p.add_argument("--apikey", default=None, help="")
|
p.add_argument("--apikey", default=None, help="")
|
||||||
p.add_argument("--verbose", default=False, action="store_true", help="")
|
p.add_argument("--verbose", default=False, action="store_true", help="")
|
||||||
p.add_argument("--reinit", default=False, action="store_true", help="")
|
p.add_argument("--reinit", default=False, action="store_true", help="")
|
||||||
@ -115,15 +114,6 @@ def main(args):
|
|||||||
break
|
break
|
||||||
apiurl = input("Please type the URL of the etherpad: ").strip()
|
apiurl = input("Please type the URL of the etherpad: ").strip()
|
||||||
padinfo["apiurl"] = apiurl
|
padinfo["apiurl"] = apiurl
|
||||||
|
|
||||||
|
|
||||||
indexurl = args.indexurl
|
|
||||||
while True:
|
|
||||||
if indexurl:
|
|
||||||
break
|
|
||||||
indexurl = input("Please type the URL of the index to be generated (i.e. should differ from padurl): ").strip()
|
|
||||||
padinfo["indexurl"] = indexurl
|
|
||||||
|
|
||||||
apikey = args.apikey
|
apikey = args.apikey
|
||||||
while True:
|
while True:
|
||||||
if apikey:
|
if apikey:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user