Skip to content

Commit

Permalink
[#39] Also allow open blocks with source style
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Zawada authored and Tobias Zawada committed Aug 3, 2023
1 parent 6fbe36f commit 4e7032e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adoc-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -2038,9 +2038,9 @@ START-SRC and END-SRC delimit the actual source code."
(cl-flet ((rx-or (first second) (format "\\(?:%s\\|%s\\)" first second))
(rx-optional (stuff) (format "\\(?:%s\\)?" stuff))
(outer-brackets-and-delimiter (&rest stuff)
;; Listing blocks (delimiter ----) and literal blocks (delimiter ....) can have `source`-style:
;; Listing blocks (delimiter ----), open blocks (delimiter --) and literal blocks (delimiter ....) can have `source`-style:
;; https://docs.asciidoctor.org/asciidoc/latest/blocks/delimited/#summary-of-structural-containers
(format "^\\[%s\\]\\s-*\n\\(?2:\\(----+\\|\\.\\{4,\\}\\)\\)\n"
(format "^\\[%s\\]\\s-*\n\\(?2:\\(--\\(?:--+\\)?\\|\\.\\{4,\\}\\)\\)\n"
(apply #'concat stuff)))
;; The language attribute is positional only (2nd slot).
;; It gets its default value from the document attribute `source-language`.
Expand Down
7 changes: 7 additions & 0 deletions test/adoc-mode-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ Don't use it for anything real.")
"\n" '(adoc-meta-face adoc-native-code-face)
"----" 'adoc-meta-face
"\n" nil
;; Code block as OPEN BLOCK
"\n" nil
"[source,adoctest-lang]\n--\n" 'adoc-meta-face
source-code
"\n" '(adoc-meta-face adoc-native-code-face)
"--" 'adoc-meta-face
"\n" nil
;; Code block as Literal block
"[source,adoctest-lang]\n....\n" 'adoc-meta-face
source-code
Expand Down

0 comments on commit 4e7032e

Please sign in to comment.