diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2010-08-09 12:18:58 +1200 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2010-08-09 12:18:58 +1200 |
commit | cdfc8500c64fb63c5a3e35bd70c943aefed84a8a (patch) | |
tree | 8c73349e808d7572c6c525d533df713241ccb720 | |
parent | 172acffe9f545d9204c152082bb8e20ccbd64640 (diff) | |
download | asciidoc-cdfc8500c64fb63c5a3e35bd70c943aefed84a8a.tar.gz |
Allow multiple a2x comment lines and relax white space requirements.
-rwxr-xr-x | a2x.py | 14 | ||||
-rw-r--r-- | doc/a2x.1.txt | 17 |
2 files changed, 19 insertions, 12 deletions
@@ -288,11 +288,11 @@ def get_source_options(asciidoc_file): ''' PREFIX = '// a2x:' - def parse_line(): - # Parse options in line to result sequence. + def parse_options(): + # Parse options to result sequence. inquotes = False opt = '' - for c in line: + for c in options: if c == '"': if inquotes: result.append(opt) @@ -313,10 +313,12 @@ def get_source_options(asciidoc_file): result = [] if os.path.isfile(asciidoc_file): + options = '' for line in open(asciidoc_file): - if line.startswith(PREFIX): - line = line[len(PREFIX):].strip() - parse_line() + mo = re.search(r'^//\s*a2x:', line) + if mo: + options += ' ' + line[mo.end():].strip() + parse_options() return result diff --git a/doc/a2x.1.txt b/doc/a2x.1.txt index c9e7af2..6d93cea 100644 --- a/doc/a2x.1.txt +++ b/doc/a2x.1.txt @@ -105,12 +105,17 @@ OPTIONS Additional 'dblatex(1)' options. Options can also be set in the AsciiDoc source file. If 'FILE' -contains a line beginning with *// a2x:* then the remainder of the -line will be treated as 'a2x' command-line options. Actual -command-line options take precedence over options set in the source -file. Example: - - // a2x: -dbook --dblatex-opts "-P latex.output.revhistory=0" +contains a comment line beginning with *// a2x:* then the remainder of +the line will be treated as 'a2x' command-line options. Options +spanning multiple such comment lines will be concatenated. Zero or +more white space characters can appear between the leading *//* and +*a2x:*. Command-line options take precedence over options set in the +source file. Example usage: + + // a2x default options. + // a2x: -dbook --epubcheck + // Suppress revision history in dblatex outputs. + // a2x: --dblatex-opts "-P latex.output.revhistory=0" OUTPUT FILES |