doddoreul / google-code-prettify

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

Prettify fails parsing a bash script when encountering /* #207

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

This behaviour can be triggered with a very simple shell script:

#!/bin/bash
ls /*
echo hello world

The following HTML source exhibits the problem:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <link href="prettify.css" type="text/css" rel="stylesheet" />
        <script type="text/javascript" src="prettify.js"></script>
        <title>example.html</title>
    </head>
<body onload="prettyPrint()">
<pre class="prettyprint">
<code class="prettyprint">
#!/bin/bash
ls /*
echo hello world</code>
</pre>

</body>
</html>

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

The script will be prettified well when / is quoted as "/". The expected output 
is therefore a proper highlighting of the source code.

What version are you using?  On what browser?
prettify-small-1-Jun-2011, Firefox 11.0 and Chromium 18.0.1025.162 

Original issue reported on code.google.com by stif...@gmx.de on 16 Apr 2012 at 5:36

GoogleCodeExporter commented 8 years ago
Change

<code class="prettyprint">

to

<code class="prettyprint lang-sh">

The default mode recognizes /* as a comment start.  Prettify does not recognize 
shebang as carrying file type info.

Original comment by mikesamuel@gmail.com on 30 Apr 2012 at 9:18