色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術(shù)文章
文章詳情頁

如何修改vim插件vimwiki中Vimwiki2HTML的一些細節(jié)

瀏覽:151日期:2024-04-01 17:16:56

問題描述

vimwiki默認的Vimwiki2HTML命令,會把%toc轉(zhuǎn)換為當(dāng)前wiki條目的目錄,但是會把二級目錄id轉(zhuǎn)換為toc_1.1(id中含有點號),而為了使用bootstrap-scrollspy實現(xiàn)滾動偵測(參考:如何實現(xiàn)網(wǎng)頁滾動偵測以及頂端固定導(dǎo)航欄),id中不能用點號。

請問:

怎么能讓vimwiki生成的html文件中目錄id不含點號,比如用toc_1_1代替toc_1.1。怎么能讓生成的目錄中<ul>標簽有屬性class='nav',這個也是為了使用bootstrap-scrollspy。

vimwiki的幫助手冊里這樣寫道:

vimwiki-option-custom_wiki2html------------------------------------------------------------------------------Key Default value~custom_wiki2html ’’Description~The full path to an user-provided script that converts a wiki page to HTML.Vimwiki calls the provided |vimwiki-option-custom_wiki2html| script from thecommand-line, using ’!’ invocation.The following arguments, in this order, are passed to the|vimwiki-option-custom_wiki2html| script:1. force : [0/1] overwrite an existing file2. syntax : the syntax chosen for this wiki3. extension : the file extension for this wiki4. output_dir : the full path of the output directory, i.e. ’path_html’5. input_file : the full path of the wiki page6. css_file : the full path of the css file for this wikiFor an example and further instructions, refer to the following script:$VIMHOME/autoload/vimwiki/customwiki2html.shTo use the internal wiki2html converter, use an empty string (the default).

我水平有限,不能直接寫一個外部的腳本,想?yún)⒖枷聉imwiki默認的腳本是什么樣子,但是不知道internal wiki2html converter的腳本在哪里。

問題解答

回答1:

現(xiàn)在有兩種方法:

1. 用sed批量處理;用sed修改vimwiki生成的html,使其合乎規(guī)范,腳本如下:

sed -i ’N;s/<p class='toc'>n<ul>/<p class='toc'>n<ul class='nav'>/ ; s/toc_([0-9]*).([0-9]*)/toc_1_2/g’ ~/Documents/wiki_html/cs_html/*.html ~/Documents/wiki_html/life_html/*.html ~/Documents/wiki_html/original_html/*.html ~/Documents/wiki_html/*.html

注意:sed N命令把偶數(shù)行添加在奇數(shù)行的緩沖區(qū),因此<p class='toc'>需要放在奇數(shù)行。

2. 修改autoload/vimwiki/html.vim文件,如下:

if level > plevel call add(toc, ’<ul class='nav'>’) elseif level < plevel let plevel = s:close_list(toc, plevel, level) endif

for l in range(1, h_level-1) let h_number .= a:id[l].’_’ endfor

感謝themacropodus@gmail.com 在 Can I modified the internal wiki2html... 的回答。

標簽: HTML
相關(guān)文章:
主站蜘蛛池模板: 中文字幕毛片 | 国产精品96久久久久久久 | 日韩欧美一区二区三区在线观看 | 小泽玛利亚的一级毛片的 | 亚洲综合区 | 久草在线免费资源站 | 精品国产一区二区三区不卡蜜臂 | 草草久久97超级碰碰碰免费 | 永久精品免费影院在线观看网站 | 99国产精品高清一区二区二区 | 日韩一区二区三区视频 | 国产欧美日韩另类 | 国内自拍2020 | 日韩a一级欧美一级 | 免费国产成人高清在线观看视频 | 亚洲国产激情 | 日本手机看片 | 97免费公开视频 | 国产精品高清视亚洲一区二区 | 香港三级日本三级人妇三级四 | 欧美日本免费观看αv片 | 久久久久久久国产高清 | 欧美在线一区二区 | 亚洲第一网站免费视频 | 国产精品国产三级国产专播 | 波多野结衣视频在线观看地址免费 | 国产三级日产三级韩国三级 | 精品欧美一区二区三区免费观看 | 美女张开腿黄网站免费国产 | 草草视频在线播放 | 99je全部都是精品视频在线 | 日本在线观看免费视频网址 | 久久久精品免费观看 | 台湾精品视频在线播放 | 亚洲国产第一区二区香蕉日日 | 99久久99这里只有免费费精品 | 极品的亚洲 | 久久公开视频 | 在线黄网| 亚洲国产欧美在线人成aaa | 日韩最新中文字幕 |