Skip to content

Commit b1042a2

Browse files
committed
[reST] refactor
1 parent 829de45 commit b1042a2

15 files changed

+3223
-334
lines changed

RestructuredText/Comments.tmPreferences

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<plist version="1.0">
33
<dict>
4-
<key>name</key>
5-
<string>Miscellaneous</string>
64
<key>scope</key>
75
<string>text.restructuredtext</string>
86
<key>settings</key>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[
2+
// Auto-pair asterisks
3+
{
4+
"keys": ["*"],
5+
"command": "insert_snippet",
6+
"args": {"contents": "*${0:$SELECTION}*"},
7+
"context": [
8+
{ "key": "setting.auto_match_enabled"},
9+
{ "key": "selection_empty", "operand": false, "match_all": true },
10+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw" }
11+
]
12+
},
13+
{
14+
"keys": ["backspace"],
15+
"command": "run_macro_file",
16+
"args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"},
17+
"context": [
18+
{ "key": "setting.auto_match_enabled" },
19+
{ "key": "selection_empty", "match_all": true },
20+
{ "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" },
21+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\*$", "match_all": true },
22+
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\*", "match_all": true }
23+
]
24+
},
25+
26+
// Auto-pair underscore
27+
{
28+
"keys": ["_"],
29+
"command": "insert_snippet",
30+
"args": {"contents": "_${0:$SELECTION}_"},
31+
"context": [
32+
{ "key": "setting.auto_match_enabled"},
33+
{ "key": "selection_empty", "operand": false, "match_all": true },
34+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw" }
35+
]
36+
},
37+
{
38+
"keys": ["backspace"],
39+
"command": "run_macro_file",
40+
"args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"},
41+
"context": [
42+
{ "key": "setting.auto_match_enabled" },
43+
{ "key": "selection_empty", "match_all": true },
44+
{ "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" },
45+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "_$", "match_all": true },
46+
{ "key": "following_text", "operator": "regex_contains", "operand": "^_", "match_all": true }
47+
]
48+
},
49+
50+
// Auto-pair backticks
51+
{
52+
"keys": ["`"],
53+
"command": "insert_snippet",
54+
"args": {"contents": "`$0`"},
55+
"context": [
56+
{ "key": "setting.auto_match_enabled"},
57+
{ "key": "selection_empty", "match_all": true },
58+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" },
59+
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\\w`]$", "match_all": true },
60+
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|\\.|,|$)", "match_all": true }
61+
]
62+
},
63+
{
64+
"keys": ["`"],
65+
"command": "insert_snippet",
66+
"args": {"contents": "`${0:$SELECTION}`"},
67+
"context": [
68+
{ "key": "setting.auto_match_enabled"},
69+
{ "key": "selection_empty", "operand": false, "match_all": true },
70+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" }
71+
]
72+
},
73+
{
74+
"keys": ["`"],
75+
"command": "move",
76+
"args": {"by": "characters", "forward": true},
77+
"context": [
78+
{ "key": "setting.auto_match_enabled" },
79+
{ "key": "selection_empty", "operand": true, "match_all": true },
80+
{ "key": "selector", "operand": "text.restructuredtext markup.raw.inline - markup.raw.block - text.restructuredtext.embedded" },
81+
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
82+
]
83+
},
84+
{
85+
"keys": ["backspace"],
86+
"command": "run_macro_file",
87+
"args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"},
88+
"context": [
89+
{ "key": "setting.auto_match_enabled" },
90+
{ "key": "selection_empty", "match_all": true },
91+
{ "key": "selector", "operator": "equal", "operand": "punctuation.definition.raw.begin.restructuredtext" },
92+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
93+
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
94+
]
95+
}
96+
]

RestructuredText/Main.sublime-menu

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
[
2+
{
3+
"id": "preferences",
4+
"children":
5+
[
6+
{
7+
"caption": "Package Settings",
8+
"id": "package-settings",
9+
"children":
10+
[
11+
{
12+
"caption": "reStructuredText (reST)",
13+
"children":
14+
[
15+
{
16+
"caption": "Docutils ∙ Reference ∙ Introduction",
17+
"command": "open_url",
18+
"args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/introduction.html" }
19+
},
20+
{
21+
"caption": "Docutils ∙ Reference ∙ Markup Specification",
22+
"command": "open_url",
23+
"args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html" }
24+
},
25+
{
26+
"caption": "Docutils ∙ Reference ∙ Markup Specification ∙ Tables",
27+
"command": "open_url",
28+
"args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#tables" }
29+
},
30+
{
31+
"caption": "Docutils ∙ Reference ∙ Markup Specification ∙ Substitution References",
32+
"command": "open_url",
33+
"args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-references" }
34+
},
35+
{
36+
"caption": "Docutils ∙ Reference ∙ Directives",
37+
"command": "open_url",
38+
"args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/directives.html" }
39+
},
40+
{
41+
"caption": "Docutils ∙ Reference ∙ Interpreted Text Roles",
42+
"command": "open_url",
43+
"args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/roles.html" }
44+
},
45+
{
46+
"caption": "Docutils ∙ User ∙ Quickstart",
47+
"command": "open_url",
48+
"args": { "url": "https://docutils.sourceforge.io/docs/user/rst/quickstart.html" }
49+
},
50+
{
51+
"caption": "Docutils ∙ User ∙ Examples",
52+
"command": "open_url",
53+
"args": { "url": "https://docutils.sourceforge.io/docs/user/rst/demo.html" }
54+
},
55+
{
56+
"caption": "Docutils ∙ User ∙ Quick Reference",
57+
"command": "open_url",
58+
"args": { "url": "https://docutils.sourceforge.io/docs/user/rst/quickref.html" }
59+
},
60+
{ "caption": "-" },
61+
{
62+
"caption": "Sphinx ∙ Command Line Tools",
63+
"command": "open_url",
64+
"args": { "url": "https://www.sphinx-doc.org/en/master/man/index.html" }
65+
},
66+
{
67+
"caption": "Sphinx ∙ 'sphinx-build' Command Line",
68+
"command": "open_url",
69+
"args": { "url": "https://www.sphinx-doc.org/en/master/man/sphinx-build.html" }
70+
},
71+
{
72+
"caption": "Sphinx ∙ Documentation",
73+
"command": "open_url",
74+
"args": { "url": "https://www.sphinx-doc.org/en/master/" }
75+
},
76+
{
77+
"caption": "Sphinx ∙ Usage ∙ Configuration",
78+
"command": "open_url",
79+
"args": { "url": "https://www.sphinx-doc.org/en/master/usage/configuration.html" }
80+
},
81+
{
82+
"caption": "Sphinx ∙ Usage ∙ reST ∙ Directives",
83+
"command": "open_url",
84+
"args": { "url": "https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html" }
85+
},
86+
{
87+
"caption": "Sphinx ∙ Usage ∙ reST ∙ Directives ∙ Admonitions",
88+
"command": "open_url",
89+
"args": { "url": "https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#admonitions-messages-and-warnings" }
90+
},
91+
{
92+
"caption": "Sphinx ∙ Usage ∙ Referencing",
93+
"command": "open_url",
94+
"args": { "url": "https://www.sphinx-doc.org/en/master/usage/referencing.html" }
95+
},
96+
{
97+
"caption": "Sphinx ∙ Usage ∙ reST ∙ Interpreted Text Roles",
98+
"command": "open_url",
99+
"args": { "url": "https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html" }
100+
},
101+
{
102+
"caption": "Sphinx ∙ Glossary",
103+
"command": "open_url",
104+
"args": { "url": "https://www.sphinx-doc.org/en/master/glossary.html#term-environment" }
105+
}
106+
]
107+
}
108+
]
109+
}
110+
]
111+
}
112+
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
%YAML 1.2
2+
---
3+
# https://www.sphinx-doc.org/en/master/
4+
# http://www.sublimetext.com/docs/syntax.html
5+
6+
name: Sphinx reStructuredText
7+
scope: text.restructuredtext.sphinx
8+
version: 2
9+
10+
extends: Packages/RestructuredText/reStructuredText.sublime-syntax
11+
12+
###[ CONTEXTS ]################################################################
13+
14+
contexts:
15+
16+
main:
17+
- include: sphinx-restructuredtext
18+
19+
###[ SPHINX ]##################################################################
20+
21+
sphinx-restructuredtext:
22+
- include: restructuredtext
23+
24+
###[ VARIABLES ]###############################################################
25+
26+
# variables: {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<plist version="1.0">
3+
<dict>
4+
<!--
5+
https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#implicit-hyperlink-targets
6+
-->
7+
<key>scope</key>
8+
<string><![CDATA[
9+
meta.link.citation.def.restructuredtext constant.other.citation.link.restructuredtext - punctuation
10+
]]></string>
11+
<key>settings</key>
12+
<dict>
13+
<key>showInIndexedSymbolList</key>
14+
<integer>0</integer>
15+
<key>showInSymbolList</key>
16+
<integer>1</integer>
17+
</dict>
18+
</dict>
19+
</plist>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<plist version="1.0">
3+
<dict>
4+
<!--
5+
https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#implicit-hyperlink-targets
6+
-->
7+
<key>scope</key>
8+
<string><![CDATA[
9+
meta.link.footnote.def.restructuredtext constant.other.footnote.link.restructuredtext - punctuation
10+
]]></string>
11+
<key>settings</key>
12+
<dict>
13+
<key>showInIndexedSymbolList</key>
14+
<integer>0</integer>
15+
<key>showInSymbolList</key>
16+
<integer>1</integer>
17+
</dict>
18+
</dict>
19+
</plist>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<plist version="1.0">
3+
<dict>
4+
<!--
5+
https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#implicit-hyperlink-targets
6+
-->
7+
<key>scope</key>
8+
<string><![CDATA[
9+
markup.heading.restructuredtext entity.name.section.restructuredtext - punctuation
10+
]]></string>
11+
<key>settings</key>
12+
<dict>
13+
<key>showInIndexedSymbolList</key>
14+
<integer>1</integer>
15+
<key>showInSymbolList</key>
16+
<integer>1</integer>
17+
</dict>
18+
</dict>
19+
</plist>

0 commit comments

Comments
 (0)