Skip to content

Instantly share code, notes, and snippets.

@ErisBlastar
Created June 17, 2014 22:03
Show Gist options
  • Save ErisBlastar/c9f239609dd820d33cff to your computer and use it in GitHub Desktop.
Save ErisBlastar/c9f239609dd820d33cff to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of GtkSourceView
Authors: Duncan Coutts
Copyright (C) 2007 Duncan Coutts <duncan@haskell.org>
GtkSourceView is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
GtkSourceView is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->
<language id="haskell-literate" _name="Literate Haskell" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">text/x-literate-haskell</property>
<property name="globs">*.lhs</property>
</metadata>
<styles>
<style id="url" _name="URL" map-to="def:underlined"/>
<style id="link-text" _name="Link Text" map-to="def:identifier"/>
<style id="emphasis" _name="Emphasis" map-to="def:doc-comment-element"/>
<style id="strong-emphasis" _name="Strong Emphasis" map-to="xml:namespace"/>
</styles>
<definitions>
<context id="haskell-literate">
<include>
<context ref="def:shebang"/>
<context ref="c:if0-comment"/>
<context ref="c:include"/>
<context ref="c:preprocessor"/>
<context ref="def:in-comment"/>
<context id="line-code" end-at-line-end="true">
<start>^&gt;</start>
<include>
<context ref="haskell:body"/>
</include>
</context>
<context id="block-code">
<start>^\\begin\{code\}</start>
<end>^\\end\{code\}</end>
<include>
<context ref="haskell:body" />
</include>
</context>
<!-- following code from markdown highlighter syntax: -->
<!-- Examples:
<user@example.com>
<http://www.example.com/>
-->
<!-- Note: regular expressions are based from function `_DoAutoLinks` from
Markdown.pl (see <http://daringfireball.net/projects/markdown/>). -->
<context id="automatic-link" class="no-spell-check">
<match case-sensitive="false" extended="true">
&lt;
(((mailto:)?[a-z0-9.-]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+) | # E-mail.
((https?|ftp):[^'">\s]+)) # URL.
&gt;
</match>
<include>
<context sub-pattern="1" style-ref="url"/>
</include>
</context>
<!-- Examples:
[link text](http://www.example.com/)
[link text](<http://www.example.com/>)
[link text]( /folder/page.html "Title" )
-->
<context id="inline-link">
<match extended="true">
\[(.*?)\] # Link text.
\( # Literal opening parenthesis.
[ \t]* # Optional spaces or tabs after the opening parenthesis.
(&lt;(.*?)&gt; | # URL with brackets.
(.*?)) # URL without brackets.
([ \t]+(".*?"))? # Optional title.
[ \t]* # Optional spaces or tabs before the closing parenthesis.
\) # Literal closing parenthesis.
</match>
<include>
<context sub-pattern="1" style-ref="link-text"/>
<context sub-pattern="3" class="no-spell-check" style-ref="url"/>
<context sub-pattern="4" class="no-spell-check" style-ref="url"/>
<context sub-pattern="6" style-ref="attribute-value"/>
</include>
</context>
<!-- Examples:
Lorem _ipsum dolor_ sit amet.
Here's an _emphasized text containing an underscore (\_)_.
-->
<context id="underscores-emphasis" style-ref="emphasis">
<match>(?&lt;!_)_[^_ \t].*?(?&lt;!\\|_| |\t)_(?!_)</match>
</context>
<!-- Examples:
Lorem *ipsum dolor* sit amet.
Here's an *emphasized text containing an asterisk (\*)*.
-->
<context id="asterisks-emphasis" style-ref="emphasis">
<match>(?&lt;!\*)\*[^\* \t].*?(?&lt;!\\|\*| |\t)\*(?!\*)</match>
</context>
<!-- Examples:
Lorem __ipsum dolor__ sit amet.
Here's a __strongly emphasized text containing an underscore (\_)__.
-->
<context id="underscores-strong-emphasis" style-ref="strong-emphasis">
<match>__[^_ \t].*?(?&lt;!\\|_| |\t)__</match>
</context>
<!-- Examples:
Lorem **ipsum dolor** sit amet.
Here's a **strongly emphasized text containing an asterisk (\*).**
-->
<context id="asterisks-strong-emphasis" style-ref="strong-emphasis">
<match>\*\*[^\* \t].*?(?&lt;!\\|\*| |\t)\*\*</match>
</context>
<!-- end markdown code -->
</include>
</context>
</definitions>
</language>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment