close Warning: Can't synchronize with repository "(default)" (/common/SVN/crkit does not appear to be a Subversion repository.). Look in the Trac log for more information.

Changes between Version 3 and Version 4 of WikiHtml


Ignore:
Timestamp:
Jan 30, 2019, 11:46:21 PM (5 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiHtml

    v3 v4  
    1 = Using HTML in Wiki Text
     1= Using HTML in Wiki Text =
    22
    33Trac supports the display of HTML in any wiki context, by using the `#!html` [wiki:WikiProcessors WikiProcessor].
     
    66In 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.
    77
    8 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.
    9 
    10 == How to use `#!html` #HowtoUseHTML
     8Fortunately, 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.
     9
     10== How to use `#!html` == #HowtoUseHTML
    1111To inform the wiki engine that a block of text should be treated as HTML, use the ''html'' processor:
    1212
     
    1414{{{#!td
    1515  {{{
    16   {{{#!html
     16  {{{
     17  #!html
    1718  <h1 style="text-align: right; color: blue">HTML Test</h1>
    1819  }}}
     
    2021}}}
    2122{{{#!td style="padding-left: 2em"
    22   {{{#!html
     23  {{{
     24  #!html
    2325  <h1 style="text-align: right; color: blue">HTML Test</h1>
    2426  }}}
     
    2729Note 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.
    2830
    29 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 cannot use two HTML blocks, one for opening a <div> and another for closing it, in order to wrap arbitrary wiki text.
     31The 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.
     32The new way to wrap any wiki content inside a <div> is to use the `#!div` Wiki processor.
    3033
    3134== How to use `#!div` and `#!span` == #HowtoUseDivSpan
     
    3437{{{#!td
    3538  {{{
    36   {{{#!div class="important"
     39  {{{
     40  #!div class="important"
    3741  **important** is a predefined class.
    3842  }}}
    3943  }}}
    4044  {{{
    41   {{{#!div style="border: 1pt dotted; margin: 1em"
     45  {{{
     46  #!div style="border: 1pt dotted; margin: 1em"
    4247  **wikipage** is another predefined class that will
    4348  be used when no class is specified.
     
    4550  }}}
    4651  {{{
    47   {{{#!div class="compact" style="border: 1pt dotted; margin: 1em"
     52  {{{
     53  #!div class="compact" style="border: 1pt dotted; margin: 1em"
    4854  **compact** is another predefined class reducing
    4955  the padding within the `<div>` to a minimum.
     
    5157  }}}
    5258  {{{
    53   {{{#!div class="wikipage compact" style="border: 1pt dotted"
     59  {{{
     60  #!div class="wikipage compact" style="border: 1pt dotted"
    5461  Classes can be combined (here **wikipage** and **compact**)
    5562  which results in this case in reduced //vertical//
     
    5966  }}}
    6067  {{{
    61   {{{#!div class="" style="border: 1pt dotted; margin: 1em"
     68  {{{
     69  #!div class="" style="border: 1pt dotted; margin: 1em"
    6270  Explicitly specifying no classes is //not// the same
    6371  as specifying no class attribute, as this will remove
     
    6876{{{#!td style="padding-left: 2em"
    6977
    70   {{{#!div class="important"
     78  {{{
     79  #!div class="important"
    7180  **important** is a predefined class.
    7281  }}}
    7382
    74   {{{#!div style="border: 1pt dotted; margin: 1em"
     83  {{{
     84  #!div style="border: 1pt dotted; margin: 1em"
    7585  **wikipage** is another predefined class that will
    7686  be used when no class is specified.
    7787  }}}
    7888
    79   {{{#!div class="compact" style="border: 1pt dotted; margin: 1em"
     89  {{{
     90  #!div class="compact" style="border: 1pt dotted; margin: 1em"
    8091  **compact** is another predefined class reducing
    8192  the padding within the `<div>` to a minimum.
    8293  }}}
    8394
    84   {{{#!div class="wikipage compact" style="border: 1pt dotted"
     95  {{{
     96  #!div class="wikipage compact" style="border: 1pt dotted"
    8597  Classes can be combined (here **wikipage** and **compact**)
    8698  which results in this case in reduced //vertical//
     
    89101  }}}
    90102
    91   {{{#!div class="" style="border: 1pt dotted; margin: 1em"
     103  {{{
     104  #!div class="" style="border: 1pt dotted; margin: 1em"
    92105  Explicitly specifying no classes is //not// the same
    93106  as specifying no class attribute, as this will remove
     
    97110}}}
    98111
    99 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 [TracInterfaceCustomization#SiteAppearance site/style.css].
     112Note 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.
    100113
    101114For spans, you should use the Macro call syntax:
     
    114127}}}
    115128
    116 == How to use `#!td` and other table related processors #Tables
     129== How to use `#!td` and other table related processors == #Tables
    117130
    118131The `#!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.
     
    152165 attributes to the table itself...
    153166 
    154  {{{#!table style="border:none;text-align:center;margin:auto"
     167 {{{
     168 #!table style="border:none;text-align:center;margin:auto"
    155169   {{{#!tr ====================================
    156170     {{{#!th style="border: none"
     
    214228attributes to the table itself...
    215229
    216 {{{#!table style="border:none;text-align:center;margin:auto"
     230{{{
     231#!table style="border:none;text-align:center;margin:auto"
    217232  {{{#!tr ====================================
    218233    {{{#!th style="border: none"
     
    288303}}}
    289304
    290 == HTML comments
     305== HTML comments ==
    291306HTML 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:
    292307||= Wiki Markup =||
    293308{{{#!td
    294309  {{{
    295   {{{#!htmlcomment
     310  {{{
     311  #!htmlcomment
    296312  This block is translated to an HTML comment.
    297313  It can contain <tags> and &entities; that will not be escaped in the output.
     
    310326}}}
    311327
    312 The character sequence `--` is not allowed in HTML comments, and will generate a rendering error.
    313 
    314 
    315 == More Information
     328Please note that the character sequence "`--`" is not allowed in HTML comments, and will generate a rendering error.
     329
     330
     331== More Information ==
    316332
    317333 * http://www.w3.org/ -- World Wide Web Consortium
     
    319335
    320336----
    321 See also:  WikiFormatting, WikiProcessors, WikiRestructuredText
     337See also:  WikiProcessors, WikiFormatting, WikiRestructuredText