I often use the 2html syntax script to render some of my files and
publish them to the web. However, the feature I miss the most is a named
anchor on every line to be able to reference special sections.
I wrote a patch for 2html.vim which simply adds an anchor to each line.
Am I the first who had this idea or are there counter-arguments for
doing this?
Cheers,
Benedikt
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---
--- syntax/2html.vim.orig 2008-02-17 22:29:29.000000000 +0100
+++ syntax/2html.vim 2008-02-17 22:29:43.000000000 +0100
@@ -362,7 +362,7 @@
let s:len = strlen(s:line)
if s:numblines
- let s:new = s:HtmlFormat(s:new, "lnr")
+ let s:new = '<a id="l'.s:lnum.'" href="#l'.s:lnum.'" class="lnr">' .
s:HtmlFormat(s:new, "lnr") . '</a>'
endif
" Get the diff attribute, if any.
@@ -461,9 +461,10 @@
" Line numbering attributes
if s:numblines
if exists("html_use_css")
+ execute "normal! A\na.lnr { text-decoration: none }\e"
execute "normal! A\n.lnr { " . s:CSS1(hlID("LineNr")) . "}\e"
else
- execute '%s+^<span class="lnr">\([^<]*\)</span>+' .
s:HtmlOpening(hlID("LineNr")) . '\1' . s:HtmlClosing(hlID("LineNr")) . '+g'
+ execute '%s+^<a \([^>]*\) class="lnr"><span
class="lnr">\([^<]*\)</span></a>+' . '<a \1 style="text-decoration: none;">'.
s:HtmlOpening(hlID("LineNr")) . '\2' . s:HtmlClosing(hlID("LineNr")) . '</a>+g'
endif
endif