question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slurping previous new-lines

See original GitHub issue

Is 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:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mdecommented, Mar 25, 2017

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.

0reactions
RyanZimcommented, Jan 25, 2017

Is it a lower-level dep or something?

@mde Yeoman uses mem-fs-editor under the hood.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found