Commit 918e1457 authored by Jim Fulton's avatar Jim Fulton

Added a new optional EXPERIMENTAL HTML DTML syntax. As an alternative

to SSI syntax, you can now use ordinary HTML syntax, as in:

  <dtml.in objectIds>
     <dtml.var sequence-item>
  </dtml.in>

Both the new syntax and the SSI syntax are allowed in the same document.
In fact, if you were really twisted, you could:

  <dtml.in objectIds>
     <dtml.var sequence-item>
  <!--#/in-->

;)
parent c6f0fde8
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""HTML formated DocumentTemplates """HTML formated DocumentTemplates
$Id: DT_HTML.py,v 1.18 1999/03/25 20:31:25 jim Exp $""" $Id: DT_HTML.py,v 1.19 1999/06/10 20:45:10 jim Exp $"""
from DT_String import String, FileMixin from DT_String import String, FileMixin
import DT_String, regex import DT_String, regex
...@@ -100,17 +100,51 @@ class dtml_re_class: ...@@ -100,17 +100,51 @@ class dtml_re_class:
find=find, find=find,
strip=strip strip=strip
): ):
s=find(text,'<!--#',start)
if s < 0: return s while 1:
e=find(text,'-->',s) s=find(text,'<', start)
if e < 0: return e if s < 0: return -1
if text[s+1:s+5] == '!--#':
n=s+5 n=s+5
l=end_match(text,n) e=find(text,'-->',n)
if l > 0: if e < 0: return -1
end=strip(text[n:n+l]) en=3
n=n+l
else: end='' l=end_match(text,n)
if l > 0:
end=strip(text[n:n+l])
n=n+l
else: end=''
elif text[s+1:s+6] == 'dtml.':
e=n=s+6
while 1:
e=find(text,'>',e+1)
if e < 0: return -1
if len(split(text[n:e],'"'))%2:
# check for even number of "s inside
break
en=1
end=''
elif text[s+1:s+7] == '/dtml.':
e=n=s+7
while 1:
e=find(text,'>',e+1)
if e < 0: return -1
if len(split(text[n:e],'"'))%2:
# check for even number of "s inside
break
en=1
end='/'
else:
start=s+1
continue
break
l=name_match(text,n) l=name_match(text,n)
if l < 0: return l if l < 0: return l
...@@ -120,7 +154,7 @@ class dtml_re_class: ...@@ -120,7 +154,7 @@ class dtml_re_class:
args=strip(text[a:e]) args=strip(text[a:e])
d=self.__dict__ d=self.__dict__
d[0]=text[s:e+3] d[0]=text[s:e+en]
d[1]=end d[1]=end
d['end']= end d['end']= end
d[2]=name d[2]=name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment