1717class Table (object ):
1818 def __init__ (self , textile , tatts , rows , summary ):
1919 self .textile = textile
20- self .attributes = parse_attributes (tatts , 'table' )
20+ self .attributes = parse_attributes (tatts , 'table' , restricted = self . textile . restricted )
2121 if summary :
2222 self .attributes .update (summary = summary .strip ())
2323 self .input = rows
@@ -44,7 +44,7 @@ def process(self):
4444 caption_re = re .compile (captionpattern , re .S )
4545 cmtch = caption_re .match (row )
4646 if cmtch :
47- caption = Caption (** cmtch .groupdict ())
47+ caption = Caption (restricted = self . textile . restricted , ** cmtch .groupdict ())
4848 self .caption = '\n {0}' .format (caption .caption )
4949 row = cmtch .group ('row' ).lstrip ()
5050 if row == '' :
@@ -60,7 +60,7 @@ def process(self):
6060 colgroup_atts , cols = colgroup_data , None
6161 if '|' in colgroup_data :
6262 colgroup_atts , cols = colgroup_data .split ('|' , 1 )
63- colgrp = Colgroup (cols , colgroup_atts )
63+ colgrp = Colgroup (cols , colgroup_atts , restricted = self . textile . restricted )
6464 self .colgroup = colgrp .process ()
6565 if row == '' :
6666 continue
@@ -79,13 +79,13 @@ def process(self):
7979 if rgrp :
8080 groups .append ('\n \t {0}' .format (rgrp .process ()))
8181 rgrp = grptypes [grpmatch .group ('part' )](grpmatch .group (
82- 'rgrpatts' ))
82+ 'rgrpatts' ), restricted = self . textile . restricted )
8383 row = grpmatch .group ('row' )
8484
8585 rmtch = re .search (r'^(?P<ratts>{0}{1}\. )(?P<row>.*)' .format (
8686 align_re_s , cls_re_s ), row .lstrip ())
8787 if rmtch :
88- row_atts = parse_attributes (rmtch .group ('ratts' ), 'tr' )
88+ row_atts = parse_attributes (rmtch .group ('ratts' ), 'tr' , restricted = self . textile . restricted )
8989 row = rmtch .group ('row' )
9090 else :
9191 row_atts = {}
@@ -102,7 +102,7 @@ def process(self):
102102 cls_re_s ), cell , flags = re .S )
103103 if cmtch :
104104 catts = cmtch .group ('catts' )
105- cell_atts = parse_attributes (catts , 'td' )
105+ cell_atts = parse_attributes (catts , 'td' , restricted = self . textile . restricted )
106106 cell = cmtch .group ('cell' )
107107 else :
108108 cell_atts = {}
@@ -139,8 +139,8 @@ def process(self):
139139
140140
141141class Caption (object ):
142- def __init__ (self , capts , cap , row ):
143- self .attributes = parse_attributes (capts )
142+ def __init__ (self , capts , cap , row , restricted ):
143+ self .attributes = parse_attributes (capts , restricted = restricted )
144144 self .caption = self .process (cap )
145145
146146 def process (self , cap ):
@@ -149,17 +149,18 @@ def process(self, cap):
149149
150150
151151class Colgroup (object ):
152- def __init__ (self , cols , atts ):
152+ def __init__ (self , cols , atts , restricted ):
153153 self .row = ''
154154 self .attributes = atts
155155 self .cols = cols
156+ self .restricted = restricted
156157
157158 def process (self ):
158159 enc = 'unicode'
159160 if six .PY2 : # pragma: no branch
160161 enc = 'UTF-8'
161162
162- group_atts = parse_attributes (self .attributes , 'col' )
163+ group_atts = parse_attributes (self .attributes , 'col' , restricted = self . restricted )
163164 colgroup = ElementTree .Element ('colgroup' , attrib = group_atts )
164165 colgroup .text = '\n \t '
165166 if self .cols is not None :
@@ -168,7 +169,7 @@ def process(self):
168169 # colgroup is the first item in match_cols, the remaining items are
169170 # cols.
170171 for idx , col in enumerate (match_cols ):
171- col_atts = parse_attributes (col .strip (), 'col' )
172+ col_atts = parse_attributes (col .strip (), 'col' , restricted = self . restricted )
172173 ElementTree .SubElement (colgroup , 'col' , col_atts )
173174 colgrp = ElementTree .tostring (colgroup , encoding = enc )
174175 # cleanup the extra xml declaration if it exists, (python versions
@@ -205,25 +206,25 @@ def process(self):
205206
206207
207208class _TableSection (object ):
208- def __init__ (self , tag , attributes ):
209+ def __init__ (self , tag , attributes , restricted ):
209210 self .tag = tag
210- self .attributes = parse_attributes (attributes )
211+ self .attributes = parse_attributes (attributes , restricted = restricted )
211212 self .rows = []
212213
213214 def process (self ):
214215 return generate_tag (self .tag , '{0}\n \t ' .format ('' .join (self .rows )), self .attributes )
215216
216217
217218class Thead (_TableSection ):
218- def __init__ (self , attributes ):
219- super (Thead , self ).__init__ ('thead' , attributes )
219+ def __init__ (self , attributes , restricted ):
220+ super (Thead , self ).__init__ ('thead' , attributes , restricted )
220221
221222
222223class Tbody (_TableSection ):
223- def __init__ (self , attributes ):
224- super (Tbody , self ).__init__ ('tbody' , attributes )
224+ def __init__ (self , attributes , restricted ):
225+ super (Tbody , self ).__init__ ('tbody' , attributes , restricted )
225226
226227
227228class Tfoot (_TableSection ):
228- def __init__ (self , attributes ):
229- super (Tfoot , self ).__init__ ('tfoot' , attributes )
229+ def __init__ (self , attributes , restricted ):
230+ super (Tfoot , self ).__init__ ('tfoot' , attributes , restricted )
0 commit comments