Code Monkey home page Code Monkey logo

Comments (20)

fatso83 avatar fatso83 commented on July 20, 2024

OK, I'll look into it. Since I am actually just calling out to py-codekitlang, I'll try to get it fixed there. I think I have seen the same thing.

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

(Deleted comment - I am an idiot ... ). A small textfile to test with would still be good though. Like foo.kit & foo.html.

from grunt-codekit.

kdzwinel avatar kdzwinel commented on July 20, 2024

From what I can see:


recipes.kit

            <div class="list-view">
            <!-- @import "recipes_list.html" -->
            </div>

recipes_list.html

<ul class="recipe-items"></ul>

Codekit output:

            <div class="list-view">
            <ul class="recipe-items"></ul>            </div>

grunt-codekit output:

            <div class="list-view">
            <ul class="recipe-items"></ul>
            </div>

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

hmm ... so it looks like CodeKit is actually the one doing the "wrong" thing - altering the output by removing the newline that is in the file that imports the other template. @gjo that is maintaining the python code is actually making a branch for dealing with CodeKit quirks, so this might be a thing worth having in there ... I see a --enable-codekit-quirks-mode flag coming :-)

I will need to find the time to produce some more test cases though.

from grunt-codekit.

kdzwinel avatar kdzwinel commented on July 20, 2024

I looked for a formal description of the kit syntax but found none, so it's hard to say if it's really a bug. However, I agree that this CodeKit output is rather unexpected.

Anyway, missing (or additional) newline in HTML, in most cases, doesn't alter what is rendered to the screen. So it doesn't seem to be a huge problem.

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

The description is the implementation. Not so readable :)

But I just ran the inputs you gave, and the result was different from what you presented. It seems like the python compiler adds a newline, as you noted, but I guess the inputs might differ from yours due to copy-pasting.

Codekit output

            <div class="list-view">
            <ul class="recipe-items"></ul>
            </div>

Pykitlangc output (underlying Grunt)

            <div class="list-view">
            <ul class="recipe-items"></ul>

            </div>

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

This is way overdue, but ... any chance you could just send me those input and output files? Copy-paste seems to introduce additional newline entities.

from grunt-codekit.

jeremyworboys avatar jeremyworboys commented on July 20, 2024

@fatso83 It looks to me like your editor is adding a blank line at the end of file.
@kdzwinel Is this still an issue after the change to node-kit? (grunt-codekit v.0.3 I believe).

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

@jeremyworboys: I need to update from version 0.3 of node-kit, but it seems this (or a related problem) is at least present in version 0.3. See #9. We are not producing the same output as CodeKit - probably needs to remove one newline per Kit deceleration. My Mac (and CodeKit) is at work, so I can't verify that this is what is actually happening until Monday

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

That should have been "per Kit declaration".
(Damn you, autocorrect!)

from grunt-codekit.

jeremyworboys avatar jeremyworboys commented on July 20, 2024

No worries. I have a CodeKit license, so I'll run some tests and see if I can get matching output.

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

You sure respond quickly to these; I barely get to type my comments before a new version is is in the NPM repo :-)

from grunt-codekit.

jeremyworboys avatar jeremyworboys commented on July 20, 2024

Okay, so I just deleted all my results files then ran the fixture source files through CodeKit 2.0.6. Git did not detect any changes to the files.

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

I have asked @sroberson to come up with an example of a file where CodeKit produces different output, but we are well into Saturday so it could probably lie for a day or two. It's not like this is breaking anything.

from grunt-codekit.

sroberson avatar sroberson commented on July 20, 2024

OK, here's the files. I've left the actual client text in there, which probably not the greatest idea, but the pages won't load anyway because of the javascript errors. But you'll be able to see the html output files which have [filename]-code-kit.html vs [filename]-node-kit.html.

http://dropsend.theprimacy.com/dl/a1ef3d8b-635c-4ac7-8d5c-e874007f56a3

Thanks.

from grunt-codekit.

sroberson avatar sroberson commented on July 20, 2024

I looked into the tests for node-kit- particularly the test for page.kit.

This is a strange test that a source file (https://github.com/jeremyworboys/node-kit/blob/master/test/fixtures/page.kit) that contains no empty line breaks is compared to a results file (https://github.com/jeremyworboys/node-kit/blob/master/test/fixtures/results/page.html) that has 2 leading line breaks.

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

I don't find that so strange, actually. It just shows that variable declarations count as lines. The two variable that are declared correspond exactly to the empty lines in the output. What follows is the master template that is filled with the variables.

As mentioned already, Jeremy ran all the kit files through CodeKit and it produced the exact same output (no diff in git), so this seems to be the correct interpretation of how it should be done.

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

BTW, I see from your zip-file that the output does differ in exactly this regard, so this needs some looking into. Thanks!

from grunt-codekit.

jeremyworboys avatar jeremyworboys commented on July 20, 2024

I attempted a fix for the whitespace issue. My approach was to discard the a single newline if it is the next character directly after a special comment. This worked well for most cases, but did not handle certain situations such as:

Input:

<!-- @var1=value1 -->
<!-- $var2=value2 -->
<!-- $var1 -->
<!-- @var2 -->

Expected output:

value1
value2

Actual output:

value1value2

Edit: Just thinking on this some more. I could only discard the first newline if it is the next character after an assignment or import directive. This would mean added complexity to the compilation stage, but should be simple enough. Thoughts?

Edit 2: Nevermind. Version 0.5 strips newlines directly following import and assignment directives.

from grunt-codekit.

fatso83 avatar fatso83 commented on July 20, 2024

@sroberson Sorry for taking so long to fix this. I simply forgot to push a new release after the new node-kit version. A new version 0.4 is out now.

from grunt-codekit.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.