I am currently trying to highlight Ada code on my website using google prettify and a file I have found here. However, I am not able to use the later file with prettify, and the automatic language detection messes up attributes with ' characters (such as Array'first or integer'image), and highlights them as string delimiters.
for instance, I have the following sample code, and I would like to have it formatted correctly in my page:
procedure mergesort (V: in out TV_integer; iterations: in out integer) is
-- {} => {V is sorted}
m : integer := (V'first + V'last) / 2;
begin -- mergesort
if V'length > 1 then
mergesort(V(V'first..m), iterations);
mergesort(V(m+1..V'last), iterations);
merge(V(V'first..m),V(m+1..V'last),V,iterations);
end if;
end mergesort;
Any help would be appreciated.
EDIT: I tried using a pre class="prettyprint lang-ada" tag so that it would use the lang-ada custom script, but without success.
I'm the author of the Ada lexer for google code prettify. To use it, add this to your page:
<head>
<!-- ... -->
<link href="css/prettify.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/prettify.js"></script>
<script type="text/javascript" src="js/lang-ada.js"></script>
</head>
<body onload="prettyPrint()">
Do not use the auto-loader, it won't use custom lexers (change the paths to where you put the files of google code prettify). After you have done that, you can highlight code on your website like this:
<pre class="prettyprint lang-ada"><code>
-- Ada code
</code></pre>
or if you're using markdown or something else that prevents you from adding classes to your tags:
<?prettify lang=ada?>
<pre><code>
-- here goes your Ada code
</code></pre>
By the way, the Ada lexer will mark Ada attributes with the class atn
(which is colored violet by default). If you want them to have the same color as other code, just edit prettify.css
.
Ada is not supported. A lexer has been submitted by fordprefect86, but has not (yet) been included. See Issue 312 for more information
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With