Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://kodomo.cmm.msu.ru/trac/tanchiki/wiki/TracSyntaxColoring?action=diff&version=2
Äàòà èçìåíåíèÿ: Unknown
Äàòà èíäåêñèðîâàíèÿ: Mon Apr 11 22:58:11 2016
Êîäèðîâêà: IBM-866
TracSyntaxColoring (diff) òÀÓ Tanchiki

Changes between Version 1 and Version 2 of TracSyntaxColoring


Ignore:
Timestamp:
08/21/13 19:46:14 (3 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracSyntaxColoring

    v1 v2 ˆà
    11= Syntax Coloring of Source Code =ˆà
    2ˆàTrac supports language-specific syntax highlighting of source code in [wiki:WikiFormatting wiki formatted] text and the [wiki:TracBrowser repository browser].ˆà
    ˆà2Trac supports language-specific syntax highlighting of source code within wiki formatted text in [WikiProcessors#CodeHighlightingSupport wiki processors] blocks and in the [TracBrowser repository browser].ˆà
    33ˆà
    44To do this, Trac uses external libraries with support for a great number of programming languages.ˆà
    òÀæ òÀæ ˆà
    66Currently Trac supports syntax coloring using one or more of the following packages:ˆà
    77ˆà
    8ˆà * [http://www.codento.com/people/mtr/genscript/ GNU Enscript] ˆà
    9ˆà * [http://silvercity.sourceforge.net/ SilverCity]ˆà
    10ˆà * [http://pygments.pocoo.org/ Pygments] (but needs a plugin for 0.10, see [#AboutPygments below])ˆà
    ˆà8 * [http://pygments.pocoo.org/ Pygments], by far the preferred system, as it covers a wide range of programming languages and other structured texts and is actively supportedˆà
    ˆà9 * [http://www.codento.com/people/mtr/genscript/ GNU Enscript], commonly available on Unix but somewhat unsupported on Windowsˆà
    ˆà10 * [http://silvercity.sourceforge.net/ SilverCity], legacy system, some versions can be [http://trac.edgewall.org/wiki/TracFaq#why-is-my-css-code-not-being-highlighted-even-though-i-have-silvercity-installed problematic]ˆà
    1111ˆà
    12ˆàTo activate syntax coloring, simply install either one (or more) of these packages. No additional configuration is required, however to modify the colors, have a look at `trac/htdocs/css/code.css`.ˆà
    1312ˆà
    14ˆàIf you don't know why trac isnt detecting an installed library, try turning on Trac logging. It actually appears that Trac is broken with !SilverCity 0.9.6. Either use the current 0.9.7 or the older 0.9.5 http://trac.edgewall.org/wiki/TracFaq#why-is-my-css-code-not-being-highlighted-even-though-i-have-silvercity-installedˆà
    ˆà13To activate syntax coloring, simply install either one (or more) of these packages (see [#ExtraSoftware] section below).ˆà
    ˆà14If none of these packages is available, Trac will display the data as plain text. ˆà
    1515ˆà
    16ˆàWhen in use, Trac will automatically prioritize !SilverCity highlighting over Enscript if possible, (see note below). ˆà
    17ˆàˆà
    18ˆàIf neither package is available, Trac will display the data as plain text. ˆà
    19ˆàˆà
    20ˆà'''Note:''' Enscript supports a greater number of languages, however !SilverCity is generally faster since it is a library and isn't executed in an external process.ˆà
    21ˆàˆà
    22ˆà=== About !SilverCity ===ˆà
    23ˆà!SilverCity uses the lexer from [http://www.scintilla.org/ Scintilla]. Scintilla supports more languages than !SilverCity implements. If you want to add a language to !SilverCity supported by Scintilla, it's not very difficult. See [http://trac.edgewall.org/wiki/SilverCityAddLanguage SilverCityAddLanguage] for some information how.ˆà
    2416ˆà
    2517=== About Pygments ===ˆà
    2618ˆà
    27ˆàStarting with trac 0.11 [http://pygments.org/ pygments] will be the new default highlighter. It's a highlighting library implemented in pure python, very fast, easy to extend and [http://pygments.org/docs/ well documented]. While it does not support as many languages as Enscript or Scintilla the overall output quality is much better.ˆà
    ˆà19Starting with trac 0.11 [http://pygments.org/ pygments] will be the new default highlighter. It's a highlighting library implemented in pure python, very fast, easy to extend and [http://pygments.org/docs/ well documented].ˆà
    2820ˆà
    29ˆàTo use pygments in trac 0.11 you just have to install pygments 0.6 or higher.  If you want to use it in trac 0.10 too you have to install the [th:TracPygmentsPlugin TracPygmentsPlugin] from trac hacks. If you encounter any bugs, please file tickets regarding Pygments at [http://dev.pocoo.org/projects/pygments/ the Pygments Trac site].ˆà
    30ˆàˆà
    31ˆàThe Pygments default style can specified in the [TracIni#mimeviewer-section mime-viewer] section of trac.ini. The default style can be over-ridden by setting a Style preference on the [/prefs/pygments preferences page]. ˆà
    ˆà21The Pygments default style can specified in the [TracIni#mimeviewer-section mime-viewer] section of trac.ini. The default style can be overridden by setting a Style preference on the [/prefs/pygments preferences page]. ˆà
    3222ˆà
    3323It's very likely that the list below is outdated because the list of supported pygments lexers is growing weekly. Just have a look at the page of [http://pygments.org/docs/lexers/ supported lexers] on the pygments webpage.ˆà
    òÀæ òÀæ ˆà
    3626== Syntax Coloring Support ==ˆà
    3727ˆà
    38ˆà|| || !SilverCity || Enscript || Pygments ||ˆà
    39ˆà|| Ada      ||   || X || ||ˆà
    40ˆà|| Asm      ||   || X || ||ˆà
    41ˆà|| Apache Conf (htaccess)) || || || X ||ˆà
    42ˆà|| * ASP    || X || X || ||ˆà
    43ˆà|| * C      || X || X || X ||ˆà
    44ˆà|| * C#     ||   || X(2) || X ||ˆà
    45ˆà|| * C++    || X || X || X ||ˆà
    46ˆà|| * Java   || X(4)|| X || X ||ˆà
    47ˆà|| Awk      ||   || X || ||ˆà
    48ˆà|| Boo || || || X ||ˆà
    49ˆà|| CSS      || X ||   || X ||ˆà
    50ˆà|| Python Doctests || || || X ||ˆà
    51ˆà|| Diff     ||   || X || X ||ˆà
    52ˆà|| Eiffel   ||   || X || ||ˆà
    53ˆà|| Elisp    ||   || X || ||ˆà
    54ˆà|| Fortran  ||   || X(3) || X ||ˆà
    55ˆà|| Haskell  ||   || X || X ||ˆà
    56ˆà|| Genshi || || || X ||ˆà
    57ˆà|| HTML     || X || X || X ||ˆà
    58ˆà|| IDL      ||   || X || ||ˆà
    59ˆà|| INI || || || X ||ˆà
    60ˆà|| Javascript || X || X || X ||ˆà
    61ˆà|| Lua || || || X ||ˆà
    62ˆà|| m4       ||   || X || ||ˆà
    63ˆà|| Makefile ||   || X || X ||ˆà
    64ˆà|| Mako || || || X ||ˆà
    65ˆà|| Matlab   ||   || X (5) || ||ˆà
    66ˆà|| Mygthy || || || X ||ˆà
    67ˆà|| Objective-C|| || X ||X ||ˆà
    68ˆà|| OCaml    ||   ||   || X ||ˆà
    69ˆà|| Pascal   ||   || X || X ||ˆà
    70ˆà|| * Perl   || X || X || X ||ˆà
    71ˆà|| * PHP    || X ||   || X ||ˆà
    72ˆà|| PSP      || X ||   || ||ˆà
    73ˆà|| Pyrex    ||   || X || ||ˆà
    74ˆà|| * Python || X || X || X ||ˆà
    75ˆà|| * Ruby   || X || X (1) || X ||ˆà
    76ˆà|| Scheme   ||   || X || X ||ˆà
    77ˆà|| Shell    ||   || X || X ||ˆà
    78ˆà|| Smarty || || || X ||ˆà
    79ˆà|| SQL      || X || X || X ||ˆà
    80ˆà|| Troff    ||   || X || X ||ˆà
    81ˆà|| TCL      ||   || X || ||ˆà
    82ˆà|| Tex      ||   || X || X ||ˆà
    83ˆà|| Verilog  || X(4) || X || ||ˆà
    84ˆà|| VHDL     ||   || X || ||ˆà
    85ˆà|| Visual Basic |||| X || X ||ˆà
    86ˆà|| VRML     ||   || X || ||ˆà
    87ˆà|| XML      || X ||  || X ||ˆà
    ˆà28=== Known MIME Typesˆà
    8829ˆà
    89ˆà''(*) Supported as inline code blocks in [wiki:WikiFormatting Wiki text] using WikiProcessors.''ˆà
    ˆà30[[KnownMimeTypes]]ˆà
    9031ˆà
    91ˆà''(1) Ruby highlighting is not included in the Enscript distribution.  Highlighting rules for Ruby can be obtained from: http://neugierig.org/software/ruby/ˆà
    ˆà32Note that the rich content may be directly //rendered// instead of syntax highlighted. This usually depends on which auxiliary packages are installed and on which components are activated in your setup. For example a `text/x-rst` document will be rendered via `docutils` if it is installed and the `trac.mimeview.rst.ReStructuredTextRenderer` is not disabled, and will be syntax highlighted otherwise.ˆà
    9233ˆà
    93ˆà''(2) C# highlighting is not included in the Enscript distribution.  Highlighting rules for C# can be obtained from: http://wiki.hasno.info/index.php/Csharp.stˆà
    ˆà34In a similar way, a document with the mimetype `text/x-trac-wiki` is rendered using the Trac wiki formatter, unless the `trac.mimeview.api.WikiTextRenderer` component is disabled.ˆà
    9435ˆà
    95ˆà''(3) Fortran: as packaged, Enscript only supports the fixed source form. Highlighting rules for Fortran 90x/2003 can be obtained from: http://wiki.hasno.info/index.php/F90.stˆà
    ˆà36HTML documents are directly rendered only if the `render_unsafe_html` settings are enabled in the TracIni (those settings are present in multiple sections, as there are different security concerns depending where the document comes from). If you want to ensure that an HTML document gets syntax highlighted and not rendered, use the `text/xml` mimetype.ˆà
    9637ˆà
    97ˆà''(4) since Silvercity 0.9.7 released on 2006-11-23ˆà
    ˆà38If mimetype such as 'svn:mime-type' is set to 'text/plain', there is no coloring even if file is known type like 'java'.ˆà
    9839ˆà
    99ˆà''(5) By default `.m` files are considered Objective-C files. In order to treat `.m` files as MATLAB files, add "text/x-matlab:m" to the "mime_map" setting in the [wiki:TracIni#mimeviewer-section "[mimeviewer] section of trac.ini"].ˆà
    ˆà40=== List of Languages Supported, by Highlighter #language-supportedˆà
    ˆà41ˆà
    ˆà42This list is only indicative.ˆà
    ˆà43ˆà
    ˆà44||                 ||= !SilverCity   =||= Enscript      =||= Pygments =||ˆà
    ˆà45|| Ada             ||                 ||  òÜÓ              ||     ||ˆà
    ˆà46|| Asm             ||                 ||  òÜÓ              ||     ||ˆà
    ˆà47|| Apache Conf     ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà48|| ASP             ||  òÜÓ              ||  òÜÓ              ||     ||ˆà
    ˆà49|| C               ||  òÜÓ              ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà50|| C#              ||                 ||  òÜÓ ^[#a1 (1)]^  ||  òÜÓ  ||ˆà
    ˆà51|| C++             ||  òÜÓ              ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà52|| CMake           ||  ?              ||  ?              ||  òÜÓ  ||ˆà
    ˆà53|| Java            ||  òÜÓ ^[#a2 (2)]^  ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà54|| Awk             ||                 ||  òÜÓ              ||     ||ˆà
    ˆà55|| Boo             ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà56|| CSS             ||  òÜÓ              ||                 ||  òÜÓ  ||ˆà
    ˆà57|| Python Doctests ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà58|| Diff            ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà59|| Eiffel          ||                 ||  òÜÓ              ||     ||ˆà
    ˆà60|| Elisp           ||                 ||  òÜÓ              ||     ||ˆà
    ˆà61|| Fortran         ||                 ||  òÜÓ ^[#a1 (1)]^  ||  òÜÓ  ||ˆà
    ˆà62|| Haskell         ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà63|| Genshi          ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà64|| HTML            ||  òÜÓ              ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà65|| IDL             ||                 ||  òÜÓ              ||     ||ˆà
    ˆà66|| INI             ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà67|| Javascript      ||  òÜÓ              ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà68|| Lua             ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà69|| m4              ||                 ||  òÜÓ              ||     ||ˆà
    ˆà70|| Makefile        ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà71|| Mako            ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà72|| Matlab ^[#a3 (3)]^  ||             ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà73|| Mygthy          ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà74|| Objective-C     ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà75|| OCaml           ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà76|| Pascal          ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà77|| Perl            ||  òÜÓ              ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà78|| PHP             ||  òÜÓ              ||                 ||  òÜÓ  ||ˆà
    ˆà79|| PSP             ||  òÜÓ              ||                 ||     ||ˆà
    ˆà80|| Pyrex           ||                 ||  òÜÓ              ||     ||ˆà
    ˆà81|| Python          ||  òÜÓ              ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà82|| Ruby            ||  òÜÓ              ||  òÜÓ ^[#a1 (1)]^  ||  òÜÓ  ||ˆà
    ˆà83|| Scheme          ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà84|| Shell           ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà85|| Smarty          ||                 ||                 ||  òÜÓ  ||ˆà
    ˆà86|| SQL             ||  òÜÓ              ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà87|| Troff           ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà88|| TCL             ||                 ||  òÜÓ              ||     ||ˆà
    ˆà89|| Tex             ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà90|| Verilog         ||  òÜÓ ^[#a2 (2)]^  ||  òÜÓ              ||     ||ˆà
    ˆà91|| VHDL            ||                 ||  òÜÓ              ||     ||ˆà
    ˆà92|| Visual Basic    ||                 ||  òÜÓ              ||  òÜÓ  ||ˆà
    ˆà93|| VRML            ||                 ||  òÜÓ              ||     ||ˆà
    ˆà94|| XML             ||  òÜÓ              ||                 ||  òÜÓ  ||ˆà
    ˆà95ˆà
    ˆà96ˆà
    ˆà97ˆà
    ˆà98''[=#a1 (1)] Not included in the Enscript distribution.  Additional highlighting rules can be obtained forˆà
    ˆà99[http://neugierig.org/software/ruby/ Ruby],ˆà
    ˆà100[http://wiki.hasno.info/index.php/Csharp.st C#],ˆà
    ˆà101[http://wiki.hasno.info/index.php/F90.st Fortran 90x/2003]ˆà
    ˆà102ˆà
    ˆà103''[=#a2 (2)] since Silvercity 0.9.7 released on 2006-11-23ˆà
    ˆà104ˆà
    ˆà105''[=#a3 (3)] By default `.m` files are considered Objective-C files. In order to treat `.m` files as MATLAB files, add "text/matlab:m" to the "mime_map" setting in the [wiki:TracIni#mimeviewer-section "[mimeviewer] section of trac.ini"].ˆà
    100106ˆà
    101107== Extra Software ==ˆà
    102ˆà * GNU Enscript -- http://directory.fsf.org/GNU/enscript.htmlˆà
    103ˆà * GNU Enscript for Windows -- http://gnuwin32.sourceforge.net/packages/enscript.htmˆà
    104ˆà * !SilverCity -- http://silvercity.sf.net/ˆà
    105ˆà * Pygments -- http://pygments.org/ˆà
    ˆà108 * GNU Enscript òÀÔ http://directory.fsf.org/GNU/enscript.htmlˆà
    ˆà109 * GNU Enscript for Windows òÀÔ http://gnuwin32.sourceforge.net/packages/enscript.htmˆà
    ˆà110 * !SilverCity òÀÔ http://silvercity.sf.net/ˆà
    ˆà111 * **Pygments òÀÔ http://pygments.org/**ˆà
    106112ˆà
    107113----ˆà
    108114See also: WikiProcessors, WikiFormatting, TracWiki, TracBrowserˆà
    109ˆàˆà