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
cdb2ae91
Commit
cdb2ae91
authored
Mar 11, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
string module free zone
parent
6b1aa57d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
36 deletions
+22
-36
lib/python/StructuredText/DocumentClass.py
lib/python/StructuredText/DocumentClass.py
+16
-17
lib/python/StructuredText/HTMLWithImages.py
lib/python/StructuredText/HTMLWithImages.py
+0
-9
lib/python/StructuredText/ST.py
lib/python/StructuredText/ST.py
+4
-5
lib/python/StructuredText/STDOM.py
lib/python/StructuredText/STDOM.py
+1
-3
lib/python/StructuredText/StructuredText.py
lib/python/StructuredText/StructuredText.py
+1
-1
lib/python/StructuredText/Zwiki.py
lib/python/StructuredText/Zwiki.py
+0
-1
No files found.
lib/python/StructuredText/DocumentClass.py
View file @
cdb2ae91
...
...
@@ -12,7 +12,6 @@
##############################################################################
import
re
,
ST
,
STDOM
from
string
import
split
,
join
,
replace
,
expandtabs
,
strip
,
find
,
rstrip
from
STletters
import
letters
,
digits
,
literal_punc
,
under_punc
,
\
strongem_punc
,
phrase_delimiters
,
dbl_quoted_punc
...
...
@@ -36,7 +35,7 @@ class StructuredTextExample(ST.StructuredTextParagraph):
for
s
in
subs
:
flatten
(
s
,
a
)
apply
(
ST
.
StructuredTextParagraph
.
__init__
,
(
self
,
join
(
t
,
'
\
n
\
n
'
),
()),
(
self
,
'
\
n
\
n
'
.
join
(
t
),
()),
kw
)
def
getColorizableTexts
(
self
):
return
()
...
...
@@ -473,12 +472,12 @@ class DocumentClass:
col = re.compile('
\
|
').search
innertable = re.compile('
\
|
([
-
]
+|
[
=
]
+
)
\
|
').search
text =
strip(text
)
rows =
split(text,
'
\
n
')
text =
text.strip(
)
rows =
text.split(
'
\
n
')
foo = ""
for row in range(len(rows)):
rows[row] =
strip(rows[row]
)
rows[row] =
rows[row].strip(
)
# have indexes store if a row is a divider
# or a cell part
...
...
@@ -496,14 +495,14 @@ class DocumentClass:
ignore = [] # reset ignore
#continue # skip dividers
tmp =
strip(rows[index]
) # clean the row up
tmp =
rows[index].strip(
) # clean the row up
tmp = tmp[1:len(tmp)-1] # remove leading + trailing |
offset = 0
# find the start and end of inner
# tables. ignore everything between
if innertable(tmp):
tmpstr =
strip(tmp
)
tmpstr =
tmp.strip(
)
while innertable(tmpstr):
start,end = innertable(tmpstr).span()
if not (start,end-1) in ignore:
...
...
@@ -640,30 +639,30 @@ class DocumentClass:
left
=
[]
right
=
[]
text
=
row
[
index
][
0
]
text
=
split
(
text
,
'
\
n
'
)
text
=
text
.
split
(
'
\
n
'
)
text
=
text
[:
len
(
text
)
-
1
]
align
=
""
valign
=
""
for
t
in
text
:
t
=
strip
(
t
)
t
=
t
.
strip
(
)
if
not
t
:
topindent
=
topindent
+
1
else
:
break
text
.
reverse
()
for
t
in
text
:
t
=
strip
(
t
)
t
=
t
.
strip
(
)
if
not
t
:
bottomindent
=
bottomindent
+
1
else
:
break
text
.
reverse
()
tmp
=
join
(
text
[
topindent
:
len
(
text
)
-
bottomindent
],
"
\
n
"
)
tmp
=
'
\
n
'
.
join
(
text
[
topindent
:
len
(
text
)
-
bottomindent
]
)
pars
=
re
.
compile
(
"
\
n
\
s*
\
n"
).
split
(
tmp
)
for
par
in
pars
:
if
index
>
0
:
par
=
par
[
1
:]
par
=
split
(
par
,
' '
)
par
=
par
.
split
(
' '
)
for
p
in
par
:
if
not
p
:
leftindent
=
leftindent
+
1
...
...
@@ -756,7 +755,7 @@ class DocumentClass:
if not d: return None
start, end = d.span()
title=top[:start]
if
find(title,
'
\
n
') >= 0: return None
if
title.find(
'
\
n
') >= 0: return None
if not nb(title): return None
d=top[start:end]
top=top[end:]
...
...
@@ -775,17 +774,17 @@ class DocumentClass:
subs=paragraph.getSubparagraphs()
if not subs: return None
top=paragraph.getColorizableTexts()[0]
if not
strip(top
): return None
if not
top.strip(
): return None
if top[-2:]=='
::
':
subs=StructuredTextExample(subs)
if
strip(top
)=='
::
': return subs
if
top.strip(
)=='
::
': return subs
# copy attrs when returning a paragraph
kw = {}
atts = getattr(paragraph, '
_attributes
', [])
for att in atts: kw[att] = getattr(paragraph, att)
return apply(ST.StructuredTextParagraph, (top[:-1], [subs]), kw)
if
find(top,
'
\
n
') >= 0: return None
if
top.find(
'
\
n
') >= 0: return None
return StructuredTextSection(top, subs, indent=paragraph.indent)
def doc_literal(
...
...
@@ -908,7 +907,7 @@ class DocumentClass:
start,e = r.span(1)
name = s[start:e]
name =
replace(name,
'"','',2)
name =
name.replace(
'"','',2)
#start = start + 1
st,end = r.span(3)
if punctuation(s[end-1:end]):
...
...
lib/python/StructuredText/HTMLWithImages.py
View file @
cdb2ae91
...
...
@@ -11,8 +11,6 @@
#
##############################################################################
from
string
import
join
,
split
,
find
import
re
,
sys
,
ST
from
HTMLClass
import
HTMLClass
...
...
@@ -46,10 +44,3 @@ class HTMLWithImages(HTMLClass):
def
xref
(
self
,
doc
,
level
,
output
):
val
=
doc
.
getNodeValue
()
output
(
'<a href="#ref%s">[%s]</a>'
%
(
val
,
val
)
)
lib/python/StructuredText/ST.py
View file @
cdb2ae91
...
...
@@ -12,7 +12,6 @@
##############################################################################
import
re
,
STDOM
from
string
import
split
,
join
,
replace
,
expandtabs
,
strip
,
find
#####################################################################
# Updated functions #
...
...
@@ -123,10 +122,10 @@ def StructuredText(paragraphs, delimiter=re.compile(para_delim)):
struct = [] # the structure to be returned
run = struct
paragraphs =
expandtabs(paragraphs
)
paragraphs =
paragraphs.expandtabs(
)
paragraphs = '%s%s%s' % ('
\
n
\
n
', paragraphs, '
\
n
\
n
')
paragraphs = delimiter.split(paragraphs)
paragraphs =
filter(strip, paragraphs)
paragraphs =
[ x for x in paragraphs if x.strip() ]
if not paragraphs: return StructuredTextDocument()
...
...
@@ -226,7 +225,7 @@ class StructuredTextParagraph(STDOM.Element):
)
for p in self._subs: a(`p`)
a((' '*(self.indent or 0))+'])')
return
join(r,'
\
n
'
)
return
'
\
n
'.join(r
)
"""
create aliases for all above functions in the pythony way.
...
...
@@ -282,7 +281,7 @@ class StructuredTextDocument(StructuredTextParagraph):
a('%s([' % self.__class__.__name__)
for p in self._subs: a(`p`+',')
a('])')
return
join(r,'
\
n
'
)
return
'
\
n
'.join(r
)
"""
create aliases for all above functions in the pythony way.
...
...
lib/python/StructuredText/STDOM.py
View file @
cdb2ae91
...
...
@@ -15,8 +15,6 @@ DOM implementation in StructuredText : Read-Only methods
All standard Zope objects support DOM to a limited extent.
"""
import
string
# Node type codes
# ---------------
...
...
@@ -415,7 +413,7 @@ class Element(Node):
if
type
(
c
)
is
not
st
:
c
=
c
.
getNodeValue
()
r
.
append
(
c
)
return
string
.
join
(
r
,
''
)
return
''
.
join
(
r
)
def
getParentNode
(
self
):
"""
...
...
lib/python/StructuredText/StructuredText.py
View file @
cdb2ae91
...
...
@@ -19,7 +19,7 @@ import HTMLClass, DocumentClass, ClassicDocumentClass
import
DocumentWithImages
,
HTMLWithImages
from
ST
import
Basic
import
re
,
s
tring
,
s
ys
import
re
,
sys
from
STletters
import
letters
Document
=
DocumentClass
.
DocumentClass
()
...
...
lib/python/StructuredText/Zwiki.py
View file @
cdb2ae91
...
...
@@ -13,7 +13,6 @@
##############################################################################
from
Html
import
HTML
from
string
import
split
from
ST
import
DOC
import
re
...
...
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