{"id":1393,"date":"2015-01-21T15:26:20","date_gmt":"2015-01-21T07:26:20","guid":{"rendered":"https:\/\/cowmanchiang.me\/wp\/?p=1393"},"modified":"2023-10-31T15:44:05","modified_gmt":"2023-10-31T07:44:05","slug":"gitbook-%e4%bd%bf%e7%94%a8-windows-%e8%a6%96%e7%aa%97%e7%b7%a8%e8%bc%af%e5%99%a8","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1393","title":{"rendered":"[Gitbook] \u4f7f\u7528 Windows \u8996\u7a97\u7de8\u8f2f\u5668"},"content":{"rendered":"<p>\u8a66\u8457\u4f7f\u7528 Windows \u7684\u8996\u7a97\u7de8\u8f2f\u5668\u4f86\u64b0\u5beb Gitbook<br \/>\n\u76ee\u524d\u6e2c\u8a66\u4e86 <a href=\"https:\/\/miu.0x142857.com\/\" title=\"Miu\" target=\"_blank\" rel=\"noopener noreferrer\">Miu<\/a> \u8ddf <a href=\"http:\/\/markdownpad.com\/\" title=\"MarkdownPad\" target=\"_blank\" rel=\"noopener noreferrer\">MarkdownPad<\/a> \u9019\u5169\u500b\u7de8\u8f2f\u5668<br \/>\n\u4e0d\u904e\u524d\u8005 Miu \u56e0\u70ba Liveview \u4e26\u4e0d\u652f\u63f4 HTML \u8a9e\u6cd5\uff0c\u6240\u4ee5\u88ab\u6211\u62cb\u68c4\u4e86<br \/>\n\u7b49\u4ed6\u6709\u652f\u63f4\u518d\u56de\u53bb\u7528\u770b\u770b<\/p>\n<p>PS. Mac \u4e0a\u5927\u5bb6\u63a8\u7684\u90fd\u662f <a href=\"http:\/\/25.io\/mou\/\" title=\"Mou\" target=\"_blank\" rel=\"noopener noreferrer\">Mou<\/a><\/p>\n<p>\u800c\u7528 Windows \u5beb Gitbook \u5c31\u4e0d\u50cf\u5728 Linux \u4e0a\u6709 gitbook init \u53ef\u4ee5\u7522\u751f\u76f8\u5c0d\u6620\u7684 md \u6a94\u6848<br \/>\n\u5c31\u6539\u4e4b\u524d\u5beb\u7684 parse.py \u4f86\u7522\u751f\u5427 (\u9019\u908a\u4f7f\u7528\u7684 python \u7248\u672c\u662f 3.0)<br \/>\n\u6703\u6839\u64daSUMMARY\u7684 <a href=\"\u6a94\u6848\u4f4d\u5740\">\u6a19\u984c<\/a> \u9032\u884c\u5275\u5efa<br \/>\n\u5275\u5efa\u7684 md \u4e5f\u6703\u5148\u5beb\u5165 \u6a19\u984cn&#8211;<br \/>\n\u9019\u6a23\u4e5f\u4e0d\u7528\u6253\u958b\u5f8c\u9084\u4e0d\u77e5\u9053\u9019\u662f\u54ea\u4e00\u9801\u4e86<\/p>\n<pre lang=\"python\">\n# -*- coding: utf-8 -*-\n\nimport re\nimport os\n\nfor line in open(\"SUMMARY.md\", encoding='utf-8'):\n    try:\n        src1 = re.search('[(.+?)]((.+?))', line)\n        print(src1.group(1))\n        src = src1.group(2)\n    except:\n        print(line)\n    else:\n        cnt = src.count('\/')\n        if cnt == 3:\n            tempstr = re.search('(.+?)\/(.+?)\/(.+?)\/(.*)', src)\n            path = tempstr.group(1) + \"\\\" + tempstr.group(2) + \"\\\" + tempstr.group(3)\n            file = tempstr.group(1) + \"\\\" + tempstr.group(2) + \"\\\" + tempstr.group(3) + \"\/\" + tempstr.group(4)\n            if not os.path.isdir(path):\n                print(\"create folder: \" + path)\n                os.mkdir(path)\n            if not os.path.isfile(file):\n                print(\"create file: \" + file)\n                newfile = open(file, \"w\")\n                newfile.write(src1.group(1))\n                newfile.write(\"n--\")\n                newfile.close()\n            print(tempstr.group(1) + \"..\" + tempstr.group(2) + \"..\" + tempstr.group(3) + \"..\" + tempstr.group(4))\n\n        elif cnt == 2:\n            tempstr = re.search('(.+?)\/(.+?)\/(.*)', src)\n            path = tempstr.group(1) + \"\\\" + tempstr.group(2)\n            file = tempstr.group(1) + \"\\\" + tempstr.group(2) + \"\\\" + tempstr.group(3)\n            if not os.path.isdir(path):\n                print(\"create folder: \" + path)\n                print(path)\n                os.mkdir(path)\n            if not os.path.isfile(file):\n                print(\"create file: \" + file)\n                newfile = open(file, \"w\")\n                newfile.write(src1.group(1))\n                newfile.write(\"n--\")\n                newfile.close()\n            print(tempstr.group(1) + \"..\" + tempstr.group(2) + \"..\" + tempstr.group(3))\n\n        elif cnt == 1:\n            tempstr = re.search('(.+?)\/(.*)', src)\n            path = tempstr.group(1)\n            file = tempstr.group(1) + \"\\\" + tempstr.group(2)\n            if not os.path.isdir(path):\n                print(\"create folder: \" + path)\n                os.mkdir(path)\n            if not os.path.isfile(file):\n                print(\"create file: \" + file)\n                newfile = open(file, \"w\")\n                newfile.write(src1.group(1))\n                newfile.write(\"n--\")\n                newfile.close()\n            print(tempstr.group(1) + \"..\" + tempstr.group(2))            \n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8a66\u8457\u4f7f\u7528 Windows \u7684\u8996\u7a97\u7de8\u8f2f\u5668\u4f86\u64b0\u5beb Gitbook \u76ee\u524d\u6e2c\u8a66\u4e86 Miu \u8ddf MarkdownPad \u9019\u5169\u500b\u7de8\u8f2f\u5668 \u4e0d\u904e\u524d\u8005 Miu \u56e0\u70ba Liveview \u4e26\u4e0d\u652f\u63f4 HTML \u8a9e\u6cd5\uff0c\u6240\u4ee5\u88ab\u6211\u62cb\u68c4\u4e86 \u7b49\u4ed6\u6709\u652f\u63f4\u518d\u56de\u53bb\u7528\u770b\u770b PS. Mac \u4e0a\u5927\u5bb6\u63a8\u7684\u90fd\u662f Mou \u800c\u7528 Windows \u5beb Gitbook \u5c31\u4e0d\u50cf\u5728 Linux \u4e0a\u6709 gitbook init \u53ef\u4ee5\u7522\u751f\u76f8\u5c0d\u6620\u7684 md \u6a94\u6848 \u5c31\u6539\u4e4b\u524d\u5beb\u7684 parse.py \u4f86\u7522\u751f\u5427 (\u9019\u908a\u4f7f\u7528\u7684 python \u7248\u672c\u662f 3.0) &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=1393\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72],"tags":[],"class_list":["post-1393","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1393"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1393\/revisions"}],"predecessor-version":[{"id":1945,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1393\/revisions\/1945"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}