Edgewall Software

Changes between Version 3 and Version 4 of 0.12/WikiHtml


Ignore:
Timestamp:
Feb 5, 2010, 8:43:38 PM (14 years ago)
Author:
Christian Boos
Comment:

start to restructure the page before adding doc for complex tables

Legend:

Unmodified
Added
Removed
Modified
  • 0.12/WikiHtml

    v3 v4  
    11= Using HTML in Wiki Text =
    22
    3 Trac supports inserting HTML into any wiki context, accomplished using the HTML [wiki:WikiProcessors WikiProcessor].
     3Trac supports inserting HTML into any wiki context, accomplished using the `#!html` [wiki:WikiProcessors WikiProcessor].
    44
    5 HTML support is built-in, and does not require installing any additional packages.
     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.
    69
    7 == How to Use HTML ==
     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.
     15
     16== How to Use `#!html` == #HowtoUseHTML
    817To inform the wiki engine that a block of text should be treated as HTML, use the ''html'' processor.
    918
    10 This example should explain:
    11 {{{
    12 #!html
    13 <pre class="wiki">{{{
    14 #!html
    15 &lt;h1 style="text-align: right; color: blue"&gt;HTML Test&lt;/h1&gt;
    16 }}}</pre>
     19||= Wiki Markup =||= Display =||
     20{{{#!td
     21  {{{
     22  {{{
     23  #!html
     24  <h1 style="text-align: right; color: blue">HTML Test</h1>
     25  }}}
     26  }}}
    1727}}}
    18 
    19 Results in:
    20 {{{
    21 #!html
    22 <h1 style="text-align: right; color: blue">HTML Test</h1>
     28{{{#!td style="padding-left: 2em"
     29  {{{
     30  #!html
     31  <h1 style="text-align: right; color: blue">HTML Test</h1>
     32  }}}
    2333}}}
    2434
    2535Note 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.
    2636
    27 Since 0.11, the filtering is done by Genshi, and as such, the produced output will be a well-formed fragment of HTML. In other words, 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.
    28 The new way to wrap any wiki content inside a <div> is to use the ''div'' Wiki  processor:
     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.
    2939
    30 {{{
    31 {{{
    32 #!div class=important style="border: 2pt solid; text-align: center"
    33 This is the ''only'' way to go in Trac 0.11
     40== How to Use `#!div` and `#!span` == #HowtoUseDivSpan
     41
     42||= Wiki Markup =||= Display =||
     43{{{#!td
     44  {{{
     45  {{{
     46  #!div class=important style="border: 2pt solid; text-align: center"
     47  This is the ''only'' way to go in Trac 0.11
     48  }}}
     49  }}}
    3450}}}
    35 }}}
    36 
    37 Results in:
    38 {{{
    39 #!div class=important style="border: 2pt solid; text-align: center"
    40 This is the ''only'' way to go in Trac 0.11
     51{{{#!td style="padding-left: 2em"
     52  {{{
     53  #!div class=important style="border: 2pt solid; text-align: center"
     54  This is the ''only'' way to go in Trac 0.11
     55  }}}
    4156}}}
    4257
     
    4459
    4560For spans, you should rather use the Macro call syntax:
    46 {{{
    47  Hello [[span(''WORLD'' (click [#world-anchor here]), style=color: green; font-size: 120%, id=world-anchor)]]!
     61||= Wiki Markup =||= Display =||
     62{{{#!td
     63  {{{
     64  Hello
     65  [[span(''WORLD'' (click [#anchor here]), style=color: green; font-size: 120%, id=anchor)]]!
     66  }}}
    4867}}}
    49 
    50 Results in:
    51  Hello [[span(''WORLD'' (click [#world-anchor here]), style=color: green; font-size: 120%, id=world-anchor)]]!
     68|---------------------------------------------------------------------------------
     69||= Display =||
     70{{{#!td style="padding-left: 2em"
     71  Hello
     72  [[span(''WORLD'' (click [#anchor here]), style=color: green; font-size: 120%, id=anchor)]]!
     73}}}
    5274
    5375
    5476== HTML comments ==
    5577HTML 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:
    56 {{{
    57 {{{
    58 #!htmlcomment
    59 This block is translated to an HTML comment.
    60 It can contain <tags> and &entities; that will not be escaped in the output.
     78||= Wiki Markup =||
     79{{{#!td
     80  {{{
     81  {{{
     82  #!htmlcomment
     83  This block is translated to an HTML comment.
     84  It can contain <tags> and &entities; that will not be escaped in the output.
     85  }}}
     86  }}}
    6187}}}
     88|---------------------------------------------------------------------------------
     89||= Display =||
     90{{{#!td
     91  {{{
     92  <!--
     93  This block is translated to an HTML comment.
     94  It can contain <tags> and &entities; that will not be escaped in the output.
     95  -->
     96  }}}
    6297}}}
    63 results in the following block in the HTML output:
    64 {{{
    65 <!--
    66 This block is translated to an HTML comment.
    67 It can contain <tags> and &entities; that will not be escaped in the output.
    68 -->
    69 }}}
     98
    7099Please note that the character sequence "--" is not allowed in HTML comments, and will generate a rendering error.
    71100