Skip to content

Commit

Permalink
Added 'call' tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Mar 24, 1998
1 parent 4f33462 commit b2a6323
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions DT_String.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def parse_error(self, mess, tag, text, start):

commands={
'var': DT_Var.Var,
'call': DT_Var.Call,
'in': DT_In.In,
'if': DT_If.If,
'unless': DT_If.Unless,
Expand Down
24 changes: 22 additions & 2 deletions DT_Var.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
'"blah blah blah blah"', then the tag
'<!--#var spam size=10-->' inserts '"blah blah ..."'.
''' # '
__rcs_id__='$Id: DT_Var.py,v 1.10 1998/03/10 20:32:32 jim Exp $'
__rcs_id__='$Id: DT_Var.py,v 1.11 1998/03/24 20:21:39 jim Exp $'

############################################################################
# Copyright
Expand Down Expand Up @@ -160,7 +160,7 @@
# (540) 371-6909
#
############################################################################
__version__='$Revision: 1.10 $'[11:-2]
__version__='$Revision: 1.11 $'[11:-2]

from DT_Util import *

Expand Down Expand Up @@ -253,6 +253,23 @@ def render(self, md):

__call__=render

class Call:
name='call'
expr=None

def __init__(self, args):
args = parse_params(args, name='', expr='')
self.__name__, self.expr = name_param(args,'call',1)

def render(self, md):
name=self.__name__
val=self.expr
if val is None: md[name]
else: val.eval(md)
return ''

__call__=render

def html_quote(v, name='(Unknown name)', md={},
character_entities=(
(regex.compile('&'), '&amp;'),
Expand Down Expand Up @@ -343,6 +360,9 @@ def spacify(val): return gsub('_', ' ', val)

############################################################################
# $Log: DT_Var.py,v $
# Revision 1.11 1998/03/24 20:21:39 jim
# Added 'call' tag.
#
# Revision 1.10 1998/03/10 20:32:32 jim
# Fixed miss-spelling of newline_to_br
#
Expand Down

0 comments on commit b2a6323

Please sign in to comment.