2015-05-09 22:00:50 +02:00
|
|
|
# http://asciidoc.org/
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2016-12-06 14:46:25 +01:00
|
|
|
hook global BufCreate .+\.(a(scii)?doc|asc) %{
|
2017-11-03 08:34:41 +01:00
|
|
|
set-option buffer filetype asciidoc
|
2016-12-06 14:46:25 +01:00
|
|
|
}
|
2012-08-08 19:38:27 +02:00
|
|
|
|
2019-04-10 05:54:19 +02:00
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{
|
2019-03-13 06:24:33 +01:00
|
|
|
require-module asciidoc
|
2019-04-10 05:54:19 +02:00
|
|
|
|
|
|
|
add-highlighter window/asciidoc ref asciidoc
|
|
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc }
|
2019-03-13 06:24:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
provide-module asciidoc %{
|
|
|
|
|
2015-05-09 22:00:50 +02:00
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2018-06-28 13:08:58 +02:00
|
|
|
add-highlighter shared/asciidoc group
|
|
|
|
|
2020-07-23 05:15:55 +02:00
|
|
|
# Titles and headers (multi-line style)
|
2018-06-28 13:08:58 +02: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 05:15:55 +02:00
|
|
|
# Titles and headerss (one-line style)
|
2018-06-28 13:08:58 +02: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 05:15:55 +02:00
|
|
|
# Comments
|
2020-06-02 10:50:13 +02:00
|
|
|
add-highlighter shared/asciidoc/ regex ^//(?:[^\n/][^\n]*|)$ 0:comment
|
|
|
|
add-highlighter shared/asciidoc/ regex ^(/{4,}).*?\n(/{4,})$ 0:comment
|
|
|
|
|
2020-07-23 06:00:52 +02:00
|
|
|
# List titles
|
|
|
|
add-highlighter shared/asciidoc/ regex ^\.[^\h\W][^\n]*$ 0:title
|
|
|
|
|
2020-07-23 05:15:55 +02:00
|
|
|
# Bulleted lists
|
2020-07-23 03:28:06 +02: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 05:15:55 +02:00
|
|
|
|
|
|
|
# Blocks
|
2018-06-28 13:08:58 +02: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 05:15:55 +02:00
|
|
|
|
|
|
|
# Monospaced text
|
2018-06-28 13:08:58 +02:00
|
|
|
add-highlighter shared/asciidoc/ regex \B(?:\+[^\n]+?\+|`[^\n]+?`)\B 0:mono
|
2020-07-23 05:15:55 +02:00
|
|
|
|
|
|
|
# Bolded text
|
2020-07-23 03:28:06 +02:00
|
|
|
add-highlighter shared/asciidoc/ regex \s\*[^\n\*]+\*\B 0:+b
|
|
|
|
add-highlighter shared/asciidoc/ regex \h\*[^\n\*]+\*\B 0:+b
|
2020-07-23 05:38:58 +02:00
|
|
|
add-highlighter shared/asciidoc/ regex \*{2}(?!\h)[^\n\*]+\*{2} 0:+b
|
2020-07-23 05:15:11 +02:00
|
|
|
add-highlighter shared/asciidoc/ regex \h\*{2}[^\n\*]+\*{2} 0:+b
|
2020-07-23 05:15:55 +02:00
|
|
|
|
2020-07-23 05:38:58 +02: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 05:15:55 +02:00
|
|
|
# Attributes
|
2020-07-23 06:01:04 +02:00
|
|
|
add-highlighter shared/asciidoc/ regex ^:(?:(?<neg>!?)[-\w]+|[-\w]+(?<neg>!?)): 0:meta neg:operator
|
2020-07-23 05:16:04 +02:00
|
|
|
add-highlighter shared/asciidoc/ regex [^\\](\{[-\w]+\})[^\\]? 1:meta
|
2015-05-09 22:00:50 +02:00
|
|
|
|
2020-07-23 06:01:24 +02:00
|
|
|
# Options
|
|
|
|
add-highlighter shared/asciidoc/ regex ^\[[^\n]+\]$ 0:operator
|
|
|
|
|
2020-07-23 06:01:36 +02:00
|
|
|
# Admonition pargraphs
|
|
|
|
add-highlighter shared/asciidoc/ regex ^(NOTE|TIP|IMPORTANT|CAUTION|WARNING): 0:block
|
|
|
|
add-highlighter shared/asciidoc/ regex ^\[(NOTE|TIP|IMPORTANT|CAUTION|WARNING)\]$ 0:block
|
|
|
|
|
2020-07-23 07:18:31 +02:00
|
|
|
# Links, inline macros
|
|
|
|
add-highlighter shared/asciidoc/ regex \b((?:https?|ftp|irc://)[^\h\[]+)\[([^\n]*)?\] 1:link 2:+i
|
|
|
|
add-highlighter shared/asciidoc/ regex (link|mailto):([^\n]+)(?:\[([^\n]*)\]) 1:keyword 2:link 3:+i
|
|
|
|
add-highlighter shared/asciidoc/ regex (xref):([^\n]+)(?:\[([^\n]*)\]) 1:keyword 2:meta 3:+i
|
|
|
|
add-highlighter shared/asciidoc/ regex (<<([^\n><]+)>>) 1:link 2:meta
|
|
|
|
|
2015-05-09 22:00:50 +02:00
|
|
|
# Commands
|
|
|
|
# ‾‾‾‾‾‾‾‾
|
|
|
|
|
2019-03-13 06:24:33 +01:00
|
|
|
}
|