Slurping previous new-lines
See original GitHub issueIs there a way to remove previous newlines?
My problem is creating xmls
<requires>
<import addon="xbmc.python" version="<%= props.kodiVersion %>"/>
<%_ if (props.type == 'Plugin') { -%> <import addon="script.module.routing" version="0.2.0"/><% } %>
<%_ if (props.kodiVersion == '2.24.0' && (props.type == 'Plugin' || props.type == 'Script' || props.type == 'Service')) { -%> <import addon="script.module.simplejson" version="3.3.0"/><% } %>
</requires>
What I often end up with is this:
<requires>
<import addon="xbmc.python" version="2.24.0"/>
<import addon="script.module.simplejson" version="3.3.0"/>
</requires>
So I would need something instead of <%_
I guess
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Newline slurp and indentation · Issue #89 · mde/ejs - GitHub
Lately, I've been trying to use the trim-mode closing tag -%> and I understand what it's doing but I wonder if the current...
Read more >use regular expressions across multiple lines from a very ...
I have been slurping the file to a string and using regular ... will not allow me to pull characters before and after...
Read more >How do I use File::Slurp to write an array to a file with newlines?
I don't think File::Slurp has an option to print array elements on separate lines. Use map to add newlines to all your array...
Read more >slurp mode - reading a file in one step - Perl Maven
When we put the read-line operator in scalar context, for example by assigning to a scalar variable $x = <$fh>, Perl will read...
Read more >Replace a string containing newline characters
The same basic idea, we set the record separator ( RS ) to \n\n to slurp the whole file, then the output record...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We can’t really invent special, different tags to accommodate all the various ways people might want to handle whitespace, or reformat the markup produced by EJS. I’d be happy to have a longer discussion about a more generalized approach to solving this, but one-offing each individual desired formatting change with ad-hoc tags doesn’t seem like the right approach. I’m going to close this issue, but interested parties can certainly feel free to open and issue to propose a better long-term solution for this type of problem.
@mde Yeoman uses mem-fs-editor under the hood.