1.1 --- a/convert.py Tue Jul 24 23:36:13 2018 +0200
1.2 +++ b/convert.py Thu Jul 26 16:33:37 2018 +0200
1.3 @@ -10,6 +10,7 @@
1.4
1.5 l = filenames = []
1.6 formats = []
1.7 + pagenames = []
1.8 tree = False
1.9 macros = False
1.10
1.11 @@ -25,12 +26,18 @@
1.12 elif arg == "--macros":
1.13 macros = True
1.14
1.15 - # Switch to collecting formats
1.16 + # Switch to collecting formats.
1.17
1.18 elif arg == "--format":
1.19 l = formats
1.20 continue
1.21
1.22 + # Switch to collecting page names.
1.23 +
1.24 + elif arg == "--pagename":
1.25 + l = pagenames
1.26 + continue
1.27 +
1.28 # Collect options and arguments.
1.29
1.30 else:
1.31 @@ -40,7 +47,12 @@
1.32
1.33 l = filenames
1.34
1.35 + format = formats and formats[0] or "html"
1.36 +
1.37 + # Derive the page name from the filename if not specified.
1.38 +
1.39 filename = filenames[0]
1.40 + pagename = pagenames and pagenames[0] or split(filename)[-1]
1.41
1.42 f = open(filename)
1.43 try:
1.44 @@ -53,7 +65,7 @@
1.45 if tree:
1.46 print d.prettyprint()
1.47 else:
1.48 - format = formats and formats[0] or "html"
1.49 + p.translate_links(format, pagename)
1.50 print serialise(d, get_serialiser(format))
1.51 finally:
1.52 f.close()