Changes between Version 5 and Version 6 of WikiHtml


Ignore:
Timestamp:
03/24/15 23:15:03 (3 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiHtml

    v5 v6  
    11= Using HTML in Wiki Text =
    22
    3 Trac supports the display of HTML in any wiki context, by using the `#!html` [wiki:WikiProcessors WikiProcessor].
    4 
    5 However, this HTML has to be [http://en.wikipedia.org/wiki/Well-formed_element well-formed].
    6 In particular, you can't insert a start tag in an `#!html` block, resume normal wiki text and insert the corresponding end tag in a second `#!html` block.
    7 
    8 Fortunately, for creating styled <div>s, <span>s  or even complex tables containing arbitrary Wiki text, there is a powerful alternative: `#!div`, `#!span` and `#!table`, `#!tr`, `#!td` and `#!th` blocks. Those Wiki processors are built-in and do not require additional packages to be installed.
     3Trac supports inserting HTML into any wiki context, accomplished using the `#!html` [wiki:WikiProcessors WikiProcessor].
     4
     5However a constraint is that this HTML has to be well-formed.
     6In particular you can't insert a start tag in an `#!html` block,
     7resume normal wiki text and insert the corresponding end tag in a
     8second `#!html` block.
     9
     10Fortunately, for creating styled <div>s, <span>s  or even complex tables
     11containing arbitrary Wiki text, there's a powerful alternative: use of
     12dedicated `#!div`, `#!span` and `#!table`, `#!tr`, `#!td` and `#!th` blocks.
     13
     14Those Wiki processors are built-in, and does not require installing any additional packages.
    915
    1016== How to use `#!html` == #HowtoUseHTML
    11 To inform the wiki engine that a block of text should be treated as HTML, use the ''html'' processor:
     17To inform the wiki engine that a block of text should be treated as HTML, use the ''html'' processor.
    1218
    1319||= Wiki Markup =||= Display =||
     
    2733}}}
    2834
    29 Note that Trac sanitizes your HTML code before displaying it. That means that potentially dangerous constructs, such as Javascript event handlers, will be removed from the output.
    30 
    31 The filtering is done by [http://genshi.edgewall.org/ Genshi] and the output will be a well-formed fragment of HTML. This means that you can no longer use two HTML blocks, one for opening a <div> and another for closing it, in order to wrap arbitrary wiki text.
    32 The new way to wrap any wiki content inside a <div> is to use the `#!div` Wiki processor.
     35Note that Trac sanitizes your HTML code before displaying it. That means that if you try to use potentially dangerous constructs such as Javascript event handlers, those will be removed from the output.
     36
     37Since 0.11, the filtering is done by Genshi, and as such, the produced output will be a well-formed fragment of HTML. As noted above in the introduction, this mean that you can no longer use two HTML blocks, one for opening a <div>, the second for closing it, in order to wrap arbitrary wiki text.
     38The new way to wrap any wiki content inside a <div> is to use the `#!div` Wiki  processor.
    3339
    3440== How to use `#!div` and `#!span` == #HowtoUseDivSpan
     
    110116}}}
    111117
    112 Note that the contents of a `#!div` block are contained in one or more paragraphs, which have a non-zero top and bottom margin. This leads to the top and bottom padding in the example above. To remove the top and bottom margin of the content, add the `compact` class to the `#!div`. Another predefined class besides `wikipage` and `compact` is `important`, which can be used to make a paragraph stand out. Extra CSS classes can be defined via the `site/style.css` file for example, see TracInterfaceCustomization#SiteAppearance.
    113 
    114 For spans, you should use the Macro call syntax:
     118Note that the contents of a `#!div` block are contained in one or more paragraphs, which have a non-zero top and bottom margin. This leads to the top and bottom padding in the example above. To remove the top and bottom margin of the contents, add the `compact` class to the `#!div`. Another predefined class besides `wikipage` and `compact` is `important`, which can be used to make a paragraph stand out. Extra CSS classes can be defined via the `site/style.css` file for example, see TracInterfaceCustomization#SiteAppearance.
     119
     120For spans, you should rather use the Macro call syntax:
    115121||= Wiki Markup =||
    116122{{{#!td
     
    129135== How to use `#!td` and other table related processors == #Tables
    130136
    131 The `#!td` or `#!th` processors should be used to create table data and table header cells, respectively. The other processors `#!table` and `#!tr` are not required for introducing a table structure, as `#!td` and `#!th` will do this automatically. The `|-` row separator can be used to start a new row when needed, but some may prefer to use a `#!tr` block for that, as this introduces a more formal grouping and offers the possibility to use an extra level of indentation. The main purpose of the `#!table` and `#!tr` is to give the possibility to specify HTML attributes, like ''style'' or ''valign'' to these elements.
     137`#!td` or `#!th` processors are actually the main ones, for creating table data and header cells, respectively. The other processors `#!table` and `#!tr` are not required for introducing a table structure, as `#!td` and `#!th` will do this automatically. The `|-` row separator can be used to start a new row when needed, but some may prefer to use a `#!tr` block for that, as this introduces a more formal grouping and offers the possibility to use an extra level of indentation. The main purpose of the `#!table` and `#!tr` is to give the possibility to specify HTML attributes, like ''style'' or ''valign'' to these elements.
    132138
    133139||= Wiki Markup =||= Display =||
     
    257263}}}
    258264
    259 Note that by default tables are assigned the "wiki" CSS class, which gives a distinctive look to the header cells and a default border to the table and cells, as can be seen for the tables on this page. By removing this class (`#!table class=""`), one regains complete control on the table presentation. In particular, neither the table nor the rows nor the cells will have a border, so this is a more effective way to get such an effect rather than having to specify a `style="border: no"` parameter everywhere.
     265Note that by default tables are assigned the "wiki" CSS class, which gives a distinctive look to the header cells and a default border to the table and cells (as can be seen for the tables on this page). By removing this class (`#!table class=""`), one regains complete control on the table presentation. In particular, neither the table, the rows nor the cells will have a border, so this is a more effective way to get such an effect than having to specify a `style="border: no"` parameter everywhere.
    260266
    261267{{{#!table class=""
     
    303309}}}
    304310
     311
    305312== HTML comments ==
    306 HTML comments are stripped from the output of the `html` processor. To add an HTML comment to a wiki page, use the `htmlcomment` processor, available since Trac 0.12:
     313HTML comments are stripped from the output of the `html` processor. To add an HTML comment to a wiki page, use the `htmlcomment` processor (available since 0.12). For example, the following code block:
    307314||= Wiki Markup =||
    308315{{{#!td