From 6c35beaa11d38fc0c37a3d209295772313b12003 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 25 Jul 2012 17:49:10 +0200 Subject: Updated runtime files. --- runtime/autoload/tohtml.vim | 127 +++++- runtime/compiler/mcs.vim | 10 +- runtime/doc/index.txt | 4 +- runtime/doc/motion.txt | 7 +- runtime/doc/pi_gzip.txt | 4 +- runtime/doc/syntax.txt | 432 +++++++++++------- runtime/doc/tags | 30 ++ runtime/doc/todo.txt | 29 +- runtime/doc/visual.txt | 2 +- runtime/indent/xml.vim | 12 +- runtime/keymap/belarusian-jcuken.vim | 87 ++++ runtime/mswin.vim | 4 +- runtime/plugin/tohtml.vim | 86 +++- runtime/syntax/2html.vim | 818 ++++++++++++++++++++++++++++------- runtime/syntax/help.vim | 6 +- runtime/syntax/svn.vim | 9 +- runtime/tools/efm_perl.pl | 2 +- 17 files changed, 1293 insertions(+), 376 deletions(-) create mode 100644 runtime/keymap/belarusian-jcuken.vim diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim index ad33cee1da..2e9021a48e 100644 --- a/runtime/autoload/tohtml.vim +++ b/runtime/autoload/tohtml.vim @@ -1,6 +1,6 @@ " Vim autoload file for the tohtml plugin. " Maintainer: Ben Fritz -" Last Change: 2011 Apr 05 +" Last Change: 2012 Jun 30 " " Additional contributors: " @@ -11,7 +11,7 @@ " this file uses line continuations let s:cpo_sav = &cpo -set cpo-=C +set cpo&vim " Automatically find charsets from all encodings supported natively by Vim. With " the 8bit- and 2byte- prefixes, Vim can actually support more encodings than @@ -391,12 +391,25 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ call add(html, '') let body_line_num = len(html) - call add(html, '') - call add(html, '') + if !empty(s:settings.prevent_copy) + call add(html, "") + call add(html, "") + call add(html, "
0
") + call add(html, "
") + call add(html, "
") + else + call add(html, '') + endif + call add(html, "
") call add(html, '') for buf in a:win_list @@ -454,16 +467,19 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ let insert_index = diff_style_start endif - " Delete those parts that are not needed so - " we can include the rest into the resulting table - 1,/^\_s\+.*id='oneCharWidth'.*\_s\+.*id='oneInputWidth'.*\_s\+.*id='oneEmWidth'\)\?\zs/d_ $ ??,$d_ let temp = getline(1,'$') + " clean out id on the main content container because we already set it on + " the table + let temp[0] = substitute(temp[0], " id='vimCodeElement'", "", "") " undo deletion of start and end part " so we can later save the file as valid html " TODO: restore using grabbed lines if undolevel is 1? - normal 2u + normal! 2u if s:settings.use_css call add(html, '
') elseif s:settings.use_xhtml @@ -520,12 +536,47 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ 1 let style_start = search('^')-1 + " add required javascript in reverse order so we can just call append again + " and again without adjusting {{{ + + " insert script closing tag if any javascript is needed + if s:settings.dynamic_folds || !empty(s:settings.prevent_copy) + call append(style_start, [ + \ '', + \ s:settings.use_xhtml ? '//]]>' : '-->', + \ "" + \ ]) + endif + + " insert script which corrects the size of small input elements in + " prevent_copy mode. See 2html.vim for details on why this is needed and how + " it works. + if !empty(s:settings.prevent_copy) + call append(style_start, [ + \ '', + \ '/* simulate a "ch" unit by asking the browser how big a zero character is */', + \ 'function FixCharWidth() {', + \ ' /* get the hidden element which gives the width of a single character */', + \ ' var goodWidth = document.getElementById("oneCharWidth").clientWidth;', + \ ' /* get all input elements, we''ll filter on class later */', + \ ' var inputTags = document.getElementsByTagName("input");', + \ ' var ratio = 5;', + \ ' var inputWidth = document.getElementById("oneInputWidth").clientWidth;', + \ ' var emWidth = document.getElementById("oneEmWidth").clientWidth;', + \ ' if (inputWidth > goodWidth) {', + \ ' while (ratio < 100*goodWidth/emWidth && ratio < 100) {', + \ ' ratio += 5;', + \ ' }', + \ ' document.getElementById("vimCodeElement").className = "em"+ratio;', + \ ' }', + \ '}' + \ ]) + endif + " Insert javascript to toggle matching folds open and closed in all windows, - " if dynamic folding is active. {{{ + " if dynamic folding is active. if s:settings.dynamic_folds call append(style_start, [ - \ "" \ ]) + endif + + " insert script tag if any javascript is needed + if s:settings.dynamic_folds || s:settings.prevent_copy != "" + call append(style_start, [ + \ "