aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/tools/docmaker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-06-26 09:46:14 +0200
committermarha <marha@users.sourceforge.net>2014-06-26 09:52:19 +0200
commitfba3b6d1979c1d1ad0d56d46fc2d787f111c07fb (patch)
treea5d678a6e7030ab8114f97ba34ae2f3c37c0c4b3 /freetype/src/tools/docmaker
parentc30d5eefc96925b4bef781806c7a0114eca1b8e0 (diff)
downloadvcxsrv-fba3b6d1979c1d1ad0d56d46fc2d787f111c07fb.tar.gz
vcxsrv-fba3b6d1979c1d1ad0d56d46fc2d787f111c07fb.tar.bz2
vcxsrv-fba3b6d1979c1d1ad0d56d46fc2d787f111c07fb.zip
Updated to freetype 2.5.3
Diffstat (limited to 'freetype/src/tools/docmaker')
-rw-r--r--freetype/src/tools/docmaker/content.py19
-rw-r--r--freetype/src/tools/docmaker/docmaker.py4
-rw-r--r--freetype/src/tools/docmaker/sources.py40
-rw-r--r--freetype/src/tools/docmaker/tohtml.py35
4 files changed, 45 insertions, 53 deletions
diff --git a/freetype/src/tools/docmaker/content.py b/freetype/src/tools/docmaker/content.py
index 26087f7b8..98025e67e 100644
--- a/freetype/src/tools/docmaker/content.py
+++ b/freetype/src/tools/docmaker/content.py
@@ -1,4 +1,4 @@
-# Content (c) 2002, 2004, 2006-2009, 2012
+# Content (c) 2002, 2004, 2006-2009, 2012, 2013
# David Turner <david@freetype.org>
#
# This file contains routines used to parse the content of documentation
@@ -268,15 +268,6 @@ class DocMarkup:
except:
return None
- def get_start( self ):
- try:
- result = ""
- for word in self.fields[0].items[0].words:
- result = result + " " + word
- return result[1:]
- except:
- return "ERROR"
-
def dump( self, margin ):
print " " * margin + "<" + self.tag + ">"
for f in self.fields:
@@ -555,14 +546,6 @@ class DocBlock:
return m
return None
- def get_markup_name( self, tag_name ):
- """return the name of a given primary markup in a block"""
- try:
- m = self.get_markup( tag_name )
- return m.get_name()
- except:
- return None
-
def get_markup_words( self, tag_name ):
try:
m = self.get_markup( tag_name )
diff --git a/freetype/src/tools/docmaker/docmaker.py b/freetype/src/tools/docmaker/docmaker.py
index 1d9de9fbf..bf75c5d5f 100644
--- a/freetype/src/tools/docmaker/docmaker.py
+++ b/freetype/src/tools/docmaker/docmaker.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
#
-# DocMaker (c) 2002, 2004, 2008 David Turner <david@freetype.org>
+# DocMaker (c) 2002, 2004, 2008, 2013 David Turner <david@freetype.org>
#
-# This program is a re-write of the original DocMaker took used
+# This program is a re-write of the original DocMaker tool used
# to generate the API Reference of the FreeType font engine
# by converting in-source comments into structured HTML.
#
diff --git a/freetype/src/tools/docmaker/sources.py b/freetype/src/tools/docmaker/sources.py
index 490ba2506..dab834978 100644
--- a/freetype/src/tools/docmaker/sources.py
+++ b/freetype/src/tools/docmaker/sources.py
@@ -1,4 +1,4 @@
-# Sources (c) 2002-2004, 2006-2009, 2012
+# Sources (c) 2002-2004, 2006-2009, 2012, 2013
# David Turner <david@freetype.org>
#
#
@@ -132,7 +132,7 @@ re_markup_tags = [re_markup_tag1, re_markup_tag2]
#
# used to detect a cross-reference, after markup tags have been stripped
#
-re_crossref = re.compile( r'@((?:\w|-)*)(.*)' )
+re_crossref = re.compile( r'@((?:\w|-)*)(.*)' ) # @foo
#
# used to detect italic and bold styles in paragraph text
@@ -141,6 +141,42 @@ re_italic = re.compile( r"_(\w(\w|')*)_(.*)" ) # _italic_
re_bold = re.compile( r"\*(\w(\w|')*)\*(.*)" ) # *bold*
#
+# this regular expression code to identify an URL has been taken from
+#
+# http://mail.python.org/pipermail/tutor/2002-September/017228.html
+#
+# (with slight modifications)
+#
+
+urls = r'(?:https?|telnet|gopher|file|wais|ftp)'
+ltrs = r'\w'
+gunk = r'/#~:.?+=&%@!\-'
+punc = r'.:?\-'
+any = "%(ltrs)s%(gunk)s%(punc)s" % { 'ltrs' : ltrs,
+ 'gunk' : gunk,
+ 'punc' : punc }
+url = r"""
+ (
+ \b # start at word boundary
+ %(urls)s : # need resource and a colon
+ [%(any)s] +? # followed by one or more of any valid
+ # character, but be conservative and
+ # take only what you need to...
+ (?= # [look-ahead non-consumptive assertion]
+ [%(punc)s]* # either 0 or more punctuation
+ (?: # [non-grouping parentheses]
+ [^%(any)s] | $ # followed by a non-url char
+ # or end of the string
+ )
+ )
+ )
+ """ % {'urls' : urls,
+ 'any' : any,
+ 'punc' : punc }
+
+re_url = re.compile( url, re.VERBOSE | re.MULTILINE )
+
+#
# used to detect the end of commented source lines
#
re_source_sep = re.compile( r'\s*/\*\s*\*/' )
diff --git a/freetype/src/tools/docmaker/tohtml.py b/freetype/src/tools/docmaker/tohtml.py
index fffa12097..7944f1c99 100644
--- a/freetype/src/tools/docmaker/tohtml.py
+++ b/freetype/src/tools/docmaker/tohtml.py
@@ -1,4 +1,4 @@
-# ToHTML (c) 2002, 2003, 2005, 2006, 2007, 2008
+# ToHTML (c) 2002, 2003, 2005-2008, 2013
# David Turner <david@freetype.org>
from sources import *
@@ -175,25 +175,6 @@ def html_quote( line ):
return result
-# same as 'html_quote', but ignores left and right brackets
-def html_quote0( line ):
- return string.replace( line, "&", "&amp;" )
-
-
-def dump_html_code( lines, prefix = "" ):
- # clean the last empty lines
- l = len( self.lines )
- while l > 0 and string.strip( self.lines[l - 1] ) == "":
- l = l - 1
-
- # The code footer should be directly appended to the last code
- # line to avoid an additional blank line.
- print prefix + code_header,
- for line in self.lines[0 : l + 1]:
- print '\n' + prefix + html_quote( line ),
- print prefix + code_footer,
-
-
class HtmlFormatter( Formatter ):
@@ -242,16 +223,6 @@ class HtmlFormatter( Formatter ):
def make_block_url( self, block ):
return self.make_section_url( block.section ) + "#" + block.name
- def make_html_words( self, words ):
- """ convert a series of simple words into some HTML text """
- line = ""
- if words:
- line = html_quote( words[0] )
- for w in words[1:]:
- line = line + " " + html_quote( w )
-
- return line
-
def make_html_word( self, word ):
"""analyze a simple word to detect cross-references and styling"""
# look for cross-references
@@ -291,6 +262,8 @@ class HtmlFormatter( Formatter ):
line = self.make_html_word( words[0] )
for word in words[1:]:
line = line + " " + self.make_html_word( word )
+ # handle hyperlinks
+ line = re_url.sub( r'<a href="\1">\1</a>', line )
# convert `...' quotations into real left and right single quotes
line = re.sub( r"(^|\W)`(.*?)'(\W|$)", \
r'\1&lsquo;\2&rsquo;\3', \
@@ -549,7 +522,7 @@ class HtmlFormatter( Formatter ):
if block.source.filename.find( f ) >= 0:
header = self.headers[f] + ' (' + f + ')'
break;
-
+
# if not header:
# sys.stderr.write( \
# 'WARNING: No header macro for ' + block.source.filename + '.\n' )