Skip to content

Commit 04f8738

Browse files
committed
添加其他版本链接
1 parent 04bfb57 commit 04f8738

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

tools/add_edit_link.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/local/python34/bin/python3
22
# -*- coding: UTF-8 -*-
3-
#功能:在html中添加在线纠错链接
3+
#功能:在html中添加其他版本链接,在线纠错链接和全文检索框
44

55
import sys
66
import os
@@ -9,16 +9,31 @@
99
import html2sgml_map
1010

1111
patternInsertPos=re.compile(r'.*<body>',re.S)
12-
InsertHTML="""<div class="preheader"><div style="position: relative; overflow: hidden; margin: 10px 0;">
12+
InsertHTML="""<div class="preheader">
13+
<div style="float: left">
14+
<a style="margin : 0px 5px 0px 5px;" href="/docs/9.3/{0}" target="_top">9.3</a>
15+
<a style="margin : 0px 5px 0px 5px;" href="/docs/9.4/{0}" target="_top">9.4</a>
16+
<a style="margin : 0px 5px 0px 5px;" href="/docs/9.5/{0}" target="_top">9.5</a>
17+
<a style="margin : 0px 5px 0px 5px;" href="/docs/9.6/{0}" target="_top">9.6</a>
18+
<a style="margin : 0px 5px 0px 5px;" href="/docs/10/{0}" target="_top">10</a>
19+
<span style="margin : 0px 5px 0px 5px;">11</span>
20+
</div>
21+
22+
<div style="text-align:right">
23+
<a style="margin : 0px 0px 0px 10px;" href="https://github.com/postgres-cn/pgdoc-cn/issues/new" target="_blank" title="在Github上报告问题(请注明问题内容及所在章节)">问题报告</a>
24+
<a style="margin : 0px 0px 0px 10px;" href="https://github.com/postgres-cn/pgdoc-cn/edit/master/postgresql/doc/src/sgml/{1}" target="_blank" title="直接在Github上纠错本页面">纠错本页面</a>
25+
</div>
26+
27+
<div style="position: relative; overflow: hidden; margin: 10px 0;">
1328
<form method="GET" action="/v2/doc_search" style="float: right; width: 400px; max-width: 100%;">
1429
<input type="hidden" name="u" value="/docs/11" />
1530
<input style="width: 80%; height: 40px; font-size: 1.0em; padding: 0 10px; margin: 0; border: 1px solid #ccc; box-sizing: border-box;" type="text" placeholder="在文档中查找..." name="q"
1631
/><button style="width: 20%; height: 40px; font-size: 1.0em; padding: 0; margin: 0; border: 1px solid #ccc; box-sizing: border-box; border-left: 0; cursor: pointer;" type="submit" id="#submit">搜索</button>
17-
</form></div>
18-
<div style="text-align:right">
19-
<a style="margin : 0px 0px 0px 10px;" href="https://github.com/postgres-cn/pgdoc-cn/issues/new" target="_blank" title="在Github上报告问题(请注明问题内容及所在章节)">问题报告</a>
20-
<a style="margin : 0px 0px 0px 10px;" href="https://github.com/postgres-cn/pgdoc-cn/edit/master/postgresql/doc/src/sgml/{0}" target="_blank" title="直接在Github上纠错本页面">纠错本页面</a>
21-
</div></div>"""
32+
</form>
33+
</div>
34+
35+
</div>
36+
"""
2237

2338
sgmlDir="../build/doc/src/sgml"
2439
htmlDir=os.path.join(sgmlDir,"html")
@@ -47,7 +62,7 @@ def process(file):
4762
print(filename+","+sgmlfile)
4863
match=patternInsertPos.match(content)
4964
print(content[0:match.end()],file=fout)
50-
print(InsertHTML.format(sgmlfile),file=fout)
65+
print(InsertHTML.format(filename,sgmlfile),file=fout)
5166
print(content[match.end():],file=fout)
5267
fin.close()
5368
fout.close()

0 commit comments

Comments
 (0)