From dfb067b370a886a48f9594c8fc4cf7c200535da4 Mon Sep 17 00:00:00 2001 From: Konstantin Isakov Date: Thu, 14 May 2009 21:16:50 +0000 Subject: [PATCH] +! Basic support for comments in dsl ({{like this}}) --- src/dsl_details.cc | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/dsl_details.cc b/src/dsl_details.cc index af581923..b6b79140 100644 --- a/src/dsl_details.cc +++ b/src/dsl_details.cc @@ -228,6 +228,45 @@ ArticleDom::ArticleDom( wstring const & str ): } } // if ( ch == '<' ) + if ( ch == L'{' && !escaped ) + { + // Special case: {{comment}} + + nextChar(); + + if ( ch != L'{' || escaped ) + { + // Ok, it's not it. + --stringPos; + + if ( escaped ) + { + --stringPos; + escaped = false; + } + ch = L'{'; + } + else + { + // Skip the comment's body + for( ; ; ) + { + nextChar(); + + // Is it the end? + if ( ch == L'}' && !escaped ) + { + nextChar(); + + if ( ch == L'}' && !escaped ) + break; + } + } + + continue; + } + } // if ( ch == '{' ) + // If we're here, we've got a normal symbol, to be saved as text. // If there's currently no text node, open one