jsoverson / preprocess

Preprocess HTML, JavaScript, and other files with directives based off custom or ENV configuration
Other
366 stars 80 forks source link

Can't have multiple @exec on same line #138

Open JaroVDH opened 5 years ago

JaroVDH commented 5 years ago

There seems to be an issue with @exec that makes it return undefined and stop parsing if you have multiple on the same line.

Here's a (failing) test for it, in the style of your tests:

it('and work with subsequent execs', function() {
    input = '/* @exec hello(buddy) */, /* @exec hello(buddy) */';
    pp.preprocess(input, {
        'hello': helloSpy,
        'buddy': 'Michael Jackson'
    }, 'js').should.equal('Hello Michael Jackson, Hello Michael Jackson!');
});

Expected: "Hello Michael Jackson, Hello Michael Jackson" Received: "Hello undefined"

The test is Javascript, because that's where I found it, but it happens for all as far as I can tell.

If you add a linebreak between them, it does seem to work.

JaroVDH commented 5 years ago

From the activity here, seems like this project has all but been abandoned. Shame, it's really useful.