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

Allow two XML elements to be in the same line (maybe with a space between them) #144

Open
drthoben opened this issue Jun 19, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@drthoben
Copy link

Is your feature request related to a problem? Please describe.
I'm using xmlbuilder2 to generate an XML file, which I'd like to import in InDesign. In order to have two XML elements in the same line in InDesign, I need the two XML tags to appear in the same line with a space between them.

The XML would look something like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Template>
<friends>
<friend>
<friend_info>
<first_name>Peter</first_name> <last_name>Gabriel</last_name>
<date_of_birth>1970-01-01</date_of_birth>
</friend_info>
</friend>
</friends>
</Template>

Describe the solution you'd like
It'll be nice to have some chainable method to disable or change newline for the current element, so that the call would look something like this:

const friendEle = root.ele('friend');
const infoEle = friendEle('friend_info');

infoEle.ele('first_name').txt('Peter').options({ newline: ' ' });
infoEle.ele('last_name').txt('Gabriel');

Describe alternatives you've considered
I'm also considering hooking into the callback writer to detect certain tags and if they appear, I remove that newline. But I haven't really found a way to do so.

@drthoben drthoben added the enhancement New feature or request label Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants