fix: python multiple quote

This commit is contained in:
zztrieuzz 2022-08-15 08:59:27 +07:00
parent 6ba1868a66
commit bd1bcb4dde
2 changed files with 17 additions and 5 deletions

View File

@ -36,25 +36,30 @@ local function setup(opt)
Rule("```.*$", "```", { 'markdown', 'vimwiki', 'rmarkdown', 'rmd', 'pandoc' })
:only_cr()
:use_regex(true),
Rule('"""', '"""', { 'python', 'elixir', 'julia', 'kotlin' }),
Rule("'''", "'''", { 'python' }),
Rule('"""', '"""', { 'python', 'elixir', 'julia', 'kotlin' })
:with_pair(cond.not_before_char('"', 3)),
Rule("'''", "'''", { 'python' })
:with_pair(cond.not_before_char('"', 3)),
basic("'", "'", '-rust')
:with_pair(cond.not_before_regex("%w")),
basic("'", "'", 'rust')
:with_pair(cond.not_before_regex("[%w<&]"))
:with_pair(cond.not_after_text(">")),
basic("`", "`"),
basic('"', '"','-vim'),
basic('"', '"','vim')
basic('"', '"', '-vim'),
basic('"', '"', 'vim')
:with_pair(cond.not_before_regex("^%s*$", -1)),
bracket("(", ")"),
bracket("[", "]"),
bracket("{", "}"),
Rule(">[%w%s]*$", "^%s*</",
{ 'html', 'typescript', 'typescriptreact', 'javascript' , 'javascriptreact', 'svelte', 'vue', 'xml', 'rescript'})
{ 'html', 'typescript', 'typescriptreact', 'javascript', 'javascriptreact', 'svelte', 'vue', 'xml',
'rescript' })
:only_cr()
:use_regex(true)
}
return rules
end
return { setup = setup }

View File

@ -50,6 +50,13 @@ local data = {
before = [[""| ]],
after = [["""|""" ]]
},
{
name = "don't repeat python quote" ,
filetype = "python",
key = [["]],
before = [[a"""|""" ]],
after = [[a""""|"" ]]
},
{
name = "add markdown quote" ,