วิธีการติดตั้ง
เวลาที่ต้องการดู source code ถ้าจะให้อ่านง่าย จำเป็นต้องแสดงผลโดยใช้สีสันเข้ามาช่วย (highlight & Syntax Coloring) ซึ่งใน Trac นั้น ก็มีเหมือนกัน โดยใน trac 0.11 เป็นต้นมา จะใช้ pygments ซึ่งมีมาให้อยู่แล้ว แต่เราจำเป็นต้องลง library นี้ในเครื่องก่อน
$ svn propset svn:mime-type text/x-c++src example.cpp property 'svn:mime-type' set on 'example.cpp '
ถ้าลงแล้ว syntax coloring ยังไม่ปรากฎ แสดงว่า Trac ยังอ่าน file ของเราไม่รู้เรื่อง จำเป็นต้องกำหนด MIME type ในกับไฟล์ที่เราต้องการใน svn ก่อน
easy_install Pygments
MIME Type
| MIME Types | Programing Language & File type |
|---|---|
| application/javascript | js |
| application/pdf | pdf |
| application/postscript | ps |
| application/rss+xml | rss |
| application/rtf | rtf |
| application/x-csh | csh |
| application/x-genshi | genshi |
| application/x-genshi-text | genshitext |
| application/x-sh | sh |
| application/x-troff | nroff roff troff |
| application/x-yaml | yaml yml |
| application/xsl+xml | xsl |
| application/xslt+xml | xslt |
| image/svg+xml | svg |
| image/x-icon | ico |
| model/vrml | vrml wrl |
| text/css | css |
| text/html | htm html |
| text/plain | AUTHORS COPYING ChangeLog INSTALL README RELEASE TXT text txt |
| text/x-ada | ada |
| text/x-asm | asm |
| text/x-asp | asp |
| text/x-awk | awk |
| text/x-c++hdr | H HH c++hdr hh hpp |
| text/x-c++src | C C++ CC c++ c++src cc cpp |
| text/x-chdr | chdr h |
| text/x-csharp | C# c# cs csharp |
| text/x-csrc | c csrc xs |
| text/x-diff | diff patch |
| text/x-eiffel | e eiffel |
| text/x-elisp | el elisp |
| text/x-fortran | f fortran |
| text/x-haskell | haskell hs |
| text/x-idl | idl |
| text/x-inf | inf |
| text/x-ini | cfg ini |
| text/x-java | java |
| text/x-ksh | ksh |
| text/x-lua | lua |
| text/x-m4 | m4 |
| text/x-mail | mail |
| text/x-makefile | GNUMakefile Makefile make makefile mk |
| text/x-objc | m mm objc |
| text/x-ocaml | ml mli ocaml |
| text/x-pascal | pas pascal |
| text/x-perl | PL perl pl pm |
| text/x-php | php php3 php4 |
| text/x-psp | psp |
| text/x-pyrex | pyrex pyx |
| text/x-python | py python |
| text/x-python-doctest | pycon |
| text/x-rfc | rfc |
| text/x-rst | rst |
| text/x-ruby | rb ruby |
| text/x-scheme | scheme scm |
| text/x-sql | sql |
| text/x-tcl | tcl |
| text/x-tex | tex |
| text/x-textile | textile txtl |
| text/x-vba | bas vb vba |
| text/x-verilog | v verilog |
| text/x-vhdl | vhd vhdl |
| text/x-zsh | zsh |
| text/xml | xml |
Reference
svn propset : http://svnbook.red-bean.com/en/1.1/re23.html
Trac : http://trac.edgewall.org/wiki/TracSyntaxColoring
Pygments : http://pygments.org/

0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
You must be logged in to post a comment.