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

Parsing bug on triple quotes #108

Open
turicas opened this issue Feb 13, 2019 · 2 comments
Open

Parsing bug on triple quotes #108

turicas opened this issue Feb 13, 2019 · 2 comments

Comments

@turicas
Copy link

turicas commented Feb 13, 2019

Hi! First of all, thanks for creating this project. :)

I've found a parsing bug related to triple quotes. This is how to reproduce:

If I create a file named test.py with the following contents:

def test():
    """this is a test
    this line will break parsing because triple quotes finish here, not the next line."""
    pass

Then, run:

pycco test.py

And open docs/test.html in the browser, I'll get:

pycco-parsing-bug

If I change the file to:

def test():
    """this is a test
    this line will break parsing because triple quotes finish here, not the next line.
    """
    pass

Then the output will be:

pycco-parsing-2

@gabpalves
Copy link

Though i agree scenarios like these could also be handled by the application, i don't think this can be technically defined as a bug. The reason is the PEP 257 specifies that:

Unless the entire docstring fits on a line, place the closing quotes on a line by themselves

... and that's the convention Pycco follows.

@turicas
Copy link
Author

turicas commented Feb 21, 2019

@gabpalves, the code I've posted as a test to reproduce the bug is valid Python code (it's PEP257-invalid though). I think pycco should work with any (valid) Python code, even if not following the PEP suggestions (they're just suggestions, not a mandatory thing).

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