Skip to content

Commit

Permalink
Fixed a bug when using multi-block syntaxes with another delimiter th…
Browse files Browse the repository at this point in the history
…an braces.
  • Loading branch information
blambeau committed Jan 17, 2011
1 parent 4c25484 commit cbdf3f2
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 32 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Version 0.11.0
# Version 0.10.1

* ...
# Bug fixes

* Fixed a bug when using multi-block syntaxes with another delimiter than braces.

# Version 0.10.0

Expand Down
2 changes: 1 addition & 1 deletion doc/specification/dialects.wtpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*{WLang::dialect_tree.dialect('wlang').dialects using each_pair as name, dialect}{
*{WLang::dialect_tree.dialect('wlang').dialects using each_value as dialect}{
<<+{dialect.wtpl with dialect: dialect.build!}
}
56 changes: 28 additions & 28 deletions doc/specification/specification.html
Original file line number Diff line number Diff line change
Expand Up @@ -1203,9 +1203,7 @@ <h2>Dialects</h2>

<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/active-text</h3>

<p style="display: inline">Includes Basic, Imperative, Buffering, Context</p>
<h3 style="display: inline">wlang/dummy</h3>

</div>

Expand All @@ -1215,9 +1213,9 @@ <h3 style="display: inline">wlang/active-text</h3>

<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/uri</h3>
<h3 style="display: inline">wlang/hosted</h3>

<p style="display: inline">Includes Basic</p>
<p style="display: inline">Includes Basic, Encoding, Imperative, Context, Hosted</p>

</div>

Expand All @@ -1227,35 +1225,33 @@ <h3 style="display: inline">wlang/uri</h3>

<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/sql</h3>
<h3 style="display: inline">wlang/active-string</h3>

<p style="display: inline">Includes Basic, Encoding, Imperative, SQL</p>
<p style="display: inline">Includes Basic, Imperative</p>

</div>



<div class="dialect">
</div>


<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/sql/sybase</h3>
<h3 style="display: inline">wlang/active-text</h3>

<p style="display: inline">Includes Basic, Encoding, Imperative, SQL</p>
<p style="display: inline">Includes Basic, Imperative, Buffering, Context</p>

</div>


</div>



</div>


<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/active-string</h3>
<h3 style="display: inline">wlang/uri</h3>

<p style="display: inline">Includes Basic, Imperative</p>
<p style="display: inline">Includes Basic</p>

</div>

Expand All @@ -1265,9 +1261,9 @@ <h3 style="display: inline">wlang/active-string</h3>

<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/xhtml</h3>
<h3 style="display: inline">wlang/ruby</h3>

<p style="display: inline">Includes Basic, Encoding, Imperative, Buffering, Context, XHtml</p>
<p style="display: inline">Includes Basic, Encoding, Imperative, Buffering, Context, Ruby</p>

</div>

Expand All @@ -1289,9 +1285,9 @@ <h3 style="display: inline">wlang/yaml</h3>

<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/ruby</h3>
<h3 style="display: inline">wlang/xhtml</h3>

<p style="display: inline">Includes Basic, Encoding, Imperative, Buffering, Context, Ruby</p>
<p style="display: inline">Includes Basic, Encoding, Imperative, Buffering, Context, XHtml</p>

</div>

Expand All @@ -1301,23 +1297,27 @@ <h3 style="display: inline">wlang/ruby</h3>

<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/dummy</h3>
<h3 style="display: inline">wlang/sql</h3>

<p style="display: inline">Includes Basic, Encoding, Imperative, SQL</p>

</div>


</div>


<div class="dialect">

<div class="dialect">
<div style="margin-bottom: 20px">
<h3 style="display: inline">wlang/hosted</h3>
<h3 style="display: inline">wlang/sql/sybase</h3>

<p style="display: inline">Includes Basic, Encoding, Imperative, Context, Hosted</p>
<p style="display: inline">Includes Basic, Encoding, Imperative, SQL</p>

</div>


</div>



</div>


Expand Down
2 changes: 1 addition & 1 deletion lib/wlang/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def parse(offset, dialect=nil, buffer=nil)
# parsing on a '}')
#
def has_block?(offset)
self.source_text[offset,2]=='}{'
self.source_text[offset,2] == template.block_endstart
end

#
Expand Down
5 changes: 5 additions & 0 deletions lib/wlang/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def source_text
@source.to_s
end
end

# Returns template's block endstart (typically '}{')
def block_endstart
@block_endstart ||= BLOCK_SYMBOLS[block_symbols].reverse.join
end

# Instantiates the template, with optinal context and hosted language.
def instantiate(context = {}, hosted = ::WLang::HostedLanguage.new)
Expand Down

0 comments on commit cbdf3f2

Please sign in to comment.