[valadoc] Parser: Fix embedded



commit d27d8b9eea44ca5ae5607b2033755526c89d0415
Author: Didier 'Ptitjes <ptitjes at free dot fr>
Date:   Sat Oct 31 03:59:30 2009 +0100

    Parser: Fix embedded

 src/libvaladoc/content/embedded.vala               |    3 +--
 .../documentation/documentationparser.vala         |    7 ++++---
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/libvaladoc/content/embedded.vala b/src/libvaladoc/content/embedded.vala
index d9c717b..882fb4b 100755
--- a/src/libvaladoc/content/embedded.vala
+++ b/src/libvaladoc/content/embedded.vala
@@ -25,7 +25,7 @@ using Gee;
 
 public class Valadoc.Content.Embedded : ContentElement, Inline, StyleAttributes {
 	public string url { get; set; }
-	public string caption { get; set; }
+	public string? caption { get; set; }
 
 	public HorizontalAlign? horizontal_align { get; set; }
 	public VerticalAlign? vertical_align { get; set; }
@@ -49,4 +49,3 @@ public class Valadoc.Content.Embedded : ContentElement, Inline, StyleAttributes
 		visitor.visit_embedded (this);
 	}
 }
-
diff --git a/src/libvaladoc/documentation/documentationparser.vala b/src/libvaladoc/documentation/documentationparser.vala
index e615b5d..48e9214 100644
--- a/src/libvaladoc/documentation/documentationparser.vala
+++ b/src/libvaladoc/documentation/documentationparser.vala
@@ -306,11 +306,12 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
 		Rule embedded =
 			Rule.seq ({
 				TokenType.DOUBLE_OPEN_BRACE.action (() => { _scanner.set_url_escape_mode (true); }),
-				TokenType.any_word (),
+				TokenType.any_word ().action ((token) => { ((Embedded) peek ()).url = token.to_string (); }),
 				Rule.option ({
 					TokenType.PIPE.action (() => { _scanner.set_url_escape_mode (false); }),
-					run
-				}),
+					text
+				})
+				.set_reduce (() => { var caption = pop () as Text; ((Embedded) peek ()).caption = caption.content; }),
 				TokenType.DOUBLE_CLOSED_BRACE.action (() => { _scanner.set_url_escape_mode (false); })
 			})
 			.set_name ("Embedded")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]