unicode stx patch Was: [python] Kde najdu navod pro praci se svym obsahem na www.py.cz?

Ondřej Surý sury.ondrej na globe.cz
Středa Srpen 20 15:38:29 CEST 2003


On Wed, 2003-08-20 at 15:37, ViNiL wrote:

> Bohuzel, Cestina zpusobuje nekdy problemy :-( Cekam porad na nejakou 
> patch a ta nejde a nejde ;-)

Asi spatne hledate...

O.

-- 
Ondřej Surý - co/CTO
---------------------------------------------------
Globe Internet, s.r.o.       -      http://globe.cz
Pláničkova 1, 162 00 Praha 6 - http://mapa.globe.cz
Tel.: +420 2 35365000        -      info na servery.cz
------------- další část ---------------
? i18n-0.9.9.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.2.1
diff -r1.1.1.1 -r1.2.2.1
310c310
<     def __call__(self, doc):
---
>     def __call__(self, doc): 
792c792
<         expr = re.compile(r"(\W+|^)'([%s%s%s\s]+)'([%s]+|$)" % (letters, digits, literal_punc, phrase_delimiters)).search,):
---
>         expr = re.compile(r"(\W+|^)'((?:\w|[%s%s\s])+)'([%s]+|$)" % (digits, literal_punc, phrase_delimiters), re.U).search,):
810c810,812
<         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
856c858
<                       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):
870c872
<                    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
882c884
<     _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
890c892
<                   expr=re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES).search
---
>                   expr=re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES, re.U).search
895c897
<                   expr=re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES).search
---
>                   expr=re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES, re.U).search
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 -r1.1.1.1 -r1.2
33,34c33,34
<         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
36d35
< 
38a38
> 
Index: HTMLClass.py
===================================================================
RCS file: /var/lib/cvs/nkm/zope/StructuredText/HTMLClass.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2.2.2
diff -r1.1.1.1 -r1.2.2.2
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 -r1.1.1.1 -r1.2
117a118,120
>     if type(paragraphs) == type(''):
>         paragraphs = unicode(paragraphs, 'utf-8')
> 
Index: tests/testStructuredText.py
===================================================================
RCS file: /var/lib/cvs/nkm/zope/StructuredText/tests/testStructuredText.py,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -r1.1.1.1 -r1.1.1.1.2.1
213,219c213,223
<     def XXXtestUnicodeContent(self):
<         # This fails because ST uses the default locale to get "letters"
<         # whereas it should use \w+ and re.U if the string is Unicode.
<         #self._test(u"h\xe9 **y\xe9** xx",
<         #           u"h\xe9 <strong>y\xe9</strong> xx")
<         pass
< 
---
>     def testUnicodeContent(self):
>         self._test(u"h\xe9 **y\xe9** xx",
>                    u"h\xe9 <strong>y\xe9</strong> xx")
>         self._test(u"h\xe9 *y\xe9* xx",
>                    u"h\xe9 <em>y\xe9</em> xx")
>         self._test(u"h\xe9 _y\xe9_ xx",
>                    u"h\xe9 <u>y\xe9</u> xx")
>         self._test(u"h\xe9 'y\xe9' xx",
>                    u"h\xe9 <code>y\xe9</code> xx")
>         self._test(u"h\xe9 \"y\xe9\":http://zope.org xx",
>                    u"h\xe9 <a href=\"http://zope.org\">y\xe9</a> xx")


Další informace o konferenci Python