Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
9ae055f8
Commit
9ae055f8
authored
Apr 20, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added locale support
parent
1843caf0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
lib/python/StructuredText/StructuredText.py
lib/python/StructuredText/StructuredText.py
+15
-9
No files found.
lib/python/StructuredText/StructuredText.py
View file @
9ae055f8
...
...
@@ -205,9 +205,11 @@ Special symbology is used to indicate special constructs:
'''
import
ts_regex
,
regex
import
ts_regex
import
regex
from
ts_regex
import
gsub
from
string
import
split
,
join
,
strip
,
find
import
string
def
untabify
(
aString
,
indent_tab
=
ts_regex
.
compile
(
'
\
(
\
n
\
|^
\
)
\
( *
\
)
\
t
'
).
search_group
,
...
...
@@ -366,8 +368,8 @@ class StructuredText:
aStructuredString = gsub(
'
\
"
\
([^
\
"
\
0
]
+
\
)
\
":' # title: <"
text
":>
+ ('
\
([-:
a
-zA-Z
0-9_,./?=@#~&]+%s
\
)
'
%
not_punctuation_or_whitespace
)
+ ('
\
([-:
%s
0
-9_,./?=@#~&]+%s
\
)
'
%
(string.letters,not_punctuation_or_whitespace)
)
+ optional_trailing_punctuation
+ trailing_space,
'<a href="
\\
2
">
\
\
1</a>
\
\
4
\
\
5
\
\
6',
...
...
@@ -375,8 +377,8 @@ class StructuredText:
aStructuredString = gsub(
'
\
"
\
([^
\
"
\
0
]
+
\
)
\
",[
\
0
- ]+' # title: <"
text
", >
+ ('
\
([
a
-zA-Z]*:[-:a-zA-Z
0-9_,./?=@#~&]*%s
\
)
'
%
not_punctuation_or_whitespace
)
+ ('
\
([
%s]*:[-:%s
0
-9_,./?=@#~&]*%s
\
)
'
%
(string.letters,string.letters,not_punctuation_or_whitespace)
)
+ optional_trailing_punctuation
+ trailing_space,
'<a href="
\\
2
">
\
\
1</a>
\
\
4
\
\
5
\
\
6',
...
...
@@ -492,7 +494,7 @@ class HTML(StructuredText):
).match_group,
nl=ts_regex.compile('
\
n
').search,
ol=ts_regex.compile(
'
[
\
t
]
*
\
(
\
([
0
-
9
]
+
\
|
[
a
-
zA
-
Z
]
+
\
)[.)]
\
)
+
[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
|
$
\
)
'
'
[
\
t
]
*
\
(
\
([
0
-
9
]
+
\
|
[
%
s
]
+
\
)[.)]
\
)
+
[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
|
$
\
)
' % string.letters
).match_group,
olp=ts_regex.compile('
[
\
t
]
*
([
0
-
9
]
+
)[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
|
$
\
)
'
).match_group,
...
...
@@ -564,12 +566,12 @@ def html_quote(v,
def
html_with_references
(
text
,
level
=
1
):
text
=
gsub
(
'[
\
0
\
n
]
\
.
\
.
\
[
\
([0-9_
a-zA-Z-]+
\
)
\
]'
,
'[
\
0
\
n
]
\
.
\
.
\
[
\
([0-9_
%s-]+
\
)
\
]'
%
string
.
letters
,
'
\
n
<a name="
\
\
1">[
\
\
1]</a>'
,
text
)
text
=
gsub
(
'
\
([
\
0- ,]
\
)
\
[
\
([
0
-9_
a-zA-Z-]+
\
)
\
]
\
([
\
0- ,.:]
\
)
'
,
'
\
([
\
0- ,]
\
)
\
[
\
([
0
-9_
%s-]+
\
)
\
]
\
([
\
0- ,.:]
\
)
'
% string.letters
,
'
\\
1
<
a
href
=
"#
\
\
2"
>
[
\\
2
]
</
a
>
\\
3
',
text)
...
...
@@ -584,7 +586,7 @@ def html_with_references(text, level=1):
def main():
import sys, getopt
opts,args=getopt.getopt(sys.argv[1:],'
tw
')
opts,args=getopt.getopt(sys.argv[1:],'
tw
l
')
if args:
[infile]=args
...
...
@@ -597,6 +599,10 @@ def main():
if filter(lambda o: o[0]=='
-
w
', opts):
print '
Content
-
Type
:
text
/
html
\
n
'
if filter(lambda o: o[0]=='
-
l
', opts):
import locale
locale.setlocale(locale.LC_ALL,"")
if s[:2]=='
#!':
s
=
ts_regex
.
sub
(
'^#![^
\
n
]+'
,
''
,
s
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment