diff options
author | redmatrix <git@macgirvin.com> | 2016-06-15 19:44:15 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-06-15 19:44:15 -0700 |
commit | fa48de33c2f6cefbac8bfec7cde75b75390d5f39 (patch) | |
tree | 63440977ec1d802850c7b8c21496f01c9a44e7fd /library/Text_Highlighter/python.xml | |
parent | 476116a972c0f8b8ade495de557b8fc8d3097964 (diff) | |
download | volse-hubzilla-fa48de33c2f6cefbac8bfec7cde75b75390d5f39.tar.gz volse-hubzilla-fa48de33c2f6cefbac8bfec7cde75b75390d5f39.tar.bz2 volse-hubzilla-fa48de33c2f6cefbac8bfec7cde75b75390d5f39.zip |
provide syntax based [colour] highlighting on code blocks for popular languages. I'm not happy with the line height on the list elements but couldn't see where this was defaulted. This uses the syntax [code=xxx]some code snippet[/code], where xxx represents a code/language style - with about 18 builtins.
Diffstat (limited to 'library/Text_Highlighter/python.xml')
-rw-r--r-- | library/Text_Highlighter/python.xml | 229 |
1 files changed, 229 insertions, 0 deletions
diff --git a/library/Text_Highlighter/python.xml b/library/Text_Highlighter/python.xml new file mode 100644 index 000000000..29e77203c --- /dev/null +++ b/library/Text_Highlighter/python.xml @@ -0,0 +1,229 @@ +<?xml version="1.0"?> +<!-- $Id: python.xml,v 1.1 2007-06-03 02:35:28 ssttoo Exp $ --> + +<highlight lang="python" case="no"> + + <authors> + <author name="Andrey Demenev" email="demenev@gmail.com"/> + </authors> + + <default innerClass="code" /> + + <region name="strsingle3" delimClass="quotes" innerClass="string" + start="'''" end="'''" /> + + <region name="strdouble3" delimClass="quotes" innerClass="string" + start=""""" end="""""> + </region> + + <region name="strdouble" delimClass="quotes" innerClass="string" + start=""" end=""" > + </region> + + <region name="strsingle" delimClass="quotes" innerClass="string" + start="'" end="'" /> + + <region name="brackets" delimClass="brackets" innerClass="code" start="\(" end="\)" > + <contains all="yes"/> + </region> + + <region name="sqbrackets" delimClass="brackets" innerClass="code" start="\[" end="\]" > + <contains all="yes"/> + </region> + + <block name="escaped" match="\\." innerClass="special" contained="yes"> + <onlyin region="strsingle"/> + <onlyin region="strsingle3"/> + <onlyin region="strdouble"/> + <onlyin region="strdouble3"/> + </block> + + <block name="possiblefunction" match="[a-z_]\w*(?=\s*\()" innerClass="identifier" /> + + <block name="identifier" match="[a-z_]\w*" innerClass="identifier" /> + + <block name="exponent" + match="((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+)" + innerClass="number" /> + + <block name="imaginary" match="((\d*\.\d+)|(\d+\.\d*)|(\d+))j" innerClass="number"/> + + <block name="float" match="(\d*\.\d+)|(\d+\.\d*)" innerClass="number"/> + + <block name="integer" match="\d+l?|\b0l?\b" innerClass="number" /> + + <block name="hexinteger" match="0[xX][\da-f]+l?" innerClass="number" /> + + <block name="octinteger" match="0[0-7]+l?" innerClass="number" /> + + <block name="comment" innerClass="comment" + match="#.+" /> + + <keywords name="reserved" inherits="identifier" innerClass="reserved" case = "yes"> + <keyword match="and"/> + <keyword match="del"/> + <keyword match="for"/> + <keyword match="is"/> + <keyword match="raise"/> + <keyword match="assert"/> + <keyword match="elif"/> + <keyword match="from"/> + <keyword match="lambda"/> + <keyword match="return"/> + <keyword match="break"/> + <keyword match="else"/> + <keyword match="global"/> + <keyword match="not"/> + <keyword match="try"/> + <keyword match="class"/> + <keyword match="except"/> + <keyword match="if"/> + <keyword match="or"/> + <keyword match="while"/> + <keyword match="continue"/> + <keyword match="exec"/> + <keyword match="import"/> + <keyword match="pass"/> + <keyword match="yield"/> + <keyword match="def"/> + <keyword match="finally"/> + <keyword match="in"/> + <keyword match="print"/> + <keyword match="False"/> + <keyword match="True"/> + <keyword match="None"/> + <keyword match="NotImplemented"/> + <keyword match="Ellipsis"/> + + <keyword match="Exception" /> + <keyword match="SystemExit" /> + <keyword match="StopIteration" /> + <keyword match="StandardError" /> + <keyword match="KeyboardInterrupt" /> + <keyword match="ImportError" /> + <keyword match="EnvironmentError" /> + <keyword match="IOError" /> + <keyword match="OSError" /> + <keyword match="WindowsError" /> + <keyword match="EOFError" /> + <keyword match="RuntimeError" /> + <keyword match="NotImplementedError" /> + <keyword match="NameError" /> + <keyword match="UnboundLocalError" /> + + <keyword match="AttributeError" /> + <keyword match="SyntaxError" /> + <keyword match="IndentationError" /> + <keyword match="TabError" /> + <keyword match="TypeError" /> + <keyword match="AssertionError" /> + <keyword match="LookupError" /> + <keyword match="IndexError" /> + <keyword match="KeyError" /> + <keyword match="ArithmeticError" /> + <keyword match="OverflowError" /> + <keyword match="ZeroDivisionError" /> + <keyword match="FloatingPointError" /> + <keyword match="ValueError" /> + <keyword match="UnicodeError" /> + <keyword match="UnicodeEncodeError" /> + <keyword match="UnicodeDecodeError" /> + + <keyword match="UnicodeTranslateError" /> + <keyword match="ReferenceError" /> + <keyword match="SystemError" /> + <keyword match="MemoryError" /> + <keyword match="Warning" /> + <keyword match="UserWarning" /> + <keyword match="DeprecationWarning" /> + <keyword match="PendingDeprecationWarning" /> + <keyword match="SyntaxWarning" /> + <keyword match="OverflowWarning" /> + <keyword match="RuntimeWarning" /> + <keyword match="FutureWarning" /> + + </keywords> + + <keywords name="builtin" inherits="possiblefunction" + innerClass="builtin" otherwise="identifier" case = "yes"> + <keyword match="__import__"/> + + <keyword match="abs"/> + <keyword match="apply"/> + <keyword match="basestring"/> + <keyword match="bool"/> + <keyword match="buffer"/> + <keyword match="callable"/> + <keyword match="chr"/> + <keyword match="classmethod"/> + <keyword match="cmp"/> + + <keyword match="coerce"/> + <keyword match="compile"/> + <keyword match="complex"/> + <keyword match="delattr"/> + <keyword match="dict"/> + <keyword match="dir"/> + <keyword match="divmod"/> + <keyword match="enumerate"/> + <keyword match="eval"/> + + <keyword match="execfile"/> + <keyword match="file"/> + <keyword match="filter"/> + <keyword match="float"/> + <keyword match="getattr"/> + <keyword match="globals"/> + <keyword match="hasattr"/> + <keyword match="hash"/> + <keyword match="help"/> + + <keyword match="hex"/> + <keyword match="id"/> + <keyword match="input"/> + <keyword match="int"/> + <keyword match="intern"/> + <keyword match="isinstance"/> + <keyword match="issubclass"/> + <keyword match="iter"/> + <keyword match="len"/> + + <keyword match="list"/> + <keyword match="locals"/> + <keyword match="long"/> + <keyword match="map"/> + <keyword match="max"/> + <keyword match="min"/> + <keyword match="object"/> + <keyword match="oct"/> + <keyword match="open"/> + + <keyword match="ord"/> + <keyword match="pow"/> + <keyword match="property"/> + <keyword match="range"/> + <keyword match="raw_input"/> + <keyword match="reduce"/> + <keyword match="reload"/> + <keyword match="repr"/> + <keyword match="round"/> + + <keyword match="setattr"/> + <keyword match="slice"/> + <keyword match="staticmethod"/> + <keyword match="sum"/> + <keyword match="super"/> + <keyword match="str"/> + <keyword match="tuple"/> + <keyword match="type"/> + <keyword match="unichr"/> + + <keyword match="unicode"/> + <keyword match="vars"/> + <keyword match="xrange"/> + <keyword match="zip"/> + + </keywords> + +</highlight> + |