Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Handle quotes within python docstring #29

Closed
GoogleCodeExporter opened this issue Apr 22, 2015 · 7 comments
Closed

Handle quotes within python docstring #29

GoogleCodeExporter opened this issue Apr 22, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. write python code with """docstrings"""
2. embed a "quoted string" within the docstring.


(Please include HTML, not just your source code)


What is the expected output?  What do you see instead?

Right now, the inner string is treated as not being part of a string. So,
if it contains numbers or English words that happen to be keywords, they
will be highlighted too much.  It would be great if these were just
considered part of the overall string. Or, if there was a
string-within-a-string class, but that might be getting to complicated.

This issue was raised by another user:
http://code.google.com/p/support/issues/detail?id=698

Original issue reported on code.google.com by jrobb...@gmail.com on 3 Feb 2008 at 7:22

@GoogleCodeExporter
Copy link
Author

grammr at http://docs.python.org/ref/grammar.txt

Original comment by mikesamuel@gmail.com on 23 Apr 2008 at 5:58

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

@r38

Original comment by mikesamuel@gmail.com on 5 Jul 2008 at 4:04

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

This appears to be considered fixed, but I just started using it and find that 
it's confused by single quotes (') inside of pythons triple-quoted doctrings. 
For example:

def testFunc():
    '''
    This is the function's docstring.
    '''
    return 1+2

Original comment by scottWil...@gmail.com on 23 Nov 2010 at 11:43

@GoogleCodeExporter
Copy link
Author

http://google-code-prettify.googlecode.com/svn/trunk/tests/prettify_test.html#py
thon_lang seems to work.

Are you specifying that the content language is python?

<pre class="prettyprint lang-py">
def testFunc():
    '''
    This is the function's docstring.
    '''
    return 1+2
</pre>

Original comment by mikesamuel@gmail.com on 1 Dec 2010 at 4:39

@GoogleCodeExporter
Copy link
Author

Not sure if there was a recent regression, but the following code block does 
not work with the current SVN trunk files:

<pre class="prettyprint"><code class="language-python">
import this
""" This is a standard Python triple quoted string
And all " found inside it are still part of
the string and should not be prettified as something else
"""
</code></pre>

Original comment by jerry.ga...@idilia.com on 30 Sep 2011 at 8:59

@GoogleCodeExporter
Copy link
Author

OK, found it. "lang-py" instead of "lang-python". Sorry for the noise.

Original comment by jerry.ga...@idilia.com on 30 Sep 2011 at 9:06

@GoogleCodeExporter
Copy link
Author

No problem.  As a rule of thumb, I try to make sure that lang-<file-extension> 
works instead of requiring everyone to come up with their own 
file-name-extension->language-name map.

Original comment by mikesamuel@gmail.com on 3 Oct 2011 at 6:26

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

No branches or pull requests

2 participants