From 31c31679e22618fe03f634a356c15f8d631c5372 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 26 Jun 2013 13:28:14 +0200 Subject: Updated runtime files. New version of TOhtml plugin. --- runtime/autoload/tohtml.vim | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'runtime/autoload') diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim index 9be2d2934..5cb23a614 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: 2013 May 31 +" Last Change: 2013 Jun 19 " " Additional contributors: " @@ -401,15 +401,15 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ call add(html, '') let body_line_num = len(html) if !empty(s:settings.prevent_copy) - call add(html, "") + call add(html, "") call add(html, "") call add(html, "
0
") call add(html, "
") call add(html, "
") else - call add(html, '') + call add(html, '') endif - call add(html, "") + call add(html, "
") call add(html, '') for buf in a:win_list @@ -475,7 +475,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ 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'", "", "") + 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? @@ -568,9 +568,9 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ \ ' var emWidth = document.getElementById("oneEmWidth").clientWidth;', \ ' if (inputWidth > goodWidth) {', \ ' while (ratio < 100*goodWidth/emWidth && ratio < 100) {', - \ ' ratio += 5;', - \ ' }', - \ ' document.getElementById("vimCodeElement").className = "em"+ratio;', + \ ' ratio += 5;', + \ ' }', + \ ' document.getElementById("vimCodeElement'.s:settings.id_suffix.'").className = "em"+ratio;', \ ' }', \ '}' \ ]) @@ -596,7 +596,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ \ "", \ " /* navigate upwards in the DOM tree to open all folds containing the line */", \ " var node = lineElem;", - \ " while (node && node.id != 'vimCodeElement')", + \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')", \ " {", \ " if (node.className == 'closed-fold')", \ " {", @@ -722,6 +722,7 @@ func! tohtml#GetUserSettings() "{{{ call tohtml#GetOption(user_settings, 'no_invalid', 0 ) call tohtml#GetOption(user_settings, 'whole_filler', 0 ) call tohtml#GetOption(user_settings, 'use_xhtml', 0 ) + call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines ) " }}} " override those settings that need it {{{ @@ -855,6 +856,20 @@ func! tohtml#GetUserSettings() "{{{ let user_settings.no_invalid = 0 endif + if exists('g:html_id_expr') + let user_settings.id_suffix = eval(g:html_id_expr) + if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$' + echohl WarningMsg + echomsg '2html: g:html_id_expr evaluated to invalid string for HTML id attributes' + echomsg '2html: Omitting user-specified suffix' + echohl None + sleep 3 + let user_settings.id_suffix="" + endif + else + let user_settings.id_suffix="" + endif + " TODO: font return user_settings -- cgit v1.2.1