亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

如何修改vim插件vimwiki中Vimwiki2HTML的一些細節

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

問題描述

vimwiki默認的Vimwiki2HTML命令,會把%toc轉換為當前wiki條目的目錄,但是會把二級目錄id轉換為toc_1.1(id中含有點號),而為了使用bootstrap-scrollspy實現滾動偵測(參考:如何實現網頁滾動偵測以及頂端固定導航欄),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).

我水平有限,不能直接寫一個外部的腳本,想參考下vimwiki默認的腳本是什么樣子,但是不知道internal wiki2html converter的腳本在哪里。

問題解答

回答1:

現在有兩種方法:

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

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命令把偶數行添加在奇數行的緩沖區,因此<p class='toc'>需要放在奇數行。

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

感謝[email protected] 在 Can I modified the internal wiki2html... 的回答。

標簽: HTML
相關文章:
主站蜘蛛池模板: 欧美久久一区二区三区 | 欧美成人午夜做爰视频在线观看 | 亚洲婷婷丁香 | 久久亚洲精品中文字幕二区 | 久草在线这里只有精品 | 亚洲成本人网亚洲视频大全 | 国产亚洲精品久久久极品美女 | 国产精品亚洲片在线观看不卡 | 国产高颜值露脸在线观看 | 日韩毛片一级 | 欧美亚洲网 | 成年人小视频在线观看 | 日本不卡高清免费v日本 | 达达兔午夜起神影院在线观看麻烦 | 国产欧美日韩视频 | 美国黄色a级片 | 情侣网站 在线播放 | 黄色片子在线观看 | 国产成人久久精品区一区二区 | 中文三 级 黄 色 片 | 欧美一区二区三区gg高清影视 | xxx毛茸茸的亚洲 | 中文字幕亚洲一区二区va在线 | 一级黄色欧美片 | 女神穿上情趣丝袜啪啪一整晚 | 久久久久久亚洲精品影院 | 国产一区2区3区 | 亚洲国产最新在线一区二区 | 亚洲精品久久精品h成人 | 免费大片网站 | 一区二区不卡在线观看 | 免费在线观看色 | 能看av的网址 | 精品国产欧美 | 成人片子 | 午夜国产在线 | 青草久久久 | 亚洲色图欧美视频 | 国产人成精品香港三级在 | 国内外成人免费在线视频 | 正在播放的国产a一片 |