Skip to content

Commit

Permalink
Passthrough lxml.etree.CDATA elements (closes fonttools#2745)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlcctrlv committed Aug 16, 2022
1 parent 171670a commit f069ef5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Lib/fontTools/ufoLib/glifLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,11 @@ def _writeUnicodes(glyphObject, element, validate):

def _writeNote(glyphObject, element, validate):
note = getattr(glyphObject, "note", None)
if validate and not isinstance(note, str):
raise GlifLibError("note attribute must be str")
note = note.strip()
note = "\n" + note + "\n"
if (note.__class__.__name__, note.__class__.__module__) != ("CDATA", "lxml.etree"):
if validate and not isinstance(note, str):
raise GlifLibError("note attribute must be str")
note = note.strip()
note = "\n" + note + "\n"
etree.SubElement(element, "note").text = note

def _writeImage(glyphObject, element, validate):
Expand Down

0 comments on commit f069ef5

Please sign in to comment.