Skip to content
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

Issue with line breaks, is it a problem? #42

Closed
armoucar opened this issue Jun 6, 2017 · 4 comments
Closed

Issue with line breaks, is it a problem? #42

armoucar opened this issue Jun 6, 2017 · 4 comments

Comments

@armoucar
Copy link

armoucar commented Jun 6, 2017

I really don't know if this should work or not because at the end, there's no space between attributes and that's not right, I mean, as a valid html. But we're so used to browsers fixing up things for us (codes like this below do work on browsers) that I ask to myself, should this work on himalaya as well?

Thanks :)

var html = require("himalaya")

var markup = `<button custom-attr-one="Hello world"
custom-attr-two="Hello title">Button</button>`;

html.parse(markup)

output:

[
    {
        "type": "Element",
        "tagName": "button",
        "attributes": {
            "customAttrOne": "Hello world\"\ncustom-attr-two=\"Hello title"
        },
        "children": [
            {
                "type": "Text",
                "content": "Button"
            }
        ]
    }
]
@andrejewski
Copy link
Owner

@armoucar This is definitely something to think about. I completely understand the expectation that newlines would, when parsing the attributes, be treated like whitespace. I had not come across this myself, but since you raise the issue we probably have the same expectation this should work.

Is this something high-priority for you? If so, you could replace bits where "\n occur and that might be a good workaround. I'd like some time to research/experiment not just with newlines but also tabs and what not to see if there is something more consistent to work with (e.g. RegExp \s). And that will probably be a few days coming.

@armoucar
Copy link
Author

armoucar commented Jun 6, 2017

I have a workaround here that fix my issue, no big deal. Just thought it'd be a good idea to share this in here.

By the way, I find himalaya amazing. It's helping me to build a very nice project in the company I work for, thanks a lot. 🥇

@andrejewski
Copy link
Owner

Thank you @armoucar, I'm always happy to hear Himalaya is seeing real-life use, especially as it has evolved from a very niche task utility. I'm never opposed to adding "Companies using X" sections to my project READMEs if your company would like to be the first and score some free advertising, however minor. Let me know, if interested.

@andrejewski
Copy link
Owner

@armoucar this has been addressed in 0.2.10, please update your Himalaya version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants