? i18n.patch Index: DocumentClass.py =================================================================== RCS file: /var/lib/cvs/nkm/zope/StructuredText/DocumentClass.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- DocumentClass.py 15 Apr 2003 15:13:52 -0000 1.1.1.1 +++ DocumentClass.py 15 Apr 2003 15:16:25 -0000 1.2 @@ -307,7 +307,7 @@ 'doc_xref', ] - def __call__(self, doc): + def __call__(self, doc): if type(doc) in StringTypes: doc=ST.StructuredText(doc) doc.setSubparagraphs(self.color_paragraphs( @@ -807,7 +807,9 @@ def doc_emphasize( self, s, - expr = re.compile(r'\*([%s%s%s\s]+?)\*' % (letters, digits, strongem_punc)).search + # i18nal variant + expr = re.compile(r'\*((?:\w|[%s\s])+?)\*' % (strongem_punc), re.U).search + #expr = re.compile(r'\*([%s%s%s\s]+?)\*' % (letters, digits, strongem_punc)).search #expr = re.compile(r'\s*\*([ \n\r%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search # old expr, inconsistent punctuation ): @@ -853,7 +855,7 @@ def doc_underline(self, s, - expr=re.compile(r'_([%s%s%s\s]+)_([\s%s]|$)' % (letters, digits, under_punc,phrase_delimiters)).search): + expr=re.compile(r'_((?:\w|[%s\s])+)_([\s%s]|$)' % (under_punc,phrase_delimiters), re.U).search): result = expr(s) if result: @@ -867,7 +869,7 @@ def doc_strong(self, s, - expr = re.compile(r'\*\*([%s%s%s\s]+?)\*\*' % (letters, digits, strongem_punc)).search + expr = re.compile(r'\*\*((?:\w|[%s%s\s])+?)\*\*' % (digits, strongem_punc), re.U).search #expr = re.compile(r'\s*\*\*([ \n\r%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*\*(?!\*|-)' % letters).search, # old expr, inconsistent punc, failed to cross newlines. ): @@ -879,7 +881,7 @@ return None ## Some constants to make the doc_href() regex easier to read. - _DQUOTEDTEXT = r'("[ %s0-9\n\r%s]+")' % (letters,dbl_quoted_punc) ## double quoted text + _DQUOTEDTEXT = r'("(?:\w|[ 0-9\n\r%s])+")' % (dbl_quoted_punc) ## double quoted text _ABSOLUTE_URL=r'((http|https|ftp|mailto|file|about)[:/]+?[%s0-9_\@\.\,\?\!\/\:\;\-\#\~\=\&\%%\+]+)' % letters _ABS_AND_RELATIVE_URL=r'([%s0-9_\@\.\,\?\!\/\:\;\-\#\~\=\&\%%\+]+)' % letters @@ -887,12 +889,12 @@ def doc_href1(self, s, - expr=re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES).search + expr=re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES, re.U).search ): return self.doc_href(s, expr) def doc_href2(self, s, - expr=re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES).search + expr=re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES, re.U).search ): return self.doc_href(s, expr) Index: DocumentWithImages.py =================================================================== RCS file: /var/lib/cvs/nkm/zope/StructuredText/DocumentWithImages.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- DocumentWithImages.py 15 Apr 2003 15:13:52 -0000 1.1.1.1 +++ DocumentWithImages.py 15 Apr 2003 15:16:25 -0000 1.2 @@ -30,12 +30,12 @@ def doc_img( self, s, - expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\_\-.:/;,\n\~]+)').search, - expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\_\-.:/;,\n\~]+):([a-zA-Z0-9_\-.:/;,\n\~]+)').search + expr1=re.compile('\"((?:\w|[ *.:/;,\-\n\~])+)\":img:([a-zA-Z0-9\_\-.:/;,\n\~]+)', re.U).search, + expr2=re.compile('\"((?:\w|[ *.:/;,\-\n\~])+)\":img:([a-zA-Z0-9\_\-.:/;,\n\~]+):([a-zA-Z0-9_\-.:/;,\n\~]+)', re.U).search ): - r = expr2(s) if r: + # Warning: the regex are getting confused when the string after :img: # is an URL containing ":" (Collector #2276) Index: HTMLClass.py =================================================================== RCS file: /var/lib/cvs/nkm/zope/StructuredText/HTMLClass.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- HTMLClass.py 15 Apr 2003 15:13:52 -0000 1.1.1.1 +++ HTMLClass.py 15 Apr 2003 15:16:25 -0000 1.2 @@ -48,7 +48,10 @@ r=[] self.header = header self.dispatch(doc, level-1, r.append) - return ''.join(r) + html = ''.join(r) + if type(html) == type(u''): + html = html.encode('utf-8') + return html def _text(self, doc, level, output): output(doc.getNodeValue()) Index: ST.py =================================================================== RCS file: /var/lib/cvs/nkm/zope/StructuredText/ST.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ST.py 15 Apr 2003 15:13:53 -0000 1.1.1.1 +++ ST.py 15 Apr 2003 15:16:25 -0000 1.2 @@ -115,6 +115,9 @@ Structure => [paragraph,[sub-paragraphs]] """ + if type(paragraphs) == type(''): + paragraphs = unicode(paragraphs, 'utf-8') + currentlevel = 0 currentindent = 0 levels = {0:0}