2015-05-09 23:00:50 +03:00
|
|
|
# http://asciidoc.org/
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2016-12-06 16:46:25 +03:00
|
|
|
hook global BufCreate .+\.(a(scii)?doc|asc) %{
|
2017-11-03 10:34:41 +03:00
|
|
|
set-option buffer filetype asciidoc
|
2016-12-06 16:46:25 +03:00
|
|
|
}
|
2012-08-08 21:38:27 +04:00
|
|
|
|
2019-04-10 06:54:19 +03:00
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{
|
2019-03-13 08:24:33 +03:00
|
|
|
require-module asciidoc
|
2019-04-10 06:54:19 +03:00
|
|
|
|
|
|
|
add-highlighter window/asciidoc ref asciidoc
|
|
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc }
|
2019-03-13 08:24:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
provide-module asciidoc %{
|
|
|
|
|
2015-05-09 23:00:50 +03:00
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2018-06-28 14:08:58 +03:00
|
|
|
add-highlighter shared/asciidoc group
|
|
|
|
|
2020-07-23 06:15:55 +03:00
|
|
|
# Titles and headers (multi-line style)
|
2018-06-28 14:08:58 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n={2,}\h*$ 0:title
|
|
|
|
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n-{2,}\h*$ 0:header
|
|
|
|
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n~{2,}\h*$ 0:header
|
|
|
|
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n\^{2,}\h*$ 0:header
|
|
|
|
|
2020-07-23 06:15:55 +03:00
|
|
|
# Titles and headerss (one-line style)
|
2018-06-28 14:08:58 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex (\A|\n\n)=\h+[^\n]+$ 0:title
|
|
|
|
add-highlighter shared/asciidoc/ regex (\A|\n\n)={2,}\h+[^\n]+$ 0:header
|
|
|
|
|
2020-07-23 06:15:55 +03:00
|
|
|
# Comments
|
2020-06-02 11:50:13 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex ^//(?:[^\n/][^\n]*|)$ 0:comment
|
|
|
|
add-highlighter shared/asciidoc/ regex ^(/{4,}).*?\n(/{4,})$ 0:comment
|
|
|
|
|
2020-07-23 07:00:52 +03:00
|
|
|
# List titles
|
|
|
|
add-highlighter shared/asciidoc/ regex ^\.[^\h\W][^\n]*$ 0:title
|
|
|
|
|
2020-07-23 06:15:55 +03:00
|
|
|
# Bulleted lists
|
2020-07-23 04:28:06 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex ^\h*(?<bullet>[-\*])\h+[^\n]+$ 0:list bullet:bullet
|
|
|
|
add-highlighter shared/asciidoc/ regex ^\h*(?<bullet>[-\*]+)\h+[^\n]+(\n\h+[^-\*\n]*)?$ 0:list bullet:bullet
|
2020-07-23 06:15:55 +03:00
|
|
|
|
|
|
|
# Blocks
|
2018-06-28 14:08:58 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex ^(-{3,})\n[^\n\h].*?\n(-{3,})$ 0:block
|
|
|
|
add-highlighter shared/asciidoc/ regex ^(={3,})\n[^\n\h].*?\n(={3,})$ 0:block
|
|
|
|
add-highlighter shared/asciidoc/ regex ^(~{3,})\n[^\n\h].*?\n(~{3,})$ 0:block
|
|
|
|
add-highlighter shared/asciidoc/ regex ^(\*{3,})\n[^\n\h].*?\n(\*{3,})$ 0:block
|
2020-07-23 06:15:55 +03:00
|
|
|
|
|
|
|
# Monospaced text
|
2018-06-28 14:08:58 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex \B(?:\+[^\n]+?\+|`[^\n]+?`)\B 0:mono
|
2020-07-23 06:15:55 +03:00
|
|
|
|
|
|
|
# Bolded text
|
2020-07-23 04:28:06 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex \s\*[^\n\*]+\*\B 0:+b
|
|
|
|
add-highlighter shared/asciidoc/ regex \h\*[^\n\*]+\*\B 0:+b
|
2020-07-23 06:38:58 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex \*{2}(?!\h)[^\n\*]+\*{2} 0:+b
|
2020-07-23 06:15:11 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex \h\*{2}[^\n\*]+\*{2} 0:+b
|
2020-07-23 06:15:55 +03:00
|
|
|
|
2020-07-23 06:38:58 +03:00
|
|
|
# Italicized text
|
|
|
|
# (these are simpler since they aren't able to _also_ be bullet characters.)
|
|
|
|
add-highlighter shared/asciidoc/ regex \b_[^\n]+?_\b 0:+i
|
|
|
|
add-highlighter shared/asciidoc/ regex __[^\n]+?__ 0:+i
|
|
|
|
|
2020-07-23 06:15:55 +03:00
|
|
|
# Attributes
|
2020-07-23 07:01:04 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex ^:(?:(?<neg>!?)[-\w]+|[-\w]+(?<neg>!?)): 0:meta neg:operator
|
2020-07-23 06:16:04 +03:00
|
|
|
add-highlighter shared/asciidoc/ regex [^\\](\{[-\w]+\})[^\\]? 1:meta
|
2015-05-09 23:00:50 +03:00
|
|
|
|
|
|
|
# Commands
|
|
|
|
# ‾‾‾‾‾‾‾‾
|
|
|
|
|
2019-03-13 08:24:33 +03:00
|
|
|
}
|