Skip to content

Commit cb14eea

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

13 files changed

+3941
-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: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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 colon
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 underscore
51+
{
52+
"keys": ["_"],
53+
"command": "insert_snippet",
54+
"args": {"contents": "_${0:$SELECTION}_"},
55+
"context": [
56+
{ "key": "setting.auto_match_enabled"},
57+
{ "key": "selection_empty", "operand": false, "match_all": true },
58+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw" }
59+
]
60+
},
61+
{
62+
"keys": ["backspace"],
63+
"command": "run_macro_file",
64+
"args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"},
65+
"context": [
66+
{ "key": "setting.auto_match_enabled" },
67+
{ "key": "selection_empty", "match_all": true },
68+
{ "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" },
69+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "_$", "match_all": true },
70+
{ "key": "following_text", "operator": "regex_contains", "operand": "^_", "match_all": true }
71+
]
72+
},
73+
74+
// Auto-pair backticks
75+
{
76+
"keys": ["`"],
77+
"command": "insert_snippet",
78+
"args": {"contents": "`$0`"},
79+
"context": [
80+
{ "key": "setting.auto_match_enabled"},
81+
{ "key": "selection_empty", "match_all": true },
82+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" },
83+
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\\w`]$", "match_all": true },
84+
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|\\.|,|$)", "match_all": true }
85+
]
86+
},
87+
{
88+
"keys": ["`"],
89+
"command": "insert_snippet",
90+
"args": {"contents": "`${0:$SELECTION}`"},
91+
"context": [
92+
{ "key": "setting.auto_match_enabled"},
93+
{ "key": "selection_empty", "operand": false, "match_all": true },
94+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" }
95+
]
96+
},
97+
{
98+
"keys": ["`"],
99+
"command": "move",
100+
"args": {"by": "characters", "forward": true},
101+
"context": [
102+
{ "key": "setting.auto_match_enabled" },
103+
{ "key": "selection_empty", "operand": true, "match_all": true },
104+
{ "key": "selector", "operand": "text.restructuredtext markup.raw.inline - markup.raw.block - text.restructuredtext.embedded" },
105+
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
106+
]
107+
},
108+
{
109+
"keys": ["backspace"],
110+
"command": "run_macro_file",
111+
"args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"},
112+
"context": [
113+
{ "key": "setting.auto_match_enabled" },
114+
{ "key": "selection_empty", "match_all": true },
115+
{ "key": "selector", "operator": "equal", "operand": "punctuation.definition.raw.begin.restructuredtext" },
116+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
117+
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
118+
]
119+
}
120+
]

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: 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#hyperlink-targets
6+
-->
7+
<key>scope</key>
8+
<string><![CDATA[
9+
meta.link.target.restructuredtext meta.link.target.anchor
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)