{"id":1958,"date":"2012-08-19T01:06:12","date_gmt":"2012-08-18T17:06:12","guid":{"rendered":"https:\/\/kyle.ai\/blog\/?p=1958"},"modified":"2013-11-17T11:06:07","modified_gmt":"2013-11-17T03:06:07","slug":"%e4%b8%a4%e4%b8%aa%e6%96%87%e6%a1%a3%e7%94%9f%e6%88%90%e5%b7%a5%e5%85%b7%ef%bc%9aphpdocumentor%e5%92%8csphinx","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/1958.html","title":{"rendered":"\u4e24\u4e2a\u6587\u6863\u751f\u6210\u5de5\u5177\uff1aphpDocumentor\u548cSphinx"},"content":{"rendered":"<p>\u4e00\u3001phpDocumentor<\/p>\n<p>phpDocumentor\u662f\u9488\u5bf9PHP\u7684\u6587\u6863\u81ea\u52a8\u751f\u6210\u5de5\u5177\u3002\u5b98\u65b9\u7f51\u7ad9\u5728\uff1ahttp:\/\/www.phpdoc.org\/<\/p>\n<p>github\u5730\u5740\uff1a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhttps:\/\/github.com\/phpDocumentor\/phpDocumentor2\r\n<\/pre>\n<p>\u5728linux\u4e0b\u53ef\u4ee5\u901a\u8fc7pear\u5de5\u5177\u5b89\u88c5\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo apt-get install php5-xsl\r\n$ pear channel-discover pear.phpdoc.org\r\n$ pear install phpdoc\/phpDocumentor-alpha\r\n<\/pre>\n<p>\u5b89\u88c5\u5b8c\u540e\u5c31\u53ef\u4ee5\u76f4\u63a5\u7528phpdoc\u547d\u4ee4\u884c\u6765\u751f\u6210\u6587\u6863\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ phpdoc -d &#x5B;SOURCE_PATH] -t &#x5B;TARGET_PATH]\r\n<\/pre>\n<p>\u5176\u4e2dSOURCE_PATH\u4e3aphp\u9879\u76ee\u7684\u76ee\u5f55\u5730\u5740\uff0cTARGET_PATH\u4e3a\u751f\u6210\u540e\u7684\u6587\u6863\u76ee\u5f55\u3002\u4f8b\u5982\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ pwd\r\n\/home\/chenming\/www\/email_importer\r\n$ phpdoc run -d . -t doc\r\n<\/pre>\n<p>\u751f\u6210\u597d\u540e\uff0c\u76f4\u63a5\u5728doc\u76ee\u5f55\u4e0b\u627eindex.html\u6253\u5f00\u5c31\u53ef\u4ee5\u770b\u5230\u6587\u6863\u4e86\u3002<br \/>\n\u66f4\u8be6\u7ec6\u7684\u7528\u6cd5\u53c2\u89c1\u5b98\u65b9\u6587\u6863\u3002<\/p>\n<p>\u4e8c\u3001Sphinx<\/p>\n<p>Sphinx\u662f\u4e00\u4e2areStructuredText\u683c\u5f0f\u7684\u6587\u6863\u81ea\u52a8\u751f\u6210\u5de5\u5177\uff0cpython\u548cdjango\u7b49\u7684\u5b98\u65b9\u6587\u6863\u5c31\u662f\u7528\u7684\u5b83\u3002<\/p>\n<p>\u5b98\u65b9\u7f51\u7ad9\uff1ahttp:\/\/sphinx.pocoo.org\/ \u00a0PS.\u8fd9\u4e2a\u5de5\u5177\u4e0e\u4e00\u4e2a\u5206\u8bcd\u7d22\u5f15\u7684\u5de5\u5177\u540d\u5b57\u4e00\u6837\u7684\uff0c\u652f\u6301\u4e2d\u6587\u7684sphinx\u53ebcoreseek\u3002<\/p>\n<p>\u901a\u8fc7python\u7684easy_install\u5de5\u5177\u5b89\u88c5\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo easy_install sphinx\r\n<\/pre>\n<p>\u5b89\u88c5\u597d\u540e\uff0c\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u5feb\u901f\u5f00\u59cb\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sphinx-quickstart\r\n<\/pre>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7c7b\u4f3c\u4e8e\u4e00\u4e2a\u65b0\u5efa\u6587\u6863\u7684\u5411\u5bfc\uff0c\u57fa\u672c\u4e0a\u9ed8\u8ba4\u4e0b\u53bb\u5c31\u53ef\u4ee5\u4e86\u3002\u5b8c\u6210\u540e\u7684\u76ee\u5f55\u7ed3\u6784\uff1a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n.\r\n\u251c\u2500\u2500 Makefile\r\n\u251c\u2500\u2500 _build\r\n\u251c\u2500\u2500 _static\r\n\u251c\u2500\u2500 conf.py\r\n\u2514\u2500\u2500 index.rst\r\n<\/pre>\n<p>\u5176\u4e2dconf.py\uff1a\u8fd9\u662f\u4e00\u4e2a Python \u6587\u4ef6\uff0c\u7528\u4e8e\u5b58\u653e Sphinx \u7684\u914d\u7f6e\u503c\uff0c\u5305\u62ec\u5728\u7ec8\u7aef\u6267\u884c sphinx-quickstart \u65f6\u9009\u4e2d\u7684\u90a3\u4e9b\u503c\u3002\u53ef\u4ee5\u5728\u91cc\u9762\u4fee\u6539\u4e00\u4e9b\u53c2\u6570\uff0c\u5982\u4e3b\u9898\u8bbe\u7f6e\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nhtml_theme_path = &#x5B;'_themes']  #\u4e3b\u9898\u76ee\u5f55\r\nhtml_theme = 'nature'          #\u4e3b\u9898\u540d\u79f0\r\n<\/pre>\n<p>\u53ef\u4ee5\u5728google\u91cc\u9762\u641c\u7d22\u4e9b\u4e3b\u9898\uff0c&#8221;sphinx theme&#8221;\uff0c\u4e0b\u8f7d\u4e3b\u9898\u540e\u628a\u4e3b\u9898\u6587\u4ef6\u5939\u653e\u5230\u9879\u76ee\u6587\u4ef6\u5939\u4e0b\u9762\u7684_themes(\u6211\u4eec\u4e0a\u9762\u914d\u7f6e\u7684)\u6587\u4ef6\u5939\u4e0b\u9762\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>sphinx\u91c7\u7528\u7684reStructuredText\u683c\u5f0f\uff0c\u5177\u4f53\u7684\u6587\u6863\u7f16\u5199\u683c\u5f0f\u5c31\u5f97\u770b\u5b98\u7f51\u7684\u6587\u6863\u4e86\uff0c\u5199\u5f97\u6bd4\u8f83\u8be6\u7ec6\u3002\u8fd8\u6709\u5c31\u662f\u53ef\u4ee5\u67e5\u770b\u522b\u4eba\u7684\u6587\u6863\u6e90\u7801\u6765\u5b66\u4e60\uff0c\u6bd4\u5982phpDocumentor\u548csphinx\u5b98\u65b9\u7f51\u7ad9\u7684\u6587\u6863\uff0c\u6bcf\u4e2a\u9875\u9762\u90fd\u4f1a\u6709\u4e00\u4e2a\u201cShow Source\u201d\u7684\u6309\u94ae\uff0c\u70b9\u51fb\u5c31\u53ef\u4ee5\u67e5\u770b\u6e90\u7801\u6587\u6863\u3002<\/p>\n<p>reStructuredText\u8be6\u7ec6\u683c\u5f0f\u6587\u6863\uff1a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhttp:\/\/docutils.sourceforge.net\/docs\/ref\/rst\/restructuredtext.html\r\n<\/pre>\n<p>\u7f16\u5199\u5b8csphinx\u6587\u6863\u540e\uff0c\u751f\u6210html\u7684\u547d\u4ee4\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmake html\r\n<\/pre>\n<p>\u7136\u540e\u5c31\u53ef\u4ee5\u5230\u751f\u6210\u597d\u7684\u76ee\u5f55\u4e0b\u9762\u6253\u5f00\u6f02\u4eae\u7684\u6587\u6863\u9875\u9762\u5566\u3002\u800c\u4e14\u8fd8\u53ef\u4ee5\u65b9\u4fbf\u5730\u66f4\u6539\u4e3b\u9898\uff0c\u751a\u81f3\u5b9a\u5236\u81ea\u5df1\u7684\u4e3b\u9898\u3002<\/p>\n<p>\u4ee3\u7801\u9ad8\u4eae\u8bbe\u7f6e\uff0c\u5148\u5b89\u88c5pygments\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install python-pygments\r\n#\u6216\r\nsudo easy_install Pygments\r\n<\/pre>\n<p>\u7136\u540e\u5728\u6587\u6863\u7ed3\u6784\u91cc\u9762\u8fd9\u6837\u5199\uff1a<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n.. highlight:: bash\r\n\r\n.. code-block:: bash\r\n\r\n    #!\/bin\/bash\r\n    #encoding=utf-8\r\n    #\u4e0b\u9762\u5199\u4ee3\u7801\r\n<\/pre>\n<p>\u8bbe\u7f6e\u989c\u8272\u4e3b\u9898\u5728conf.py\u4e2d\u8bbe\u7f6e\uff1a<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n# The name of the Pygments (syntax highlighting) style to use.\r\n#pygments_style = 'sphinx'\r\npygments_style = 'perldoc'\r\n#http:\/\/pygments.org\/demo\/\r\n<\/pre>\n<p>\u6709\u4e86\u8fd9\u4e24\u4e2a\u5de5\u5177\uff0c\u5199\u6587\u6863\u5c31\u9ad8\u6548\u591a\u4e86\uff0c\u57fa\u672c\u4e0a\u53ea\u5173\u5fc3\u6587\u5b57\u7684\u4e1c\u897f\uff0c\u4e0d\u7528\u62c5\u5fc3\u6587\u6863\u683c\u5f0f\u4e0e\u7ed3\u6784\u7684\u7ec4\u7ec7\u3002<\/p>\n<p>\u540e\u8bb0\uff1a\u5728vim\u4e2d\u6709\u4e00\u4e2a\u63d2\u4ef6\u53ebvimwiki<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhttps:\/\/github.com\/vim-scripts\/vimwiki\r\n<\/pre>\n<p>\u53ef\u4ee5\u7528\u6765\u4f5c\u672c\u5730wiki\u7684\u5de5\u5177\uff0c\u4e0evim\u96c6\u6210\uff0c\u652f\u6301\u751f\u6210html\u7b49\u683c\u5f0f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001phpDocumentor phpDocumentor\u662f\u9488\u5bf9PHP\u7684\u6587\u6863\u81ea\u52a8\u751f\u6210\u5de5\u5177\u3002\u5b98\u65b9\u7f51\u7ad9\u5728\uff1ahttp [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1958","post","type-post","status-publish","format-standard","hentry","category-diary"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=1958"}],"version-history":[{"count":8,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1958\/revisions"}],"predecessor-version":[{"id":4490,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1958\/revisions\/4490"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=1958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=1958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=1958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}