<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -259,6 +259,21 @@ test_when_getting_the_block_names_from_some_markup_that_contains_a_two_named_blo
 	assert: [(names at: 2) = 'again' ].
 )
 
+test_when_getting_the_start_and_end_index_for_a_block_from_some_markup_it_should_return_the_valid_start_and_end_position_in_that_markup = (
+	| view markup indices expectedStart expectedEnd blockInnerText |
+	view:: ValueView platform: p parent: nil.
+	blockInnerText:: '?foo!'.
+	markup:: '&lt;% block test %&gt;', blockInnerText, '&lt;% endblock %&gt;'.
+
+	expectedStart:: markup indexOf: $?.
+	expectedEnd:: markup indexOf: $!.
+	indices:: view getIndicesForBlockNamed: 'test' from: markup.
+
+	should: [indices size = 2].
+	should: [(indices at: 1) = expectedStart].
+	should: [(indices at: 2) = expectedEnd].
+)
+
 test_when_merging_two_sets_of_markup_and_the_child_markup_specifies_a_block_that_is_defined_in_the_parent_markup_it_should_override_the_parents_block_in_the_merged_markup = (
 	| childMarkup parentMarkup finalMarkup |
 	assert: [true = false].</diff>
      <filename>SaberTests.ns2</filename>
    </modified>
    <modified>
      <diff>@@ -49,7 +49,9 @@ defineRawMarkup: block = (
 )
 
 getBlockFrom: markup named: blockName = (
-	^ ''
+	| indices |
+	indices:: getIndicesForBlockNamed: blockName from: markup.
+	^ markup copyFrom: (indices at: 1) to: (indices at: 2).
 )
 
 getCharactersInStream: stream upTo: char = (
@@ -68,6 +70,13 @@ getGetModelValueKeyFrom: aStream = (
 	^ getCharactersInStream: aStream upTo: $}.
 )
 
+getIndicesForBlockNamed: blockName from: markup = (
+	| start end |
+	start:: 0.
+	end:: 0.
+	^ { start. end. }
+)
+
 integrate: childMarkup model: aModel = (
 	| finalMarkup integratedMarkup thisMarkup |
 	thisMarkup:: resolveMarkup: content withModel: aModel.
@@ -79,22 +88,31 @@ integrate: childMarkup model: aModel = (
 	^ finalMarkup
 )
 
-lookForBlockNameIn: text toAddTo: names = (
+lookForBlockNameIn: text = (
 	| blockName blockOpener blockClose |
 	blockName:: nil.
 	blockOpener:: (text asLowercase findString: 'block ' startingAt: 1) = 1.
 	blockOpener ifTrue: [blockName:: text copyFrom: 7 to: text size]
-		ifFalse: [(text asLowercase findString: 'endblock' startingAt: 1) = 1
+		ifFalse: [(textIsEndBlock: text)
 					ifFalse: [(Error new messageText: 'invalid block: &quot;',text,'&quot;') signal]].
+	^ blockName.
+)
+
+lookForBlockNameIn: text toAddTo: names = (
+	| blockName |
+	blockName:: lookForBlockNameIn: text.
 	blockName = nil ifFalse: [names add: blockName]
 )
 
 merge: childMarkup into: parentMarkup = (
-	| finalMarkup blockTexts childBlock|
+	| finalMarkup blockTexts childBlock childBlockNames |
+	childBlockNames:: blockNamesFrom: childMarkup.
 	finalMarkup:: parentMarkup.
 	(blockNamesFrom: parentMarkup) do: [ :blockName |
-		childBlock:: getBlockFrom: childMarkup named: blockName.
-		finalMarkup:: childBlock = nil ifFalse: [ replaceBlocksNamed: blockName in: finalMarkup with: childBlock].
+		(childBlockNames contains: [ :i | i = blockName ]) ifTrue: [
+			childBlock:: getBlockFrom: childMarkup named: blockName.
+			finalMarkup:: childBlock = nil ifFalse: [ replaceBlocksNamed: blockName in: finalMarkup with: childBlock].
+		]
 	].
 	^ finalMarkup.
 )
@@ -151,4 +169,8 @@ resolveMarkup: rawMarkup withModel: aModel = (
 	^ result contents
 )
 
+textIsEndBlock: text = (
+	^ (text asLowercase findString: 'endblock' startingAt: 1) = 1.
+)
+
 )
\ No newline at end of file</diff>
      <filename>SaberView.ns2</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6461e6dbc049de1feb4ed11845d709c3c9c3d30e</id>
    </parent>
  </parents>
  <author>
    <name>Jeffery Olson</name>
    <email>olson.jeffery@gmail.com</email>
  </author>
  <url>http://github.com/olsonjeffery/Saber/commit/0264c125a8d4e6a0caaca4362e948a62fdc4aa0d</url>
  <id>0264c125a8d4e6a0caaca4362e948a62fdc4aa0d</id>
  <committed-date>2009-11-04T10:39:15-08:00</committed-date>
  <authored-date>2009-11-04T10:39:15-08:00</authored-date>
  <message>some specs/stubbing towards getting a block's inner text from some markup</message>
  <tree>121db4ec882ab34f22e6f33a3c7f4e5eb8529ce8</tree>
  <committer>
    <name>Jeffery Olson</name>
    <email>olson.jeffery@gmail.com</email>
  </committer>
</commit>
