1.1 --- a/moinconvert Fri Jun 30 00:40:39 2023 +0200
1.2 +++ b/moinconvert Fri Jun 30 12:52:37 2023 +0200
1.3 @@ -36,6 +36,10 @@
1.4
1.5 To indicate pagenames within an input directory, omit any --pagename flags."""
1.6
1.7 +message_tree_format_usage = """\
1.8 +The --tree and --format options cannot be used together since the --tree option
1.9 +indicates use of the "pretty" format."""
1.10 +
1.11
1.12
1.13 # Options management.
1.14 @@ -152,6 +156,9 @@
1.15 # Detect tree output.
1.16
1.17 elif arg == "--tree":
1.18 + if formats:
1.19 + print >>sys.stderr, message_tree_format_usage
1.20 + sys.exit(1)
1.21 tree = True
1.22
1.23 # Options with following arguments.
1.24 @@ -171,6 +178,9 @@
1.25 # Switch to collecting formats.
1.26
1.27 elif arg == "--format":
1.28 + if tree:
1.29 + print >>sys.stderr, message_tree_format_usage
1.30 + sys.exit(1)
1.31 l = formats
1.32 continue
1.33
1.34 @@ -254,7 +264,7 @@
1.35
1.36 l = filenames
1.37
1.38 - format = formats and formats[0] or "html"
1.39 + format = tree and "pretty" or formats and formats[0] or "html"
1.40 input_dir = getvalue(input_dirs)
1.41 output_dir = getvalue(output_dirs)
1.42
1.43 @@ -333,19 +343,17 @@
1.44
1.45 p.update_metadata(metadata)
1.46
1.47 - # Show a document tree for debugging purposes, if requested.
1.48 -
1.49 - if tree:
1.50 - print d.prettyprint()
1.51 - continue
1.52 -
1.53 - # Otherwise, serialise the document.
1.54 -
1.55 # Obtain a serialiser using the configuration.
1.56
1.57 serialiser = make_serialiser(metadata)
1.58 outtext = serialise(d, serialiser)
1.59
1.60 + # Show a document tree for debugging purposes, if requested.
1.61 +
1.62 + if tree:
1.63 + print outtext
1.64 + continue
1.65 +
1.66 # With a theme, apply it to the text.
1.67
1.68 if theme: