-
Notifications
You must be signed in to change notification settings - Fork 90
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
XML/HTML: place several children on separate lines when splitting #147
Comments
I can see this making sense, but it's not something that would work in all cases. I have an implementation locally (for splitting, at least) that I haven't pushed yet. It splits the above example like this: <graph id="G" edgedefault="undirected">
<edge id="e6" source="n5" target="n4"> <data key="d1">1.1</data> <data key="d2">1.1</data> </edge>
</graph>
<graph id="G" edgedefault="undirected">
<edge id="e6" source="n5" target="n4">
<data key="d1">1.1</data>
<data key="d2">1.1</data>
</edge>
</graph> But what do we do about text nodes? <graph id="G" edgedefault="undirected">
<edge id="e6" source="n5" target="n4"> Foo <data key="d1">1.1</data> Bar <data key="d2">1.1</data> Baz </edge>
</graph>
<graph id="G" edgedefault="undirected">
<edge id="e6" source="n5" target="n4">
Foo <data key="d1">1.1</data>
Bar <data key="d2">1.1</data>
Baz
</edge>
</graph> This doesn't look terrible, but what about common HTML patterns like embedded links: <p>Some text <a href="http://example.com">with a link</a> and <strong>text</strong> for emphasis</p>
<p>
Some text <a href="http://example.com">with a link</a>
and <strong>text</strong>
for emphasis
</p> This doesn't look that good, because there's no particular reason to split the text nodes like this, other than trying to get all the end nodes to break a line (which is the literal implementation of the feature). I could hide it behind a setting (and I currently have, in my local implementation), but this seems like something that makes sense on a case-by-case basis, rather than globally. Do you think it would make sense to only do this if there's no text nodes (although I have no idea how I'd implement it -- I just use Vim's built in "select inner tag" functionality, not an XML parser)? Do you think it'd make sense to implement it this way in XML, but not in HTML (the setting can be applied per-filetype, so that would be flexible)? If you can come up with some sensible, consistent handling of text nodes, that would be ideal, but I can't imagine a one-size-fits-all solution. As for joining, I don't actually see a difference between the "current" and "expected" output, maybe you accidentally pasted the same thing? But maybe you mean you expect something like this? <edge id="e6" source="n5" target="n4"> <data key="d1">1.1</data> <data key="d2">1.1</data> </edge> This is what you'd get from applying the normal-mode mapping |
In some cases which contains text with tags such as the case you provided, IMHO it will be reasonable to make the text wrap with a specific width that can be configured with <p>Some text that is some how long enough, <strong>stronged</strong><em>emphasised</em>, <a href="http://example.com">with a link that
has a link text as well</a>,Some other text is here</p>
<p>
Some text that is some how long enough, <strong>stronged</strong>
<em>emphasised</em>, <a href="http://example.com">with a link that
has a link text as well</a>, Some other text is here
</p> Or just we can disable splitjoin in cases like this using <graph id="G" edgedefault="undirected">
<edge id="e6" source="n5" target="n4"> <data key="d1">1.1</data> <data key="d2">1.1</data> </edge>
</graph>
<graph id="G" edgedefault="undirected">
<edge id="e6" source="n5" target="n4">
<data key="d1">1.1</data>
<data key="d2">1.1</data>
</edge>
</graph> |
Example xml file:
Place cursor on second line and press
gS
.Expected output
Current Output:
The other direction works. But I would like to have a space between all tags:
Expected Output on Join:
Current Output on Join:
The text was updated successfully, but these errors were encountered: