mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
3 more lexers (markdown moinwiki bbcode)
This commit is contained in:
parent
f435d7df21
commit
215d53e173
22
lexers/bbcode.xml
Normal file
22
lexers/bbcode.xml
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
<lexer>
|
||||
<config>
|
||||
<name>BBCode</name>
|
||||
<alias>bbcode</alias>
|
||||
<mime_type>text/x-bbcode</mime_type>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="root">
|
||||
<rule pattern="[^[]+"><token type="Text"/></rule>
|
||||
<rule pattern="\[/?\w+"><token type="Keyword"/><push state="tag"/></rule>
|
||||
<rule pattern="\["><token type="Text"/></rule>
|
||||
</state>
|
||||
<state name="tag">
|
||||
<rule pattern="\s+"><token type="Text"/></rule>
|
||||
<rule pattern="(\w+)(=)("?[^\s"\]]+"?)"><bygroups><token type="NameAttribute"/><token type="Operator"/><token type="LiteralString"/></bygroups></rule>
|
||||
<rule pattern="(=)("?[^\s"\]]+"?)"><bygroups><token type="Operator"/><token type="LiteralString"/></bygroups></rule>
|
||||
<rule pattern="\]"><token type="Keyword"/><pop depth="1"/></rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
|
54
lexers/markdown.xml
Normal file
54
lexers/markdown.xml
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
<lexer>
|
||||
<config>
|
||||
<name>Markdown</name>
|
||||
<alias>markdown</alias>
|
||||
<alias>md</alias>
|
||||
<filename>*.md</filename>
|
||||
<filename>*.markdown</filename>
|
||||
<mime_type>text/x-markdown</mime_type>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="root">
|
||||
<rule pattern="(^#[^#].+)(\n)"><bygroups><token type="GenericHeading"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="(^#{2,6}[^#].+)(\n)"><bygroups><token type="GenericSubheading"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="^(.+)(\n)(=+)(\n)"><bygroups><token type="GenericHeading"/><token type="Text"/><token type="GenericHeading"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="^(.+)(\n)(-+)(\n)"><bygroups><token type="GenericSubheading"/><token type="Text"/><token type="GenericSubheading"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="^(\s*)([*-] )(\[[ xX]\])( .+\n)"><bygroups><token type="TextWhitespace"/><token type="Keyword"/><token type="Keyword"/><usingself state="inline"/></bygroups></rule>
|
||||
<rule pattern="^(\s*)([*-])(\s)(.+\n)"><bygroups><token type="TextWhitespace"/><token type="Keyword"/><token type="TextWhitespace"/><usingself state="inline"/></bygroups></rule>
|
||||
<rule pattern="^(\s*)([0-9]+\.)( .+\n)"><bygroups><token type="TextWhitespace"/><token type="Keyword"/><usingself state="inline"/></bygroups></rule>
|
||||
<rule pattern="^(\s*>\s)(.+\n)"><bygroups><token type="Keyword"/><token type="GenericEmph"/></bygroups></rule>
|
||||
<rule pattern="^(\s*```\n[\w\W]*?^\s*```$\n)"><token type="LiteralStringBacktick"/></rule>
|
||||
<rule pattern="(?x)
|
||||
^(?P<initial>\s*```)
|
||||
(?P<lang>[\w\-]+)
|
||||
(?P<afterlang>
|
||||
(?P<whitespace>[^\S\n]+)
|
||||
(?P<extra>.*))?
|
||||
(?P<newline>\n)
|
||||
(?P<code>(.|\n)*?)
|
||||
(?P<terminator>^\s*```$\n)
|
||||
">
|
||||
<!-- Implement actions for delegating via a capture group -->
|
||||
<token type="Text"/>
|
||||
</rule>
|
||||
<rule><include state="inline"/></rule>
|
||||
</state>
|
||||
<state name="inline">
|
||||
<rule pattern="\\."><token type="Text"/></rule>
|
||||
<rule pattern="([^`]?)(`[^`\n]+`)"><bygroups><token type="Text"/><token type="LiteralStringBacktick"/></bygroups></rule>
|
||||
<rule pattern="([^\*]?)(\*\*[^* \n][^*\n]*\*\*)"><bygroups><token type="Text"/><token type="GenericStrong"/></bygroups></rule>
|
||||
<rule pattern="([^_]?)(__[^_ \n][^_\n]*__)"><bygroups><token type="Text"/><token type="GenericStrong"/></bygroups></rule>
|
||||
<rule pattern="([^\*]?)(\*[^* \n][^*\n]*\*)"><bygroups><token type="Text"/><token type="GenericEmph"/></bygroups></rule>
|
||||
<rule pattern="([^_]?)(_[^_ \n][^_\n]*_)"><bygroups><token type="Text"/><token type="GenericEmph"/></bygroups></rule>
|
||||
<rule pattern="([^~]?)(~~[^~ \n][^~\n]*~~)"><bygroups><token type="Text"/><token type="GenericDeleted"/></bygroups></rule>
|
||||
<rule pattern="[@#][\w/:]+"><token type="NameEntity"/></rule>
|
||||
<rule pattern="(!?\[)([^]]+)(\])(\()([^)]+)(\))"><bygroups><token type="Text"/><token type="NameTag"/><token type="Text"/><token type="Text"/><token type="NameAttribute"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="(\[)([^]]+)(\])(\[)([^]]*)(\])"><bygroups><token type="Text"/><token type="NameTag"/><token type="Text"/><token type="Text"/><token type="NameLabel"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="^(\s*\[)([^]]*)(\]:\s*)(.+)"><bygroups><token type="Text"/><token type="NameLabel"/><token type="Text"/><token type="NameAttribute"/></bygroups></rule>
|
||||
<rule pattern="[^\\\s]+"><token type="Text"/></rule>
|
||||
<rule pattern="."><token type="Text"/></rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
|
34
lexers/moinwiki.xml
Normal file
34
lexers/moinwiki.xml
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
<lexer>
|
||||
<config>
|
||||
<name>MoinMoin/Trac Wiki markup</name>
|
||||
<alias>trac-wiki</alias>
|
||||
<alias>moin</alias>
|
||||
<mime_type>text/x-trac-wiki</mime_type>
|
||||
<case_insensitive>true</case_insensitive>
|
||||
</config>
|
||||
<rules>
|
||||
<state name="root">
|
||||
<rule pattern="^#.*$"><token type="Comment"/></rule>
|
||||
<rule pattern="(!)(\S+)"><bygroups><token type="Keyword"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="^(=+)([^=]+)(=+)(\s*#.+)?$"><bygroups><token type="GenericHeading"/><usingself state="root"/><token type="GenericHeading"/><token type="LiteralString"/></bygroups></rule>
|
||||
<rule pattern="(\{\{\{)(\n#!.+)?"><bygroups><token type="NameBuiltin"/><token type="NameNamespace"/></bygroups><push state="codeblock"/></rule>
|
||||
<rule pattern="(\'\'\'?|\|\||`|__|~~|\^|,,|::)"><token type="Comment"/></rule>
|
||||
<rule pattern="^( +)([.*-])( )"><bygroups><token type="Text"/><token type="NameBuiltin"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="^( +)([a-z]{1,5}\.)( )"><bygroups><token type="Text"/><token type="NameBuiltin"/><token type="Text"/></bygroups></rule>
|
||||
<rule pattern="\[\[\w+.*?\]\]"><token type="Keyword"/></rule>
|
||||
<rule pattern="(\[[^\s\]]+)(\s+[^\]]+?)?(\])"><bygroups><token type="Keyword"/><token type="LiteralString"/><token type="Keyword"/></bygroups></rule>
|
||||
<rule pattern="^----+$"><token type="Keyword"/></rule>
|
||||
<rule pattern="[^\n\'\[{!_~^,|]+"><token type="Text"/></rule>
|
||||
<rule pattern="\n"><token type="Text"/></rule>
|
||||
<rule pattern="."><token type="Text"/></rule>
|
||||
</state>
|
||||
<state name="codeblock">
|
||||
<rule pattern="\}\}\}"><token type="NameBuiltin"/><pop depth="1"/></rule>
|
||||
<rule pattern="\{\{\{"><token type="Text"/><push/></rule>
|
||||
<rule pattern="[^{}]+"><token type="CommentPreproc"/></rule>
|
||||
<rule pattern="."><token type="CommentPreproc"/></rule>
|
||||
</state>
|
||||
</rules>
|
||||
</lexer>
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user