@@ -197,7 +197,7 @@ class Textile(object):
197197 doctype_whitelist = ['html' , 'xhtml' , 'html5' ]
198198
199199 def __init__ (self , restricted = False , lite = False , noimage = False ,
200- auto_link = False , get_sizes = False ):
200+ auto_link = False , get_sizes = False , html_type = 'xhtml' ):
201201 """Textile properties that are common to regular textile and
202202 textile_restricted"""
203203 self .restricted = restricted
@@ -209,22 +209,18 @@ def __init__(self, restricted=False, lite=False, noimage=False,
209209 self .urlrefs = {}
210210 self .shelf = {}
211211 self .rel = ''
212- self .html_type = 'xhtml'
212+ self .html_type = html_type
213213 self .max_span_depth = 5
214214
215215 if self .html_type == 'html5' :
216216 self .glyph_replace [19 ] = r'<abbr title="\2">\1</abbr>'
217217
218- def textile (self , text , rel = None , head_offset = 0 , html_type = 'xhtml' ,
219- sanitize = False ):
218+ def textile (self , text , rel = None , head_offset = 0 , sanitize = False ):
220219 """
221220 >>> import textile
222221 >>> textile.textile('some textile')
223222 '\\ t<p>some textile</p>'
224223 """
225- html_type = html_type .lower ()
226- self .html_type = (html_type in self .doctype_whitelist and html_type or
227- 'xhtml' )
228224 self .notes = OrderedDict ()
229225 self .unreferencedNotes = OrderedDict ()
230226 self .notelist_cache = OrderedDict ()
@@ -289,7 +285,7 @@ def textile(self, text, rel=None, head_offset=0, html_type='xhtml',
289285 if sanitize :
290286 text = sanitizer .sanitize (text )
291287
292- breaktag = {'html' : '<br>' , 'xhtml' : '<br />' }
288+ breaktag = {'html' : '<br>' , 'xhtml' : '<br />' , 'html5' : '<br />' }
293289
294290 text = text .replace (breaktag [self .html_type ], '%s\n '
295291 % breaktag [self .html_type ])
@@ -1679,8 +1675,8 @@ def textile(text, head_offset=0, html_type='xhtml', auto_link=False,
16791675 html_type - 'xhtml' or 'html' style tags (default: 'xhtml')
16801676
16811677 """
1682- return Textile (auto_link = auto_link ).textile (text , head_offset = head_offset ,
1683- html_type = html_type )
1678+ return Textile (auto_link = auto_link , html_type = html_type ).textile (text ,
1679+ head_offset = head_offset )
16841680
16851681
16861682def textile_restricted (text , lite = True , noimage = True , html_type = 'xhtml' ,
@@ -1698,6 +1694,6 @@ def textile_restricted(text, lite=True, noimage=True, html_type='xhtml',
16981694 noimage - disable image tags (default: True)
16991695
17001696 """
1701- return Textile (restricted = True , lite = lite ,
1702- noimage = noimage , auto_link = auto_link ).textile (
1703- text , rel = 'nofollow' , html_type = html_type )
1697+ return Textile (restricted = True , lite = lite , noimage = noimage ,
1698+ auto_link = auto_link , html_type = html_type ).textile ( text ,
1699+ rel = 'nofollow' )
0 commit comments