]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1130691: Support markdown tables
authorAlbert Ting <altlist@gmail.com>
Mon, 9 Mar 2015 13:45:48 +0000 (13:45 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Mon, 9 Mar 2015 13:45:48 +0000 (13:45 +0000)
r=dkl,a=glob

Bugzilla/Install/Requirements.pm
Bugzilla/Markdown.pm
skins/standard/global.css
template/en/default/pages/markdown.html.tmpl

index e9cf230c4f6304adae6a89888603f6f0b0ac18c1..e8a90cab7c2b9701a1a0e1ee57bd12be1f9dfeff 100644 (file)
@@ -404,9 +404,9 @@ sub OPTIONAL_MODULES {
 
     # Markdown
     {
-        package => 'Text-Markdown',
-        module  => 'Text::Markdown',
-        version => '1.0.26',
+        package => 'Text-MultiMarkdown',
+        module  => 'Text::MultiMarkdown',
+        version => '1.000035',
         feature => ['markdown'],
     },
 
index ed56080258de6dc5233335e382fb19cb0b1dd9df..e9b0d1a17acc07f8e084687442b412570610fe4a 100644 (file)
@@ -16,7 +16,7 @@ use Bugzilla::Template;
 
 use Digest::MD5 qw(md5_hex);
 
-use parent qw(Text::Markdown);
+use parent qw(Text::MultiMarkdown);
 
 @Bugzilla::Markdown::EXPORT = qw(new);
 
@@ -489,7 +489,7 @@ Bugzilla::Markdown - Generates HTML output from structured plain-text input.
 Bugzilla::Markdown implements a Markdown engine that produces
 an HTML-based output from a given plain-text input.
 
-The majority of the implementation is done by C<Text::Markdown>
+The majority of the implementation is done by C<Text::MultiMarkdown>
 CPAN module. It also applies the linkifications done in L<Bugzilla::Template>
 to the input resulting in an output which is a combination of both Markdown
 structures and those defined by Bugzilla itself.
index 3d9a4b1ed0079b68babbfee649be5ec8d187c7b0..6d0e64a865b9694f7c6b8d28dc92d7ddf5e427af 100644 (file)
@@ -336,6 +336,20 @@ pre.bz_comment_text, .uneditable_textarea, tbody.file pre {
     display: block;
 }
 
+.bz_comment_text table {
+    border-collapse:collapse;
+}
+
+.bz_comment_text table, .bz_comment_text th, .bz_comment_text td {
+    border: 1px solid #969696;
+    padding: 2px;
+}
+
+.bz_comment_text thead, .bz_comment_text tbody {
+     border-top: 2px solid black;
+     border-bottom: 2px solid black;
+}
+
 .bz_comment_user, .bz_comment_time, .bz_comment_number, 
 .bz_private_checkbox, .bz_comment_actions
 {
index 8b43f5f178fb0eb137619788f152e04610655eba..5b01ed43de3fce38ac11bcc4b8719ea042c47ad2 100644 (file)
@@ -25,6 +25,8 @@
     <li><a href="#code">Code</a></li>
     <li><a href="#strikethroughs">Strikethroughs</a></li>
     <li><a href="#links">Links</a></li>
+    <li><a href="#tables">Tables</a></li>
+    <li><a href="#definitions">Definitions</a></li>
   </ul>
 
 <h2 id="headers">Headers</h2>
     </pre>
   </p>
 
+<h2 id="tables">Tables</h2>
+
+Tables can be defined using these special syntax:
+
+<pre><code>
+        |             |          Grouping           ||
+        First Header  | Second Header | Third Header |
+         ------------ | :-----------: | -----------: |
+        Content       |          *Long Cell*        ||
+        Content       |   **Cell**    |         Cell |
+
+        New section   |     More      |         Data |
+        And more      |     More      |     **Data** |
+</code></pre>
+
+<p>which gets converted into:</p>
+
+<div class="bz_comment_text">
+  <table style="margin-left: 5em">
+    <colgroup>
+      <col style="text-align:left;"/>
+      <col style="text-align:center;"/>
+      <col style="text-align:right;"/>
+    </colgroup>
+
+    <thead>
+      <tr>
+       <th style="text-align:left;"></th>
+       <th style="text-align:center;" colspan="2">Grouping</th>
+      </tr>
+      <tr>
+       <th style="text-align:left;">First Header</th>
+       <th style="text-align:center;">Second Header</th>
+       <th style="text-align:right;">Third Header</th>
+      </tr>
+    </thead>
+    <tbody>
+      <tr>
+       <td style="text-align:left;">Content</td>
+       <td style="text-align:center;" colspan="2"><em>Long Cell</em></td>
+      </tr>
+      <tr>
+       <td style="text-align:left;">Content</td>
+       <td style="text-align:center;"><strong>Cell</strong></td>
+       <td style="text-align:right;">Cell</td>
+      </tr>
+    </tbody>
+    <tbody>
+      <tr>
+       <td style="text-align:left;">New section</td>
+       <td style="text-align:center;">More</td>
+       <td style="text-align:right;">Data</td>
+      </tr>
+      <tr>
+       <td style="text-align:left;">And more</td>
+       <td style="text-align:center;">More</td>
+       <td style="text-align:right;"><strong>Data</strong></td>
+      </tr>
+    </tbody>
+  </table>
+</div>
+
+<p>The table rules are:</p>
+
+<ul>
+  <li>There must be at least one <code>|</code> per line</li>
+  <li>The &#8220;separator&#8221; line between headers and table content must contain only <code>|</code>,<code>-</code>, <code>=</code>, <code>:</code>,<code>.</code>, <code>+</code>, or spaces</li>
+  <li>Cell content must be on one line only</li>
+  <li>Columns are separated by <code>|</code></li>
+  <li>The first line of the table, and the alignment/divider line, must start at
+    the beginning of the line</li>
+</ul>
+
+<p>Other notes:</p>
+
+<ul>
+  <li>It is optional whether you have <code>|</code> characters at the beginning and end of lines.</li>
+  <li>The &#8220;separator&#8221; line uses <code>----</code> or <code>====</code> to indicate the line between a header and cell. The length of the line doesn&#8217;t matter, but must have at least one character per cell.</li>
+  <li>To set alignment, you can use a colon to designate left or right alignment, or a colon at each end to designate center alignment, as above. If no colon is present, the default alignment of your system is selected (left in most cases). </li>
+  <li>To indicate that a cell should span multiple columns, then simply add additional pipes (<code>|</code>) at the end of the cell, as shown in the example. If the cell in question is at the end of the row, then of course that means that pipes are not optional at the end of that row&#8230;. The number of pipes equals the number of columns the cell should span.</li>
+  <li>You can use Markdown markup within the table cells.</li>
+  <li>Cells can be empty.</li>
+</ul>
+
+<h2 id="definitions">Definition Lists</h2>
+
+Definition lists uses this syntax:
+
+<pre><code>
+        Apple
+        :   Pomaceous fruit of plants of the genus Malus in
+            the family Rosaceae.
+        :   An american computer company.
+
+        Orange
+        :   The fruit of an evergreen tree of the genus Citrus.
+</code></pre>
+
+<p>becomes:</p>
+
+<div class="bz_comment_text">
+  <dl style="margin-left: 5em">
+    <dt>Apple</dt>
+    <dd>Pomaceous fruit of plants of the genus Malus in
+      the family Rosaceae.</dd>
+
+    <dd>An american computer company.</dd>
+
+    <dt>Orange</dt>
+    <dd>The fruit of an evergreen tree of the genus Citrus.</dd>
+  </dl>
+</div>
+
+<p>You can have more than one term per definition by placing each term on a
+  separate line. Each definition starts with a colon, and you can have more than
+  one definition per term. You may optionally have a blank line between the last
+  term and the first definition.</p>
+
+<p>Definitions may contain other block level elements, such as lists,
+  blockquotes, or other definition lists.</p>
+
 [% PROCESS global/footer.html.tmpl %]