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
13b51ae7
Commit
13b51ae7
authored
Apr 30, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some re's
parent
30a9be8a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
41 deletions
+37
-41
lib/python/DocumentTemplate/DT_HTML.py
lib/python/DocumentTemplate/DT_HTML.py
+8
-8
lib/python/DocumentTemplate/DT_Let.py
lib/python/DocumentTemplate/DT_Let.py
+2
-2
lib/python/DocumentTemplate/DT_String.py
lib/python/DocumentTemplate/DT_String.py
+21
-21
lib/python/DocumentTemplate/DT_Util.py
lib/python/DocumentTemplate/DT_Util.py
+6
-10
No files found.
lib/python/DocumentTemplate/DT_HTML.py
View file @
13b51ae7
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""HTML formated DocumentTemplates
$Id: DT_HTML.py,v 1.2
6 2001/04/28 04:59:13 chrism
Exp $"""
$Id: DT_HTML.py,v 1.2
7 2001/04/30 14:46:00 shane
Exp $"""
from
DT_String
import
String
,
FileMixin
import
DT_String
,
re
...
...
@@ -94,10 +94,10 @@ from string import strip, find, split, join, rfind, replace
class
dtml_re_class
:
""" This needs to be replaced before 2.4. It's a hackaround. """
def
search
(
self
,
text
,
start
=
0
,
name_match
=
re
.
compile
(
r
'[\000- ]*[a-zA-Z]+[\000- ]*'
).
match
,
end_match
=
re
.
compile
(
r
'[\000- ]*(/|end)'
,
re
.
I
).
match
,
start_search
=
re
.
compile
(
r
'[<&]'
).
search
,
ent_name
=
re
.
compile
(
r
'[-a-zA-Z0-9_.]+'
).
match
,
name_match
=
re
.
compile
(
'[
\
000
- ]*[a-zA-Z]+[
\
000
- ]*'
).
match
,
end_match
=
re
.
compile
(
'[
\
000
- ]*(/|end)'
,
re
.
I
).
match
,
start_search
=
re
.
compile
(
'[<&]'
).
search
,
ent_name
=
re
.
compile
(
'[-a-zA-Z0-9_.]+'
).
match
,
find
=
find
,
strip
=
strip
,
replace
=
replace
,
...
...
@@ -224,7 +224,7 @@ class HTML(DT_String.String):
return
dtml_re_class
()
parseTag__roles__
=
()
def
parseTag
(
self
,
tagre
,
command
=
None
,
sargs
=
''
):
def
parseTag
(
self
,
match_ob
,
command
=
None
,
sargs
=
''
):
"""Parse a tag using an already matched re
Return: tag, args, command, coname
...
...
@@ -236,7 +236,7 @@ class HTML(DT_String.String):
coname is the name of a continue tag (e.g. else)
or None otherwise
"""
tag
,
end
,
name
,
args
,
=
tagre
.
group
(
0
,
'end'
,
'name'
,
'args'
)
tag
,
end
,
name
,
args
=
match_ob
.
group
(
0
,
'end'
,
'name'
,
'args'
)
args
=
strip
(
args
)
if
end
:
if
not
command
or
name
!=
command
.
name
:
...
...
@@ -263,7 +263,7 @@ class HTML(DT_String.String):
def
SubTemplate
(
self
,
name
):
return
HTML
(
''
,
__name__
=
name
)
varExtra__roles__
=
()
def
varExtra
(
self
,
tagre
):
return
's'
def
varExtra
(
self
,
match_ob
):
return
's'
manage_edit__roles__
=
()
def
manage_edit
(
self
,
data
,
REQUEST
=
None
):
...
...
lib/python/DocumentTemplate/DT_Let.py
View file @
13b51ae7
...
...
@@ -154,8 +154,8 @@ class Let:
def
parse_let_params
(
text
,
result
=
None
,
tag
=
'let'
,
parmre
=
re
.
compile
(
r
'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'
),
qparmre
=
re
.
compile
(
r
'([\000- ]*([^\000- ="]+)="([^"]*)")'
),
parmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+)=([^
\
000
- ="]+))'
),
qparmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+)="([^"]*)")'
),
**
parms
):
result
=
result
or
[]
...
...
lib/python/DocumentTemplate/DT_String.py
View file @
13b51ae7
...
...
@@ -82,7 +82,7 @@
# attributions are listed in the accompanying credits file.
#
##############################################################################
"$Id: DT_String.py,v 1.4
3 2001/04/28 07:20:28 chrism
Exp $"
"$Id: DT_String.py,v 1.4
4 2001/04/30 14:46:00 shane
Exp $"
from
string
import
split
,
strip
import
thread
,
re
...
...
@@ -155,18 +155,18 @@ class String:
tagre__roles__
=
()
def
tagre
(
self
):
return
re
.
compile
(
r'%('
# beginning
r'(?P<name>[a-zA-Z0-9_/.-]+)'
# tag name
r
'('
r'[\000- ]+'
# space after tag name
r'(?P<args>([^)"]+("[^"]*")?)*)'
# arguments
r
')?'
r'
)(?P<fmt>[0-9]*[.]?[0-9]*[a-z]|[]![])'
# end
,
re
.
I
)
'%
\
\
('
# beginning
'(?P<name>[a-zA-Z0-9_/.-]+)'
# tag name
'('
'[
\
000
- ]+'
# space after tag name
'(?P<args>([^
\
\
)"]+("[^"]*")?)*)'
# arguments
')?'
'
\
\
)(?P<fmt>[0-9]*[.]?[0-9]*[a-z]|[]![])'
# end
,
re
.
I
)
_parseTag__roles__
=
()
def
_parseTag
(
self
,
tagre
,
command
=
None
,
sargs
=
''
,
tt
=
type
(())):
tag
,
args
,
command
,
coname
=
self
.
parseTag
(
tagre
,
command
,
sargs
)
def
_parseTag
(
self
,
match_ob
,
command
=
None
,
sargs
=
''
,
tt
=
type
(())):
tag
,
args
,
command
,
coname
=
self
.
parseTag
(
match_ob
,
command
,
sargs
)
if
type
(
command
)
is
tt
:
cname
,
module
,
name
=
command
d
=
{}
...
...
@@ -179,7 +179,7 @@ class String:
return
tag
,
args
,
command
,
coname
parseTag__roles__
=
()
def
parseTag
(
self
,
tagre
,
command
=
None
,
sargs
=
''
):
def
parseTag
(
self
,
match_ob
,
command
=
None
,
sargs
=
''
):
"""Parse a tag using an already matched re
Return: tag, args, command, coname
...
...
@@ -191,7 +191,7 @@ class String:
coname is the name of a continue tag (e.g. else)
or None otherwise
"""
tag
,
name
,
args
,
fmt
=
tagre
.
group
(
0
,
'name'
,
'args'
,
'fmt'
)
tag
,
name
,
args
,
fmt
=
match_ob
.
group
(
0
,
'name'
,
'args'
,
'fmt'
)
args
=
args
and
strip
(
args
)
or
''
if
fmt
==
']'
:
...
...
@@ -220,18 +220,18 @@ class String:
return
tag
,
args
,
Var
,
None
varExtra__roles__
=
()
def
varExtra
(
self
,
tagre
):
return
tagre
.
group
(
'fmt'
)
def
varExtra
(
self
,
match_ob
):
return
match_ob
.
group
(
'fmt'
)
parse__roles__
=
()
def
parse
(
self
,
text
,
start
=
0
,
result
=
None
,
tagre
=
None
):
if
result
is
None
:
result
=
[]
if
tagre
is
None
:
tagre
=
self
.
tagre
()
mo
=
tagre
.
search
(
text
,
start
)
mo
=
tagre
.
search
(
text
,
start
)
while
mo
:
l
=
mo
.
start
(
0
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
tagre
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
mo
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
s
=
text
[
start
:
l
]
...
...
@@ -243,7 +243,7 @@ class String:
tag
,
l
,
args
,
command
)
else
:
try
:
if
command
is
Var
:
r
=
command
(
args
,
self
.
varExtra
(
tagre
))
if
command
is
Var
:
r
=
command
(
args
,
self
.
varExtra
(
mo
))
else
:
r
=
command
(
args
)
if
hasattr
(
r
,
'simple_form'
):
r
=
r
.
simple_form
result
.
append
(
r
)
...
...
@@ -256,7 +256,7 @@ class String:
return
result
skip_eol__roles__
=
()
def
skip_eol
(
self
,
text
,
start
,
eol
=
re
.
compile
(
r
'[ \t]*\n'
)):
def
skip_eol
(
self
,
text
,
start
,
eol
=
re
.
compile
(
'[
\
t
]*
\
n
'
)):
# if block open is followed by newline, then skip past newline
mo
=
eol
.
match
(
text
,
start
)
if
mo
is
not
None
:
...
...
@@ -281,7 +281,7 @@ class String:
if
mo
is
None
:
self
.
parse_error
(
'No closing tag'
,
stag
,
text
,
sloc
)
l
=
mo
.
start
(
0
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
tagre
,
scommand
,
sa
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
mo
,
scommand
,
sa
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
if
command
:
...
...
@@ -320,7 +320,7 @@ class String:
if
mo
is
None
:
self
.
parse_error
(
'No closing tag'
,
stag
,
text
,
sloc
)
l
=
mo
.
start
(
0
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
tagre
,
scommand
,
sa
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
mo
,
scommand
,
sa
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
start
=
l
+
len
(
tag
)
...
...
lib/python/DocumentTemplate/DT_Util.py
View file @
13b51ae7
...
...
@@ -82,8 +82,8 @@
# attributions are listed in the accompanying credits file.
#
##############################################################################
'''$Id: DT_Util.py,v 1.7
5 2001/04/28 04:58:53 chrism
Exp $'''
__version__
=
'$Revision: 1.7
5
$'
[
11
:
-
2
]
'''$Id: DT_Util.py,v 1.7
6 2001/04/30 14:46:00 shane
Exp $'''
__version__
=
'$Revision: 1.7
6
$'
[
11
:
-
2
]
import
re
,
os
from
string
import
lower
...
...
@@ -339,14 +339,10 @@ ListType=type([])
def
parse_params
(
text
,
result
=
None
,
tag
=
''
,
unparmre
=
re
.
compile
(
r'([\000- ]*([^\000- ="]+))'
),
qunparmre
=
re
.
compile
(
r'([\000- ]*("[^"]*"))'
),
parmre
=
re
.
compile
(
r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'
),
qparmre
=
re
.
compile
(
r'([\000- ]*([^\000- ="]+)="([^"]*)")'
),
unparmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+))'
),
qunparmre
=
re
.
compile
(
'([
\
000
- ]*("[^"]*"))'
),
parmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+)=([^
\
000
- ="]+))'
),
qparmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+)="([^"]*)")'
),
**
parms
):
"""Parse tag parameters
...
...
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