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

Error matching a v-for directive. #1

Open
lksnmnn opened this issue Oct 19, 2019 · 4 comments
Open

Error matching a v-for directive. #1

lksnmnn opened this issue Oct 19, 2019 · 4 comments

Comments

@lksnmnn
Copy link

lksnmnn commented Oct 19, 2019

Hey there,

thank you for this lexer.

I am currently writing my thesis and was looking for a way to make the Latex code listings look nice. I use the minted package which uses pygmentize itself. But so far, the output does not yet satisfy my requirements.

Here is an example code snippet, where the lexer falsely marks =" and " in the second v-for loop as an error.

<template>
    <svg viewBox="-200, -200, 400, 400">
        <g id="nodes">
            <circle 
                v-for="node in graph.nodes"
                :key="node.id"
                :x="node.x"
                :y="node.y"
                :r="getNodeRadius(node)"
            >
        </g>
        <g id="links">
            <line
                v-for="link in graph.links"
                :key="link.id"
                :x1="link.source.x"
                :x2="link.target.x"
                :y1="link.source.y"
                :y2="link.target.y"
                :style="getLinkStyle(link)"
            />
        </g>
    </svg>
</template>

👍 GitHubs Lexer does a good job ;)

The wrong output line looks like this:

<span class="na">v</span><span class="nt">-for</span><span class="err">=&quot;</span><span class="na">link</span> <span class="na">in</span> <span class="na">graph.links</span><span class="err">&quot;</span>

Bildschirmfoto 2019-10-19 um 12 29 03

I attached the full HTML output (as txt, Github doesnt support HTML 😩).
test.txt

Cheers,
Lukas

@mjhea0
Copy link
Contributor

mjhea0 commented Oct 20, 2019

Hi Lukas - So, you're using my vue lexer with https://github.com/gpoore/minted and it's not working?

@lksnmnn
Copy link
Author

lksnmnn commented Oct 21, 2019

Yes. But the above described error is also happening, when I do a plain pygmentize call via command line. Like in your examples I call

pygmentize -O full -f html -o test.html code/test.vue

With test.vue having the above content.

The lexer is installed:

pygmentize -L lexers | grep vue
* vue, vuejs:
    vue (filenames *.vue)

Is it working for you?

@mjhea0
Copy link
Contributor

mjhea0 commented Oct 21, 2019

You can see the example v-for here: https://github.com/testdrivenio/vue-lexer/blob/master/examples/example3.png and I'm testing a v-for here: https://github.com/testdrivenio/vue-lexer/blob/master/tests/test_lexer.py#L79

I'm not sure why your lexer is not working right. Want to add some test code?

@lksnmnn
Copy link
Author

lksnmnn commented Oct 25, 2019

Example 3 works correctly on my machine too.
I added a PR with an additional v-for test which should fail. See PR #2

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