Skip to content

Commit 0337f7b

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

18 files changed

Lines changed: 4176 additions & 334 deletions

RestructuredText/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

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: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
[
2+
// {
3+
// "keys": ["ctrl+alt+l"],
4+
// "command": "restructuredtext_encapsulate_literal",
5+
// "context":
6+
// [
7+
// { "key": "selector", "operand": "text.restructuredtext"},
8+
// { "key": "selection_empty", "operand": false, "match_all": true },
9+
// ]
10+
// },
11+
12+
// {
13+
// "keys": ["ctrl+alt+t"],
14+
// "command": "restructuredtext_encapsulate_interpreted_text_role",
15+
// "args": {
16+
// "role_name": "term"
17+
// },
18+
// "context":
19+
// [
20+
// { "key": "selector", "operand": "text.restructuredtext"},
21+
// { "key": "selection_empty", "operand": false, "match_all": true },
22+
// ]
23+
// },
24+
25+
// Auto-pair asterisks
26+
{
27+
"keys": ["*"],
28+
"command": "insert_snippet",
29+
"args": {"contents": "*${0:$SELECTION}*"},
30+
"context": [
31+
{ "key": "setting.auto_match_enabled"},
32+
{ "key": "selection_empty", "operand": false, "match_all": true },
33+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw" }
34+
]
35+
},
36+
{
37+
"keys": ["backspace"],
38+
"command": "run_macro_file",
39+
"args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"},
40+
"context": [
41+
{ "key": "setting.auto_match_enabled" },
42+
{ "key": "selection_empty", "match_all": true },
43+
{ "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" },
44+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\*$", "match_all": true },
45+
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\*", "match_all": true }
46+
]
47+
},
48+
49+
// Auto-pair colon
50+
{
51+
"keys": [":"],
52+
"command": "insert_snippet",
53+
"args": {"contents": ":${0:$SELECTION}:"},
54+
"context": [
55+
{ "key": "setting.auto_match_enabled"},
56+
{ "key": "selection_empty", "operand": false, "match_all": true },
57+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw" }
58+
]
59+
},
60+
{
61+
"keys": ["backspace"],
62+
"command": "run_macro_file",
63+
"args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"},
64+
"context": [
65+
{ "key": "setting.auto_match_enabled" },
66+
{ "key": "selection_empty", "match_all": true },
67+
{ "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" },
68+
{ "key": "preceding_text", "operator": "regex_contains", "operand": ":$", "match_all": true },
69+
{ "key": "following_text", "operator": "regex_contains", "operand": "^:", "match_all": true }
70+
]
71+
},
72+
73+
// Auto-pair underscore
74+
{
75+
"keys": ["_"],
76+
"command": "insert_snippet",
77+
"args": {"contents": "_${0:$SELECTION}_"},
78+
"context": [
79+
{ "key": "setting.auto_match_enabled"},
80+
{ "key": "selection_empty", "operand": false, "match_all": true },
81+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw" }
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": "text.restructuredtext - markup.raw" },
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+
97+
// Auto-pair backticks
98+
{
99+
"keys": ["`"],
100+
"command": "insert_snippet",
101+
"args": {"contents": "`$0`"},
102+
"context": [
103+
{ "key": "setting.auto_match_enabled"},
104+
{ "key": "selection_empty", "match_all": true },
105+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" },
106+
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\\w`]$", "match_all": true },
107+
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|\\.|,|$)", "match_all": true }
108+
]
109+
},
110+
{
111+
"keys": ["`"],
112+
"command": "insert_snippet",
113+
"args": {"contents": "`${0:$SELECTION}`"},
114+
"context": [
115+
{ "key": "setting.auto_match_enabled"},
116+
{ "key": "selection_empty", "operand": false, "match_all": true },
117+
{ "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" }
118+
]
119+
},
120+
{
121+
"keys": ["`"],
122+
"command": "move",
123+
"args": {"by": "characters", "forward": true},
124+
"context": [
125+
{ "key": "setting.auto_match_enabled" },
126+
{ "key": "selection_empty", "operand": true, "match_all": true },
127+
{ "key": "selector", "operand": "text.restructuredtext markup.raw.inline - markup.raw.block - text.restructuredtext.embedded" },
128+
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
129+
]
130+
},
131+
{
132+
"keys": ["backspace"],
133+
"command": "run_macro_file",
134+
"args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"},
135+
"context": [
136+
{ "key": "setting.auto_match_enabled" },
137+
{ "key": "selection_empty", "match_all": true },
138+
{ "key": "selector", "operator": "equal", "operand": "punctuation.definition.raw.begin.restructuredtext" },
139+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
140+
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
141+
]
142+
}
143+
]
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<plist version="1.0">
3+
<dict>
4+
<key>scope</key>
5+
<string>text.restructuredtext</string>
6+
<key>settings</key>
7+
<dict>
8+
<key>foldScopes</key>
9+
<array>
10+
<dict>
11+
<key>begin</key>
12+
<string>punctuation.section.block.begin</string>
13+
<key>end</key>
14+
<string>punctuation.section.block.end</string>
15+
</dict>
16+
<dict>
17+
<key>begin</key>
18+
<string>punctuation.definition.generic.begin</string>
19+
<key>end</key>
20+
<string>punctuation.definition.generic.end</string>
21+
</dict>
22+
<dict>
23+
<key>begin</key>
24+
<string>punctuation.definition.constant.begin</string>
25+
<key>end</key>
26+
<string>punctuation.definition.constant.end</string>
27+
</dict>
28+
<dict>
29+
<key>begin</key>
30+
<string>meta.fold.raw-code-directive.begin</string>
31+
<key>end</key>
32+
<string>meta.fold.raw-code-directive.end</string>
33+
</dict>
34+
<dict>
35+
<key>begin</key>
36+
<string>punctuation.definition.substitution.begin</string>
37+
<key>end</key>
38+
<string>punctuation.definition.substitution.end</string>
39+
</dict>
40+
<dict>
41+
<key>begin</key>
42+
<string>punctuation.definition.bold.begin</string>
43+
<key>end</key>
44+
<string>punctuation.definition.bold.end</string>
45+
</dict>
46+
<dict>
47+
<key>begin</key>
48+
<string>punctuation.definition.italic.begin</string>
49+
<key>end</key>
50+
<string>punctuation.definition.italic.end</string>
51+
</dict>
52+
<dict>
53+
<key>begin</key>
54+
<string>punctuation.definition.raw.begin</string>
55+
<key>end</key>
56+
<string>punctuation.definition.raw.end</string>
57+
</dict>
58+
<dict>
59+
<key>begin</key>
60+
<string>punctuation.definition.link.begin</string>
61+
<key>end</key>
62+
<string>punctuation.definition.link.end</string>
63+
</dict>
64+
<dict>
65+
<key>begin</key>
66+
<string>punctuation.definition.location.begin</string>
67+
<key>end</key>
68+
<string>punctuation.definition.location.end</string>
69+
</dict>
70+
<dict>
71+
<key>begin</key>
72+
<string>punctuation.definition.markup-interpreted.begin</string>
73+
<key>end</key>
74+
<string>punctuation.definition.markup-interpreted.end</string>
75+
</dict>
76+
<dict>
77+
<key>begin</key>
78+
<string>punctuation.definition.footnote-reference.begin</string>
79+
<key>end</key>
80+
<string>punctuation.definition.footnote-reference.end</string>
81+
</dict>
82+
<!--
83+
<dict>
84+
<key>begin</key>
85+
<string>punctuation.section.braces.begin</string>
86+
<key>end</key>
87+
<string>punctuation.section.braces.end</string>
88+
</dict>
89+
<dict>
90+
<key>begin</key>
91+
<string>punctuation.section.brackets.begin</string>
92+
<key>end</key>
93+
<string>punctuation.section.brackets.end</string>
94+
</dict>
95+
<dict>
96+
<key>begin</key>
97+
<string>punctuation.section.group.begin</string>
98+
<key>end</key>
99+
<string>punctuation.section.group.end</string>
100+
</dict>
101+
-->
102+
</array>
103+
<key>indentationFoldingEnabled</key>
104+
<false/>
105+
</dict>
106+
</dict>
107+
</plist>

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" }
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>

0 commit comments

Comments
 (0)