groovecoder/kuma — pull request #1 by lmorchard (2012-03-08 20:07:53+00:00)
Title: 665733 syntax highlighting

A pull request to a pull request might seem weird, but curiosity got the better of me. So, I threw together some code to discover all the syntax highlighting functions used. This is what I found:

$ ./manage.py migrate_to_kuma_wiki --withsyntax=2000 --syntax-metrics > syntax.txt
2012-03-08 11:55:38,167 INFO Gathering 2000 pages with syntax highlighting

That assembled a tab-delimited file of page title, tag name, function attribute.

$ cat syntax.txt | cut -f2 | sort | uniq -c | sort -rn
4492 pre
1 div

$ cat syntax.txt | grep 'div'
en/HTML/Element/div	pre	syntax.Html
ja/CSS/border-radius	div	template.style_gecko_minversion($, '1.9.1')

That explains the lone `

`, the rest are `

`'s. So, at least we can count on `

` being the spot where syntax highlighting happens.

With that sorted, here's a list of all the values of the `function` attribute and a usage count:

$ cat syntax.txt | cut -f3 | sort | uniq -c | sort -rn
2878 syntax.JavaScript
398 syntax.Html
372 syntax.javascript
189 syntax.Css
146 syntax.Xml
134 syntax.html
66 syntax.cpp
65 syntax.css
63 syntax.xml
55 syntax.Php
47 syntax.Cpp
17 syntax.Shell
16 syntax.shell
8 syntax.Java
8 syntax.HTML
6 syntax.Javascript
5 Syntax.JavaScript
4 syntax.XML
2 syntax.xml{code:$, gutter:false}
2 syntax.javascript{code:$, gutter:false}
2 syntax.dekiscript
1 template.style_gecko_minversion($, '1.9.1')
1 syntax.text
1 syntax.sql
1 syntax.php
1 syntax.html{code:$, wrap:true}
1 syntax.html{code:$, gutter:false}
1 syntax.html{code:$, collapse:true}
1 syntax.Python
1 syntax.DekiScript
1 Svg

If we ignore case differences in counting, we get this:

$ cat syntax.txt | cut -f3 | sort -f | uniq -ci | sort -rn
3261 Syntax.JavaScript
540 syntax.HTML
254 syntax.Css
213 syntax.XML
113 syntax.Cpp
56 syntax.Php
33 syntax.Shell
8 syntax.Java
3 syntax.DekiScript
2 syntax.xml{code:$, gutter:false}
2 syntax.javascript{code:$, gutter:false}
1 template.style_gecko_minversion($, '1.9.1')
1 syntax.text
1 syntax.sql
1 syntax.html{code:$, wrap:true}
1 syntax.html{code:$, gutter:false}
1 syntax.html{code:$, collapse:true}
1 syntax.Python
1 Svg