diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-09-21 22:34:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-09-21 22:34:02 +0200 |
commit | 006590697c134891ddb6b618355510fcb50f85f3 (patch) | |
tree | 5d6b792660d21677f3ab10a1a40bccfc354eb91a /runtime/indent/dtd.vim | |
parent | 62b42181fbd76d684acb682fe69292164157555d (diff) |
Updated runtime files.
Diffstat (limited to 'runtime/indent/dtd.vim')
-rw-r--r-- | runtime/indent/dtd.vim | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim index 3c35116aaa..42a8789332 100644 --- a/runtime/indent/dtd.vim +++ b/runtime/indent/dtd.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: DTD (Document Type Definition for XML) " Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-18 +" Latest Revision: 2010-09-21 let s:cpo_save = &cpo set cpo&vim @@ -52,7 +52,7 @@ function s:indent_to_innermost_parentheses(line, end) let end = a:end let parentheses = [end - 1] while token != "" - let [token, end] = s:lex(a:line, end, '^\%([(),|]\|[A-Za-z0-9_-]\+\)[?*+]\=') + let [token, end] = s:lex(a:line, end, '^\%([(),|]\|[A-Za-z0-9_-]\+\|#PCDATA\|%[A-Za-z0-9_-]\+;\)[?*+]\=') if token[0] == '(' call add(parentheses, end - 1) elseif token[0] == ')' @@ -80,7 +80,7 @@ function GetDTDIndent() let lnum = line('.') let col = col('.') let indent = indent('.') - let line = join(getline(lnum, v:lnum - 1), "\n") + let line = lnum == v:lnum ? getline(lnum) : join(getline(lnum, v:lnum - 1), "\n") let [declaration, end] = s:lex1(line, col) if declaration == "" @@ -106,7 +106,7 @@ function GetDTDIndent() " Check for token following element name. This can be a specification of " whether the start or end tag may be omitted. If nothing is found, indent " one level. - let [token, end] = s:lex(line, end) + let [token, end] = s:lex(line, end, '^\%([-O(]\|ANY\|EMPTY\)') let n = 0 while token =~ '[-O]' && n < 2 let [token, end] = s:lex(line, end, '^\%([-O(]\|ANY\|EMPTY\)') @@ -214,8 +214,7 @@ function GetDTDIndent() " Finally look for the attribute’s default value. If non exists, indent " two levels. - " TODO: Do validation of keywords (#REQUIRED|#IMPLIED)? - let [default, end] = s:lex(line, end, '^\%("\_[^"]*"\|[^[:space:]]\+\)') + let [default, end] = s:lex(line, end, '^\%("\_[^"]*"\|#\(REQUIRED\|IMPLIED\|FIXED\)\)') if default == "" return indent + &sw * 2 elseif default == '#FIXED' |