pycco-docs / pycco

Literate-style documentation generator.

Home Page:https://pycco-docs.github.io/pycco/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Major misinterpretation of python multi-line comments when used in assignment

kurige opened this issue · comments

A special case needs to be added for python multi-line comments. It's a special situation since, A) the start and end delimiters are identical, and B) multi-line comments can be used in string assignment.

So, given the python file:

s = """
    hello world. my name is bob.
    """

print s

Pycco will search for """ at the beginning of each line of code and mark the third line as the beginning of a multi-line comment block, placing print s in the left column of the rendered html as a part of a comment, while hello world. my name is bob. appears on the right as code.

A quick fix might be to simply detect any """ that is preceded by non-whitespace and set a flag that will allow pycco to ignore the next """ that appears in the code.

oh! ha, good call. That and multiline lua ones kill the regex with their --]] like stuff. I'll look at this today.

So can you take care of this, Morgan? Your a bit more familiar with the multi-line stuff than I am ;)

I'm not sure if I understand the issue correctly, but for me, pycco never processes multi-line strings (which are not comments) correctly. At some point, I will see #DIVIDER in the right column and then the whole rest of the file is written in the left column. Is that the problem described here?

i wanted to start using this at work, and the multiline bug killed my dreams. i'll try out a quick fix soon, and send an update. thanks for putting this together! great project.

Note that pycco will only interpret three double quotes """ as denoting a multiline comment, so you can use three single quotes ''' for multiline strings that aren't docstrings.

Can this be closed now?