[gtk-doc] Make the parsing of lists a bit more robust
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] Make the parsing of lists a bit more robust
- Date: Thu, 30 Jan 2014 21:30:15 +0000 (UTC)
commit 24123c14750979813b0e7b4211a223dd49e65858
Author: William Jon McCann <william jon mccann gmail com>
Date: Thu Jan 30 16:12:24 2014 -0500
Make the parsing of lists a bit more robust
https://bugzilla.gnome.org/show_bug.cgi?id=723288
gtkdoc-mkdb.in | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index d0aca87..8d4068f 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -4610,6 +4610,7 @@ sub ConvertMarkDown {
$md_in_tags{"para"} = 0;
$md_in_tags{"refsect2"} = 0;
$md_in_tags{"refsect3"} = 0;
+ $md_in_tags{"itemizedlist"} = 0;
$text = ConvertMarkDownOpenTag ("para") . $text;
@@ -4620,6 +4621,7 @@ sub ConvertMarkDown {
\&ConvertMarkDownCallback);
$text .= &ConvertMarkDownTerminateTag ("para");
+ $text .= &ConvertMarkDownTerminateTag ("itemizedlist");
$text .= &ConvertMarkDownTerminateTag ("refsect3");
$text .= &ConvertMarkDownTerminateTag ("refsect2");
@@ -4656,6 +4658,24 @@ sub ReplaceMarkDownSections {
return $result;
}
+sub ReplaceMarkDownListItem {
+ my ($block, $is_last) = @_;
+ my $result = "";
+ my $tag = "refsect3";
+
+ if ($md_in_tags{"itemizedlist"} < 1) {
+ $result .= ConvertMarkDownOpenTag ("itemizedlist");
+ }
+
+ $result .= "<listitem><para>$block</para></listitem>";
+
+ if ($is_last == 1) {
+ $result .= &ConvertMarkDownTerminateTag ("itemizedlist");
+ }
+
+ return $result;
+}
+
sub ReplaceMarkDownPara {
my $result = "";
@@ -4702,10 +4722,8 @@ sub ConvertMarkDownCallback {
#
# New paragraph.
$text.="\n"; # we need a new line to avoid too complicated matching rules below
- if ($text =~ s%(?<=\n)-\s+(.+?)(?=(?:\n-\s+)|(?:\n\n)|(?:\n$))%<listitem><para>$1</para></listitem>%gs) {
- $text =~ s%(?<!</listitem>)(\n<listitem>)%\n<itemizedlist>$1%g;
- $text =~ s%(</listitem>\n)(?!<listitem>)%$1</itemizedlist>\n%g;
- }
+ our $is_last = 0;
+ $text =~
s%(?<=\n)-\s+(.+?)(?=(?:\n-\s+(?{$is_last=0}))|(?:\n\n(?{$is_last=1}))|(?:\n$(?{$is_last=1})))%ReplaceMarkDownListItem($1,
$is_last)%egs;
chomp $text;
# Make Paragraphs on blank lines
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]