aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdivergence17
1 files changed, 11 insertions, 6 deletions
diff --git a/divergence b/divergence
index 9351e45..615c488 100755
--- a/divergence
+++ b/divergence
@@ -18,12 +18,15 @@ import subprocess
import logging as log
+DEFAULT_HEADER = """This page was generated automatically from Markdown using
+the 'divergence' tool. Edits will need to be merged manually."""
+
class DivergenceProgram:
def __init__(self, user, password, url, space,
force_update=False,
include_toc=False,
- include_header=True):
+ header=DEFAULT_HEADER):
self.api = requests.Session()
self.api.auth = (user, password)
self.api.headers.update({'Content-Type': 'application/json'})
@@ -31,7 +34,7 @@ class DivergenceProgram:
self.default_space = space
self.force_update = force_update
self.include_toc = include_toc
- self.include_header = include_header
+ self.header = header
# TODO: clean up this code duplication... use pandoc data directory
# instead?
self.pandoc_helper_path = None
@@ -149,11 +152,10 @@ class DivergenceProgram:
<ac:parameter ac:name="minLevel">1</ac:parameter>
<ac:parameter ac:name="maxLevel">3</ac:parameter>
</ac:structured-macro>""" + body
- if self.include_header:
+ if self.header:
body = """<ac:structured-macro ac:name="info">
<ac:rich-text-body>
- <p>This page was generated automatically from Markdown using the
- 'divergence' tool. Edits will need to be merged manually. </p>
+ <p>""" + self.header + """</p>
</ac:rich-text-body>
</ac:structured-macro>\n""" + body
return body
@@ -225,6 +227,9 @@ required environment variables:
parser.add_argument("-f", "--force",
action='store_true',
help='Forces an update even if we think nothing has changed')
+ parser.add_argument("--header",
+ action='store',
+ help='Specify header to insert into the confluence document')
parser.add_argument("--no-header",
action='store_true',
help='Disables inserting disclaimer headers into the confluence document')
@@ -267,7 +272,7 @@ required environment variables:
dp = DivergenceProgram(user,password, url, args.space_key,
force_update=args.force,
- include_header=not args.no_header,
+ header=args.header or (None if args.no_header else DEFAULT_HEADER),
include_toc=args.toc)
dp.run(args.FILE)