Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (50)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (1)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (79)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (7)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Category Archives: Gitbook
Gitbook
已經大概把自建的 Gitbook 從頭到尾摸過一次 詳細的內容可以參考 Cowman’s Gitbook Bookstore 目前的心得是 1. Web 顯示介面簡單,尤其適合 Mobile 裝置 2. 目前有需多外掛的支援,基本使用已經足夠 3. 建議公開的頁面以 Build 後產出的靜態 HTML 網頁為主,動態的 reserv 網站就留給開發測試之用 4. 產出電子書還是會因為 plugin 而發生缺圖的情形,需要直接插入圖片使用會比較好 後續有機會、有時間就會開始把之前的筆記慢慢轉成一本一本的Gitbook~~
Posted in Gitbook
Leave a comment
Gitbook 超過兩層目錄無法創建檔案/目錄的解套
因為gitbook作者認為一本書的章節目錄不應該過於複雜 所以原本預設只有兩層目錄 在去年一堆相關討論串結束後雖然已讓目錄可以超過兩層 但是gitbook (github源)卻無法建立相對應的目錄及檔案 在爬了許多code後 (/usr/lib/node_modules/gitbook)決定還是自己寫一個parse code來處理 這邊在讀完SUMMARY.md後會自動偵測檔案目錄是否不存在 不存在就直接創建 預設只抓三層檔案目錄的結構
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# !/usr/bin/python # -*- coding: utf-8 -*- import re import os for line in open("SUMMARY.md"): try: src1 = re.search('((.+?))', line) src = src1.group(1) except: print line else: cnt = src.count('/') if cnt == 3: str = re.search('(.+?)/(.+?)/(.+?)/(.*)', src) path = str.group(1) + "/" + str.group(2) + "/" + str.group(3) file = str.group(1) + "/" + str.group(2) + "/" + str.group(3) + "/" + str.group(4) if not os.path.isdir(path): print "create folder: " + path os.mkdir(path) if not os.path.isfile(file): print "create file: " + file open(file, "a").close() print str.group(1) + ".." + str.group(2) + ".." + str.group(3) + ".." + str.group(4) elif cnt == 2: str = re.search('(.+?)/(.+?)/(.*)', src) path = str.group(1) + "/" + str.group(2) file = str.group(1) + "/" + str.group(2) + "/" + str.group(3) if not os.path.isdir(path): print "create folder: " + path os.mkdir(path) if not os.path.isfile(file): print "create file: " + file open(file, "a").close() print str.group(1) + ".." + str.group(2) + ".." + str.group(3) |
Posted in Gitbook, Python
Leave a comment