Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmetic: add option for space in self-closing tag #157

Closed
FloEdelmann opened this issue May 16, 2017 · 5 comments
Closed

Cosmetic: add option for space in self-closing tag #157

FloEdelmann opened this issue May 16, 2017 · 5 comments
Labels

Comments

@FloEdelmann
Copy link

In self-closing tags, there is no space before the slash (<tag/> instead of <tag />). I know this is purely cosmetic, but I prefer having a space there.

It would be nice to be able to control this behaviour with an option.

Bonus: The option could also add a space in the XML header: <?xml version="1.0" encoding="UTF-8" ?> instead of <?xml version="1.0" encoding="UTF-8"?>

@soumak77
Copy link

This would be very useful when using this library to modify a cordova config.xml. Cordova uses a space before the closing tag. As a result, any minor changes with this library looks like a massive rewrite to the file since every line is included in the diff.

@soumak77
Copy link

@oozcitak this feature is broken. Instead of adding a space, it adds the word true.

    <content src="index.html"true/>
    <access origin="*"true/>
    <allow-navigation href="http://ionic.local/*"true/>
    <allow-navigation href="http://192.168.1.226:8100"true/>
    <allow-intent href="http://*/*"true/>
    <allow-intent href="https://*/*"true/>
    <allow-intent href="tel:*"true/>
    <allow-intent href="sms:*"true/>
    <allow-intent href="mailto:*"true/>
    <allow-intent href="geo:*"true/>

@soumak77
Copy link

@oozcitak I expected the spacebeforeslash option to accept true or false, however, this yields the results above. If I set the option to ' ' then it works as expected.

@oozcitak
Copy link
Owner

This is by design. It requires the string to be inserted before the closing slash. See the wiki: https://github.com/oozcitak/xmlbuilder-js/wiki#converting-to-string

@oozcitak
Copy link
Owner

I am adding a check for boolean true as well: 63d5143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants