我想爲標題標籤生成toc。有沒有免費的程序?尋找HTML toc生成器
-1
A
回答
1
1
作爲@ user5858提到的htmltoc
腳本的替代方法,有hypertoc
,這是對Perl的更強大的重寫。像這樣安裝它(在Ubuntu Linux爲例):
sudo cpan -f -i HTML::GenToc
使用方法如下:
hypertoc --inline --make_anchors --make_toc --overwrite file.html
0
我剛上生成的目錄使用hypertoc的HTML頁面,用sed寫了blog post,和做。 shell腳本還使用廣告名稱插入Google廣告。我還創建了一個navigation section,可用於導航到網站上的其他頁面。
網頁我使用的示例模板看起來是這樣的:
<!-- INCLUDE Navigation -->
<div id="centerDoc">
<h1>Title</h1>
<!-- Insert an ad -->
<!-- INCLUDE GoogleAd1 -->
<!-- Insert the table of contents here -->
<!--toc-->
<h2>More HTML code here</h2>
我寫了一個叫包括腳本讀取名爲* .html.in文件,並創建了一個* .html文件。腳本看起來像這樣。我也用一個makefile將* .html.in文件轉換成* .html文件
#!/bin/sh
#This script modifies HTML pages staticly, using something similar
# to the "#INCLUDE" C preprocessor mechanism
INCLUDE=${1?'Missing include file'}
shift
IFILE=${1?'Missing input file'}
OFILE=`echo $IFILE | sed 's/\.in$//'`
# get the name without the path
OFILENAME=`echo $OFILE | sed 's:.*/::'`
if [ "$IFILE" = "$OFILE" ]
then
echo input file $IFILE same as output file $OFILE - exit
exit
fi
ARGS="--toc_entry 'H1=1' --toc_end 'H1=/H1' --toc_entry 'H2=2' --toc_end 'H2=/H2' --toc_entry 'H3=3' --toc_end 'H3=/H3' --toc_entry 'H4=4' --toc_end 'H4=/H4' --toc_entry 'H5=5' --toc_end 'H5=/H5'"
# The string !--toc-- is used as a marker to insert the new Table of Contents
TOC="--toc_tag '!--toc--' --toc_tag_replace"
eval hypertoc $ARGS $TOC --make_anchors --make_toc --inline --outfile - $IFILE| \
sed "/<!-- INCLUDE [Nn]avigation/ r $INCLUDE
# Quick and dirty way to add a way to get back to the Toc from an Entry
# 1) put a marker in the beginning of the ToC
s/<h1>Table of Contents/<h1><a name=\"TOC\">Table Of Contents/
# 2) Add a link back to the ToC from each entry
s:\(<h[1234]>\)<a name=:\1<a href=\"$OFILENAME#TOC\" name=:g
# Include ad named 'GoogleAd1'
/INCLUDE GoogleAd1/ {
r Ads/GoogleAd1
}
" >$OFILE
相關問題
- 1. 如何從DocBook生成僅TOC的HTML?
- 2. PHP - 尋找一個HTML生成器/管理器
- 3. 尋找T4 CSLA代碼生成器
- 4. 尋找PHP列表和ACID生成器
- 5. 在ASP.NET中使用html源文件生成TOC
- 6. 尋找CSS網格生成器或配置器
- 7. 尋找可定製的「流程圖生成器」構建器
- 8. python html生成器
- 9. 尋找一個SQL測試集生成器,理想的開源
- 10. 尋找Python的生成器<--> XML綁定
- 11. 尋找一個開源的WCF代理生成器
- 12. 爲OSI第2層流量生成器尋找OSS
- 13. 尋找在線HTML編輯器
- 14. 尋求引用字符串生成器
- 15. 尋找持續集成分析器(C#)
- 16. 從wkhtmltopdf生成的TOC中刪除特定的標題
- 17. .NET的HTML生成器?
- 18. PHP HTML生成器類
- 19. PHP - HTML的生成器
- 20. HTML評論生成器
- 21. 很多在jQuery中生成的html代碼。尋找更好的方法
- 22. 找到elgamal的生成器
- 23. 找不到生成器rspec:install。
- 24. 找不到'rspec'生成器
- 25. HTML生成器,圖庫生成器或模板?
- 26. html的字符串生成器或html標記生成器。這是有效的?
- 27. 如何找出界面生成器顏色的html顏色
- 28. BIRT Designer - 如何添加/生成目錄(TOC)?
- 29. 生成上下文無關文法(TOC基礎)
- 30. 尋找一個簡單的JavaScript HTML GUI生成器,我可以嵌入到我的網站
你說的這個「toc」是什麼?谷歌猜測*「目錄」*,但維基百科感到困惑:http://en.wikipedia.org/wiki/TOC。這是一個編程問題嗎?你有什麼嘗試? – Kobi 2011-03-22 05:59:52
@Kobi,我很肯定他的意思是目錄。 – 2011-03-22 06:10:53
是toc =目錄;所有html設計師常見的維護頭痛 – user5858 2011-03-22 06:28:23