/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/prepare_for_latex.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python3
 
1
#!/usr/bin/python
2
2
#
3
3
# Modify reStructuredText 'image' directives by adding a percentage 'width'
4
4
# attribute so that the images are scaled to fit on the page when the document
35
35
 
36
36
verbose = False
37
37
 
38
 
IMAGE_DIRECTIVE_PATTERN = re.compile(u'^..\\s+image::\\s+(.*)\\`\\s+$')
39
 
DIRECTIVE_ELEMENT_PATTERN = re.compile(u'^\\s+:[^:]+:\\s+')
 
38
IMAGE_DIRECTIVE_PATTERN = re.compile(ur'^..\s+image::\s+(.*)\s+$')
 
39
DIRECTIVE_ELEMENT_PATTERN = re.compile(ur'^\s+:[^:]+:\s+')
40
40
 
41
41
class Converter(object):
42
42
    def __init__(self, srcdir, destdir):
94
94
    def replace_extension(self, path, newext):
95
95
        if path.endswith(newext):
96
96
            raise Exception("File '" + path + "' already has extension '"
97
 
                            + newext + "'")
 
97
                            + newext +"'")
98
98
        dot = path.rfind('.')
99
99
        if dot == -1:
100
100
            return path + newext