tylerlong / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

Handle quotes within python docstring #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
grammr at http://docs.python.org/ref/grammar.txt

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

GoogleCodeExporter commented 9 years ago
@r38

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

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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