Commits

Eric Knibbe committed 2abfec1 Draft

minor fixes for directives & substitutions

  • Participants
  • Parent commits 3d294a3

Comments (0)

Files changed (3)

   Language module for BBEdit and TextWrangler which highlights elements 
   in reStructuredText files and lists section titles in the function pop-up
   menu. Recognizes both standard reST directives and Sphinx additions.
+  
+  I recommend also setting these options for editing reStructuredText: enabling
+  auto-indent and auto-expand tabs, setting tab width to 3 spaces, disabling 
+  soft wrap text, and setting the page guide to 80 characters. 
 
 JavaScript
 ----------
 
 .. _restview: http://mg.pov.lt/restview/
 .. _Pygments: http://pygments.org/
-.. _Twitter: https://twitter.com/EricFromCanada
+.. _Twitter: https://twitter.com/EricFromCanada

File bbedit/reStructuredText.plist

 <!--
 	BBEdit codeless language module for reStructuredText files.
 	Eric Knibbe
-	Version 1.0
+	Version 1.1
 
 	Parses each section title as a function name so they show up in the function
 	popup. (Can't indent them according to heading level nor nest fold markers in
 	Known issues:
 	- skips highlighting directives as keywords if a space comes before the ::
 	- BB/TW may skip highlighting comments starting on the file's 1st or 2nd line
+	- can't highlight comments sharing a line with or directly following
+	  directives due to a limitation with regular expressions
 	- generally requires backticks within backtick-delimited markup to be escaped
 	- highlights directives containing single colons as comments,
 	  e.g. directives specifying a non-standard Sphinx domain
 		<string>-\w.:</string>
 		<key>String Pattern</key>
 		<string><![CDATA[(?x:
-			(?<![\w~@#$%^&*)\]}>|+=\\;.,!?]|\\`):(?!\s)
-			(\\:|:(?=[a-z0-9])|[^:\r])+
+			(?<![\w~@#$%^&*)\]}>|+=\\;.,!?]|\\`):(?![:\s])
+			(\\:|:(?=[a-z0-9])|[^:,([{<)\]}>\r])+
 			(?<!\s):(?!(?P<end>[\w~@#$%^&*([{<|+=])|])       | (?# role/directive option/field name)
-			(?<![\w~@#$%^&*)\]}>|+=\\;.,!?`])\|(?!\s)
+			(?<![\w~@#$%^&*)\]}>|+=\\;.,!?`])\|(?![|\s])
 			(\|(?=(?P>end)|`)|[^|\r])+
 			(?<![\s\\])\|_{0,2}(?!(?P>end)|`)                | (?# substitution)
 			(?<![_~@#$%^&*)\]}>|+=\\;.,!?`])\b[a-z0-9]
 <h1>BBEdit</h1>
 <dl class="docutils">
 <dt><a class="reference external" href="https://bitbucket.org/EricFromCanada/ericfromcanada.bitbucket.org/raw/default/bbedit/reStructuredText.plist">reST codeless language module</a></dt>
-<dd>Language module for BBEdit and TextWrangler which highlights elements
+<dd><p class="first">Language module for BBEdit and TextWrangler which highlights elements
 in reStructuredText files and lists section titles in the function pop-up
-menu. Recognizes both standard reST directives and Sphinx additions.</dd>
+menu. Recognizes both standard reST directives and Sphinx additions.</p>
+<p class="last">I recommend also setting these options for editing reStructuredText: enabling
+auto-indent and auto-expand tabs, setting tab width to 3 spaces, disabling
+soft wrap text, and setting the page guide to 80 characters.</p>
+</dd>
 </dl>
 </div>
 <div class="section" id="javascript">