wiki:TracCodeProcessorMacro

Version 2 (modified by manski, 5 years ago) (diff)

--

Code Wiki Processor

This is an external plugin. Please don't report any tickets here. See below for more information.

Description

This plugin provides a wiki processor for code listing that uses file extensions for language detection rather than mimetypes. Normally you would - for more "exotic" programming languages - have to specify the mimetype for a codelisting, like this:

{{{
#!text/css
div.lang-name-template {
  margin: -1em 1.75em 1em 1.75em;
  background: #F7F7F7;
  text-align: right;
  padding-right: 0.5em;
  border-style: solid;
  border-color: #D7D7D7;
  border-width: 0 1px 1px 1px;
}
}}}

Since mimetypes are often hard to remember (is it text/... or applicaton/... or ...) and you have to dig to find the actual mimetype of a certain programing language this wiki processor addresses this problem. You only have to specify the file extension of the progamming language. To specify to code block above using this plugin simply write:

{{{
#!code(lang=css)
div.lang-name-template {
  margin: -1em 1.75em 1em 1.75em;
  background: #F7F7F7;
  text-align: right;
  padding-right: 0.5em;
  border-style: solid;
  border-color: #D7D7D7;
  border-width: 0 1px 1px 1px;
}
}}}

This results in:

As a nice bonus the programming language is display in the lower right corner of the listing. This way a reader can easily identify the language the listing is written in.

Source and Tickets

You'll find all information about this ticket here. Please file only tickets there.

Author/Contributors

Author: Sebastian Krysmanski
Contributors:

Attachments (1)

Download all attachments as: .zip