====== コード修正 ====== もしDokuWikiに協力し、開発に参加したいなら、このページを読んでください。 コードを理解し、開発を始めるポイントを含む、[[wiki:devel:guide|開発ガイド]]は、進化しています。 ===== 開発コードの取得 ===== 現行の開発コードは、[[Darcs]]レポジトリ(倉庫)または[[http://dev.splitbrain.org/browse/snapshots/|デイリースナップショット]]から手に入れることができます。[[http://dev.splitbrain.org/browse/darcs/dokuwiki|ソースを閲覧]]することもできます。すべてのソースコードは、文書化され、[[http://dev.splitbrain.org/reference/dokuwiki/|自動生成API Doc]]が利用可能です。 ===== コミュニケーション ===== All development activity is coordinated through the [[mailinglist]] ([[http://www.freelists.org/archives/dokuwiki/feed.rss | RSS feed]]) -- if you are interested in changing DokuWiki's codebase you should join the list! Sometimes we discuss development decision live on [[IRC]], too. ===== What to do ===== Well what you want to contribute is of course up to you -- you should scratch your own itches first. If you need some ideas of what is missing from DokuWiki you should have a look at the [[bugs|bugtracker]]. Please also have a look at [[wiki:devel:help wanted]], where I list things which could use some improvement and patches would be more than welcome. ===== Coding Style ===== I'm not very strict in how the code should be formatted but a few basic things should be attend when adding code to DokuWiki. ==== Brackets and Indentations ==== You should indent your code by either 2 or 4 **spaces** to mark logical blocks. Please **do not use tabs**. The same number of spaces should be used through the whole file, so check how many spaces the existing code uses and use the same amount. Opening brackets should start on the same line as the keyword, closing bracket should be aligned below the first letter of the starting keyword. Eg: if ($foo == "bar"){ call_bar(); }elseif($foo == "baz"){ call_baz(); }else{ call_other(); } ==== Lineendings ==== Lines should end with a single linefeed character (UNIX style). Please try to avoid trailing whitespace. Have a look at my [[:.vimrc]] file on how to spot it easily in VIM. ==== Commenting ==== Each function and class should have a PHPDocumentor style comment, giving at least the function's purpose and its author. Parameter and return value descriptions are nice but only mandatory if they are not obvious. If you enhance an existing function just add another author line. Example: /** * Check for foo in bar * * Checks if there is a foo in bar * * @author Joe Schmoe * @param string $in your input * @returns boolean true if foo in bar */ function is_foo($in){ ... } These comments are used for the [[http://dev.splitbrain.org/reference/dokuwiki/|autogenerated API Docs]]. ==== PHP closing tags ==== You should omit PHP's closing tags (''?>'') in all files to avoid premature output. This may sound strange but is actually mentioned in the [[http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php|PHP manual]]: > **Note:** The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include() or require(), so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files. ==== Unit Tests ==== All new code additions should be accompanied by appropriate test cases as described in [[wiki:UnitTesting]]. ===== Sending Patches ===== Patches should be send to the [[mailinglist]] or to . Patches created by [[darcs]] are preferred and much simpler to integrate. If darcs is not an option, you should create patches in unified diff format (''diff -u'') against the latest available [[http://dev.splitbrain.org/browse/snapshots/|daily snapshot]]. ===== Development Docs ===== Here is a list of documents which should help you to understand some of [[DokuWikis]] internals. * [[wiki:devel:dirlayout|Directory Layout]] -- What are all those directories and files? * [[Parser]] -- Overview on the parser and render system. * [[wiki:devel:JavaScript]] -- How is JavaScript integrated into DokuWiki's Userinterface * [[wiki:devel:CSS]] -- How stylesheets are handled