[gtk-doc] Add support for markdown blockquotes
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] Add support for markdown blockquotes
- Date: Thu, 6 Feb 2014 12:53:47 +0000 (UTC)
commit 81f4447adaf44e2f5cea3903377cdacd26050452
Author: William Jon McCann <william jon mccann gmail com>
Date: Tue Feb 4 23:49:05 2014 -0500
Add support for markdown blockquotes
https://bugzilla.gnome.org/show_bug.cgi?id=723696
gtkdoc-mkdb.in | 19 +++++++++++++++++--
style/style.css | 6 +++++-
tests/gobject/src/gobject.c | 9 +++++++++
3 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index 08b1bb1..09b35ae 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -2673,7 +2673,8 @@ sub ConvertSGMLCharsCallback {
# If we're not in CDATA convert to entities.
$text =~ s/&(?![a-zA-Z#]+;)/&/g; # Do this first, or the others get messed up.
$text =~ s/<(?![a-zA-Z\/!])/</g;
- $text =~ s/(?<![a-zA-Z0-9"'\/-])>/>/g;
+ # Allow ">" at beginning of string for blockquote markdown
+ $text =~ s/(?<=[^\w\n"'\/-])>/>/g;
# Handle "#include <xxxxx>"
$text =~ s/#include(\s+)<([^>]+)>/#include$1<$2>/g;
@@ -4705,7 +4706,13 @@ sub MarkDownParseBlocks {
next;
}
- if ($md_block->{"type"} eq "li") {
+ if ($md_block->{"type"} eq "quote") {
+ if (!$md_block->{"interrupted"}) {
+ $line =~ s/^[ ]*>[ ]?//;
+ push $md_block->{"lines"}, $line;
+ next OUTER;
+ }
+ } elsif ($md_block->{"type"} eq "li") {
if ($line =~ /^([ ]{0,3})(\d+[.]|[*+-])[ ](.*)/) {
my $indentation = $1;
if ($md_block->{"indentation"} ne $indentation) {
@@ -4837,6 +4844,11 @@ sub MarkDownParseBlocks {
last => 1,
lines => [ $lines ] };
next OUTER;
+ } elsif ($line =~ /^[ ]*>[ ]?(.*)/) {
+ push @md_blocks, $md_block;
+ $md_block = { type => "quote",
+ lines => [ $1 ] };
+ next OUTER;
}
# list item
@@ -5188,6 +5200,9 @@ sub MarkDownOutputDocBook {
}
$output .= "</".$tag.">\n";
}
+ } elsif ($block->{"type"} eq "quote") {
+ $text = &MarkDownParseLines ($block->{"lines"}, $symbol, "quote");
+ $output .= "<blockquote>\n" . $text . "</blockquote>\n";
} elsif ($block->{"type"} eq "code") {
if ($block->{"language"}) {
$output .= "<informalexample><programlisting language=\"" . $block->{"language"} . "\"><![CDATA[\n";
diff --git a/style/style.css b/style/style.css
index 221d1bc..f7ecc5f 100644
--- a/style/style.css
+++ b/style/style.css
@@ -224,7 +224,11 @@ dl.toc > dt
background: #d8ffb2;
border-color: #abf562;
}
-.note, .warning
+div.blockquote
+{
+ border-color: #eeeeec;
+}
+.note, .warning, div.blockquote
{
padding: 0.5em;
border-width: 1px;
diff --git a/tests/gobject/src/gobject.c b/tests/gobject/src/gobject.c
index 1cfd4a4..a029801 100644
--- a/tests/gobject/src/gobject.c
+++ b/tests/gobject/src/gobject.c
@@ -5,6 +5,9 @@
* @see_also: #GtkdocIface
* @Image: object.png
*
+ * > Two line
+ * > quote
+ *
* Offsets are time values to be added to local
* time to get Coordinated Universal Time (UTC) and should be
* <literal>"[±]hh[[:]mm[:ss]]"</literal>. Dates are either
@@ -61,6 +64,12 @@
*
* This is a section with a heading without a trailing hash mark.
*
+ * > Do not confuse the GtkUIManager UI Definitions described here with
+ * > the similarly named <link linkend="BUILDER-UI">GtkBuilder UI
+ * > Definitions</link>.
+ *
+ * > Single line quote
+ *
* <orderedlist>
* <listitem><para>
* This list is here to ensure the parsing of the above list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]