diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-20 01:01:00 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-02-20 09:51:12 +0100 |
commit | 035f934d7a798e97bf0213a5d42a3d511132f03d (patch) | |
tree | 89aa6efdc86864ce479cddca6b9c4ba523c2754a /src/3rdparty/freetype/src/tools/docmaker/content.py | |
parent | f4cc23cffbe3005f0a522cac938695e87ecd6407 (diff) | |
parent | da4ab444ffac37514435364d4d3f0ad59d4f9bc3 (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
Added tests/auto/testlib/selftests/expected_crashes_5.txt to work
round the output of the crashes test (which exercises UB, see
QTBUG-73903) being truncated on one test platform.
Change-Id: I9cd3f2639b4e50c3c4513e14629a40bdca8f8273
Diffstat (limited to 'src/3rdparty/freetype/src/tools/docmaker/content.py')
-rw-r--r-- | src/3rdparty/freetype/src/tools/docmaker/content.py | 66 |
1 files changed, 50 insertions, 16 deletions
diff --git a/src/3rdparty/freetype/src/tools/docmaker/content.py b/src/3rdparty/freetype/src/tools/docmaker/content.py index 1961878a7d..198780aee4 100644 --- a/src/3rdparty/freetype/src/tools/docmaker/content.py +++ b/src/3rdparty/freetype/src/tools/docmaker/content.py @@ -3,7 +3,7 @@ # # Parse comment blocks to build content blocks (library file). # -# Copyright 2002-2015 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, @@ -46,9 +46,26 @@ re_code_end = re.compile( r"(\s*)}\s*$" ) # -# A regular expression to isolate identifiers from other text. +# A regular expression to isolate identifiers from other text. Two syntax +# forms are supported: # -re_identifier = re.compile( r'((?:\w|-)*)' ) +# <name> +# <name>[<id>] +# +# where both `<name>' and `<id>' consist of alphanumeric characters, `_', +# and `-'. Use `<id>' if there are multiple, valid `<name>' entries; in the +# index, `<id>' will be appended in parentheses. +# +# For example, +# +# stem_darkening[autofit] +# +# becomes `stem_darkening (autofit)' in the index. +# +re_identifier = re.compile( r""" + ((?:\w|-)+ + (?:\[(?:\w|-)+\])?) + """, re.VERBOSE ) # @@ -92,7 +109,7 @@ class DocCode: def dump( self, prefix = "", width = 60 ): lines = self.dump_lines( 0, width ) for l in lines: - print prefix + l + print( prefix + l ) def dump_lines( self, margin = 0, width = 60 ): result = [] @@ -122,7 +139,7 @@ class DocPara: def dump( self, prefix = "", width = 60 ): lines = self.dump_lines( 0, width ) for l in lines: - print prefix + l + print( prefix + l ) def dump_lines( self, margin = 0, width = 60 ): cur = "" # current line @@ -226,13 +243,13 @@ class DocField: def dump( self, prefix = "" ): if self.field: - print prefix + self.field + " ::" + print( prefix + self.field + " ::" ) prefix = prefix + "----" first = 1 for p in self.items: if not first: - print "" + print( "" ) p.dump( prefix ) first = 0 @@ -313,10 +330,10 @@ class DocMarkup: return None def dump( self, margin ): - print " " * margin + "<" + self.tag + ">" + print( " " * margin + "<" + self.tag + ">" ) for f in self.fields: f.dump( " " ) - print " " * margin + "</" + self.tag + ">" + print( " " * margin + "</" + self.tag + ">" ) ################################################################ @@ -436,15 +453,32 @@ class ContentProcessor: markup_lines = [] first = 1 + margin = -1 + in_code = 0 + for line in content: - found = None - for t in re_markup_tags: - m = t.match( line ) + if in_code: + m = re_code_end.match( line ) + if m and len( m.group( 1 ) ) <= margin: + in_code = 0 + margin = -1 + else: + m = re_code_start.match( line ) if m: - found = string.lower( m.group( 1 ) ) - prefix = len( m.group( 0 ) ) - line = " " * prefix + line[prefix:] # remove markup from line - break + in_code = 1 + margin = len( m.group( 1 ) ) + + found = None + + if not in_code: + for t in re_markup_tags: + m = t.match( line ) + if m: + found = string.lower( m.group( 1 ) ) + prefix = len( m.group( 0 ) ) + # remove markup from line + line = " " * prefix + line[prefix:] + break # is it the start of a new markup section ? if found: |