Re: [gedit-list] Add reStructuredText .lang file in gtksourceview



Guillaume Chéreau a écrit le 2011-05-03 12:37 :
> I am not sure this is the proper place to ask this, but is there any
> plan to add the reStructuredText lang file (rst.lang) in the sources
> of gtksourceview ?
> I am using ubuntu and it seems that there is no package that can
> provides me syntax highlighting for this common markup language on
> gedit.
> 
> The file can be found for example in the gedit-rst-plugin package of
> opensuse by sergiopasra [1].

You can add support for other languages by manually putting syntax
highlighting files in your home directory. To do so for
reStructuredText, put the attached file in the following directory:

/home/YOU/.local/share/gtksourceview-2.0/language-specs/

Create folder if it doesn't exist.

Regards,

Jean-Philippe
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language _name="reStructuredText" version="1.0" _section="Markup" mimetypes="text/restructured">

	<pattern-item _name="Emphasis" style="Preprocessor">
		<regex>(\*[^*\n]*\*)</regex>
	</pattern-item>
	
	<pattern-item _name="Strong Emphasis" style="Data Type">
		<regex>(\*\*[^*\n]*\*\*)</regex>
	</pattern-item>

	<pattern-item _name="Link" style="String">
		<regex>`[^`]*`_</regex>
	</pattern-item>
	
	<pattern-item _name="WikiLink" style="Link">
		<regex>\[\[[^\n]+\]\]</regex>
	</pattern-item>
	
	<pattern-item _name="List item" style="Keyword">
		<regex>(^ *\*[ \t]+)|(^ *[0-9]+\.[ \t]+)</regex>
	</pattern-item>
	
	<pattern-item _name="Line" style="Data Type">
		<regex>^[ \t]*[-=]+[ \t]*$</regex>
	</pattern-item>
	
	<pattern-item _name="Automatic link" style="String" end-at-line-end = "TRUE">
		<regex>(&lt;[A-Za-z._0-9]+@[A-Za-z0-9]+.[A-Za-z]+&gt;)|(&lt;[a-z]+://[^ \n]+&gt;)</regex>
	</pattern-item>

	<block-comment _name = "Code block" style= "Comment">
	    <start-regex>::\n\n    </start-regex>
	    <end-regex>\n\n</end-regex>
	</block-comment>
	
	<pattern-item _name="Inline Code" style="Comment">
		<regex>``[^``]*``</regex>
	</pattern-item>

	<string _name="Directive" style="Comment">
	    <start-regex>^\.\. </start-regex>
	    <end-regex>$</end-regex>
	</string>


</language>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]