Skip to content

Commit abb2083

Browse files
authored
Merge pull request #597 from adamritter/master
Allow embedding raw HTML inside FT templates using UTF-8 encoded bytes
2 parents e727da9 + 72890b1 commit abb2083

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

fastcore/xml.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def to_xml(elm, lvl=0):
109109
if elm is None: return ''
110110
if isinstance(elm, tuple): return '\n'.join(to_xml(o) for o in elm)
111111
if hasattr(elm, '__ft__'): elm = elm.__ft__()
112+
if isinstance(elm, bytes): return elm.decode('utf-8')
112113
sp = ' ' * lvl
113114
if not isinstance(elm, list): return f'{_escape(elm)}\n'
114115

nbs/11_xml.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@
330330
" if elm is None: return ''\n",
331331
" if isinstance(elm, tuple): return '\\n'.join(to_xml(o) for o in elm)\n",
332332
" if hasattr(elm, '__ft__'): elm = elm.__ft__()\n",
333+
" if isinstance(elm, bytes): return elm.decode('utf-8')\n",
333334
" sp = ' ' * lvl\n",
334335
" if not isinstance(elm, list): return f'{_escape(elm)}\\n'\n",
335336
"\n",

0 commit comments

Comments
 (0)