unified-font-object / ufoNormalizer

A tool that will normalize the XML and other data inside of a UFO.
Other
51 stars 19 forks source link

Preserve empty strings #48

Closed madig closed 6 years ago

madig commented 6 years ago

Currently,

    <lib>
        <dict>
            <key>abc</key>
            <string></string>
        </dict>
    </lib>

is turned into

    <lib>
        <dict>
            <key>abc</key>
        </dict>
    </lib>

Add a test first.

anthrotype commented 6 years ago

Add a test first

🥇

madig commented 6 years ago

Hm. Maybe return xmlEscapeText(element.text) or "" instead?

anthrotype commented 6 years ago

Maybe return xmlEscapeText(element.text) or ""

it depends where you want handle the case of element.text being None. If that function's I/O is only meant to be strings, then it'd be the responsibility of the caller to do return xmlEscapeText(element.text or "")

madig commented 6 years ago

Hm, makes sense. My current fix can stand then?

madig commented 6 years ago

Anything missing or can this be merged?