Yaml metadata, fix regex (#1287)
This commit is contained in:
@@ -820,20 +820,15 @@ function! s:get_common_syntaxlocal() abort
|
|||||||
" Declare helper: a line with only --- or ...
|
" Declare helper: a line with only --- or ...
|
||||||
let rx_yaml_start_pre = '\%(^\%(\%1l\|^$\n\)\@<=\)'
|
let rx_yaml_start_pre = '\%(^\%(\%1l\|^$\n\)\@<=\)'
|
||||||
let rx_yaml_start_post = '\%(\%(\n^$\)\@!$\)'
|
let rx_yaml_start_post = '\%(\%(\n^$\)\@!$\)'
|
||||||
let a_yaml_region = []
|
let rx_yaml_start = rx_yaml_start_pre . '---' . rx_yaml_start_post
|
||||||
for rx_yaml_delimiter in ['---', '\.\.\.']
|
let rx_yaml_stop = '^' . '\%(---\|\.\.\.\)' . '$'
|
||||||
let rx_yaml_start = rx_yaml_start_pre . rx_yaml_delimiter . rx_yaml_start_post
|
|
||||||
let rx_yaml_stop = '^' . rx_yaml_delimiter . '$'
|
|
||||||
call add(a_yaml_region, [rx_yaml_start, rx_yaml_stop])
|
|
||||||
endfor
|
|
||||||
|
|
||||||
let res.nested_extended = {'type': type(''), 'default': 'VimwikiError,VimwikiPre,VimwikiCode,VimwikiEqIn,VimwikiSuperScript,VimwikiSubScript,textSnipTEX'}
|
let res.nested_extended = {'type': type(''), 'default': 'VimwikiError,VimwikiPre,VimwikiCode,VimwikiEqIn,VimwikiSuperScript,VimwikiSubScript,textSnipTEX'}
|
||||||
let res.nested_typeface = {'type': type(''), 'default': 'VimwikiBold,VimwikiItalic,VimwikiUnderline,VimwikiDelText'}
|
let res.nested_typeface = {'type': type(''), 'default': 'VimwikiBold,VimwikiItalic,VimwikiUnderline,VimwikiDelText'}
|
||||||
let res.nested = {'type': type(''), 'default': res.nested_extended.default . ',' . res.nested_typeface.default}
|
let res.nested = {'type': type(''), 'default': res.nested_extended.default . ',' . res.nested_typeface.default}
|
||||||
let res.rxTableSep = {'type': type(''), 'default': '|'}
|
let res.rxTableSep = {'type': type(''), 'default': '|'}
|
||||||
" See issue #1287
|
" See issue #1287
|
||||||
let res.yaml_metadata_block = {'type': type([]), 'default': a_yaml_region}
|
let res.yaml_metadata_block = {'type': type([]), 'default': [[rx_yaml_start, rx_yaml_stop]]}
|
||||||
|
|
||||||
|
|
||||||
" Declare helper for inline math nested variable
|
" Declare helper for inline math nested variable
|
||||||
let s:rx_inline_math_start = '\%(^\|[^$\\]\)\@<=\$\%($\|[^$[:space:]]\)\@='
|
let s:rx_inline_math_start = '\%(^\|[^$\\]\)\@<=\$\%($\|[^$[:space:]]\)\@='
|
||||||
|
|||||||
+1
-1
@@ -2954,7 +2954,7 @@ Where:
|
|||||||
List of (start, end) regex region delimiters to define the YAML header
|
List of (start, end) regex region delimiters to define the YAML header
|
||||||
More information in #1287 and https://pandoc.org/MANUAL.html#extension-yaml_metadata_block
|
More information in #1287 and https://pandoc.org/MANUAL.html#extension-yaml_metadata_block
|
||||||
|
|
||||||
Default: [['^---$', '^---$'], ['^\.\.\.$', '^\.\.\.$']]
|
Default: [['^---$', '^\%(---\|\.\.\.$']]
|
||||||
or similar with stricter anchors
|
or similar with stricter anchors
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ Given vimwiki (Yaml with --- at top):
|
|||||||
Execute (Assert delimiter with --- at top):
|
Execute (Assert delimiter with --- at top):
|
||||||
call Issue1287Yaml(1)
|
call Issue1287Yaml(1)
|
||||||
|
|
||||||
Given vimwiki (Yaml with ... at top):
|
Given vimwiki (Yaml with --- at bottom):
|
||||||
...
|
---
|
||||||
title: my title
|
title: my title
|
||||||
description: my description
|
description: my description
|
||||||
...
|
...
|
||||||
|
|
||||||
Execute (Assert delimiter with ... at top):
|
Execute (Assert delimiter with ... at bottom):
|
||||||
call Issue1287Yaml(1)
|
call Issue1287Yaml(1)
|
||||||
|
|
||||||
Given vimwiki (Yaml with --- after empty line):
|
Given vimwiki (Yaml with --- after empty line):
|
||||||
@@ -63,10 +63,7 @@ Execute (Assert all is yaml except after the closing ---):
|
|||||||
|
|
||||||
AssertEqual 'textSnipYAML1', GetSyntaxStack(1, 2)[0] . 1
|
AssertEqual 'textSnipYAML1', GetSyntaxStack(1, 2)[0] . 1
|
||||||
AssertEqual 'textSnipYAML2', GetSyntaxStack(2, 2)[0] . 2
|
AssertEqual 'textSnipYAML2', GetSyntaxStack(2, 2)[0] . 2
|
||||||
AssertEqual 'textSnipYAML3', GetSyntaxStack(3, 2)[0] . 3
|
AssertEqual 'VimwikiPre3', GetSyntaxStack(3, 2)[0] . 3
|
||||||
AssertEqual 'textSnipYAML4', GetSyntaxStack(4, 2)[0] . 4
|
|
||||||
AssertEqual 'textSnipYAML5', GetSyntaxStack(5, 2)[0] . 5
|
|
||||||
AssertEqual 'textSnipYAML6', GetSyntaxStack(5, 2)[0] . 6
|
|
||||||
|
|
||||||
AssertEqual 0, len(GetSyntaxStack(7, 2))
|
AssertEqual 0, len(GetSyntaxStack(7, 2))
|
||||||
AssertEqual 0, len(GetSyntaxStack(8, 2))
|
AssertEqual 0, len(GetSyntaxStack(8, 2))
|
||||||
|
|||||||
Reference in New Issue
Block a user