-
Notifications
You must be signed in to change notification settings - Fork 3
/
reST.nanorc
137 lines (137 loc) · 5.65 KB
/
reST.nanorc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
## Syntax definition for reST with GNU Nano
##
## (C) 02/2013 Lilian Besson (lilian DOT besson AT normale DOT fr)
## Last version : http://besson.qc.to/NanoSyntax/reST.nanorc
##
##############################################################################
# Definition of the name of the syntax : rst
# and capture of the extension : *.rst *.rest *.pytorst
syntax "rst" "\.rest$" "\.rst$" "\.pytorst$"
header "^.*"
##############################################################################
# Numbers
color white "-?[0-9\.][0-9\._,]*([eE]-?)?[0-9\._,]*"
# code block
color brightred,black "(::|FIXME|TODO|NEW|XXX|HOWTO|DEBUG|WARNING|PEP)"
# wrong links (empty)
color white,red "[a-z][a-z]+://[^([[:alnum:]]|[\]\[])]*"
# literals blocks (quotation) like in emails
color red "^ *>+.*$"
# Specials zones
color yellow "\$[^\$]+\$"
# unknown interpreted text
color green,black "`[[:alnum:]]+`"
# anon link targets
color brightgreen "[[:alnum:]]+_[^[[:alnum:]]]"
color cyan "^[[:blank:]]*__ .*$"
# highligths (fixme)
# color brightmagenta "[^`]?`([[:alnum:]]|[[:space:]]|[,-\.\+\(\)\|\[\])+`[^`]?"
color brightmagenta "`([[:alnum:]]|[,-\.\+\(\)\|\[\])+`"
color magenta,black "`([[:alnum:]]|[[:space:]]|[,-\.\+\(\)\|\[\])+`\\"
# Balise <truc> et </truc>, pour embarquer du JavaScript notamment.
color brightblue,black "</?[[:alnum:]]+([[:space:]]+[[:alnum:]]*=\"[^\"]*\")*>"
##############################################################################
#
# Comments and directives
#
# comments
color blue "^\.\. [^[\[_]]*.*$"
# unknown directives
color brightwhite,red "^([[:blank:]]|\|)*\.\. [a-z][a-zA-Z0-9_-]*::.*$"
# usual rst (docutils) directives
icolor brightcyan "^([[:blank:]]|\|)*\.\. (warning|attention|caution|danger|error|hint|important|note|tip|image|figure|contents|container|rubric|topic|sidebar|parsed-literal|epigraph|highlights|pull-quote|compound|table|csv-table|list-table|raw|include|class|meta|title|default-role|role|section-numbering|admonition)*::.*$"
# sphinx directives
color brightcyan "^([[:blank:]]|\|)*\.\. (code-block|literalinclude|senctionauthor|codeauthor|index|only|tabularcolumns|productionlist|glossary|hlist|rubric|centered|seealso|deprecated|versionchanged|versionadded|toctree|function|warning|module|data|dex-table|testcode|testoutput|autofunction)*::.*$"
# sphinx extensions directives
color brightcyan "^([[:blank:]]|\|)*\.\. (gnuplot|runblock|math|todo|todolist|graphviz|digraph|graph|pypi-release)*::.*$"
# rst2s5 additionals directives
color brightcyan "^([[:blank:]]|\|)*\.\. (footer|target-notes)*::.*$"
# directives options
# color cyan "^([[:blank:]]|\|)*:[a-zA-Z][a-zA-Z0-9-]*([[:blank:]]*[[:alnum:]]+(=[[:alnum:]]+)?)*: *"
color cyan ":[a-zA-Z][a-zA-Z0-9-]*([[:blank:]]*[[:alnum:]]+(=[[:alnum:]]+)?)*: *"
##############################################################################
#
# Lists, and tables
#
# lists (not yet perfect)
color brightwhite "(^ *[\*\+-]([[:blank:]]| *[\*\+-])+)|(^ *#\.[[:blank:]]+)|(^ *[0-9]+\.[[:blank:]]+)|(^ *[\(]?[a-z]+[\.\)][[:blank:]]+)|(^ *[\(]?[A-Z]+[\.\)][[:blank:]]+)"
# options lists
color white "^ *([/\+\-]{1,2}[a-zA-Z0-9][[:blank:]]?([[:alnum:]]|_)*[,=]*([[:alnum:]]|_)*[[:blank:]]*)+"
# tables
color white,red "\+--(-+\+)*-+"
color white "\+--(-+\+)*-+\+"
color brightwhite,red "\+==(=+\+)*=+"
color brightwhite "\+==(=+\+)*=+\+"
color brightwhite "^ *==+([[:blank:]]+==+)+"
# special caracter '|' : for tables and for line blocks
color brightwhite "\|"
##############################################################################
#
# Citations and footnotes
#
# Citations
color brightwhite "(\[[[:alnum:]]+\]_)|(^\.\. \[[[:alnum:]]+\])"
# Footnotes
color white "(\[#\*\]_)|(^\.\. \[\*\])"
color white "(\[#[[:alnum:]]*\]_)|(^\.\. \[#[[:alnum:]]*\])"
# Substitutions
color brightblack "(\|[[:alnum:]]+\||^\.\. \|[[:alnum:]]+\| .*)"
##############################################################################
#
# Links and others:
#
# link reference
color brightgreen "((`[^`]+`_{1,2})|([[:blank:]]*\.\. _[[:alnum:]]+.*: .*$))"
# targets
color brightgreen "^ *\.\. _[[:alnum:]]+:"
# email
icolor brightred,black "(mailto:)?[[:alnum:]]([[:alnum:]]|[_\.\[\]\--]|\.|-)*(@|AT)[[:alnum:]]([[:alnum:]]|[_\.\[\]\--]|\.|-)*\.[[:alnum:]]+"
# http, ftp, https, apt, links
icolor red,black "[a-z][a-z]+://[[:alnum:]]([[:alnum:]]|[-_\.~#\?:=%&])*([[:alnum:]]|[-/_\.~#\?:=%&;])*"
##############################################################################
#
# Markup for bold, italics and code
#
# italics
color red "\*[[:alnum:]]([[:alnum:]]|[[:space:]]|-|,|;|\.|'|\$|\\|/)*\*\\?"
color brightmagenta "\"[a-zA-Z]([[:alnum:]]|[[:space:]]|-|,|;|\.|'|\$|\\|/)*\"\\?"
color brightmagenta "'[a-zA-Z]([[:alnum:]]|-|,|;|\.|'|\$|\\|/)*'\\?"
color brightmagenta "“[a-zA-Z]([[:alnum:]]|-|,|;|\.|'|\$|\\|/)*”\\?"
# bold
color brightyellow "\*\*[^*^*]+\*\*\\?"
# error handling
color brightred,black "\|\*\*\*[^*]+\*\*\*\|"
# unknown interpreted texts
color yellow ":[[:alnum:]]+:`[^`]+`\\?"
color yellow "`[^`]+`:[[:alnum:]]+:\\?"
# eq and others
color brightyellow ":(PEP|RFC|sub|sup|strong|code|emphasis|strong|literal):`[^`]+`\\?"
# math
color brightyellow,black ":math:`[^`]+`\\?"
# specials comments (un handle by previous rules)
color red "^\.\. \(c\).*$"
# code
color white,red "``.+``"
#color white,red start="``" end="``"
color yellow "``[^`]+``\\?"
##############################################################################
#
# Titles
#
# h1
color brightyellow "^###+$"
color yellow "^\*\*\*+$"
# h2
color brightmagenta "^===+$"
# h3
color brightred "^---+$"
# h4
color brightblue "^\^\^\^+$"
# h5
color blue "^"""+$"
# h6
color brightmagenta "^~~~+$"
# inline markups
color brightmagenta,black "^```+$"
## END
##############################################################################