[squeak-dev] The Trunk: EToys-bp.312.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Nov 6 20:24:46 UTC 2017


Bernhard Pieber uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-bp.312.mcz

==================== Summary ====================

Name: EToys-bp.312
Author: bp
Time: 6 November 2017, 9:23:06.7401 pm
UUID: 21d58392-9e50-4ce3-b26c-42b0d465cddf
Ancestors: EToys-mt.311

Move method String>>#replaceHtmlCharRefs to the EToys package in order to break the inadvertently introduced dependency from Collections to EToys again

=============== Diff against EToys-mt.311 ===============

Item was added:
+ ----- Method: String>>replaceHtmlCharRefs (in category '*Etoys-internet') -----
+ replaceHtmlCharRefs
+ 
+         | pos ampIndex scIndex special specialValue outString outPos newOutPos |
+ 
+         outString := String new: self size.
+         outPos := 0.
+ 
+         pos := 1.
+         
+         [ pos <= self size ] whileTrue: [ 
+                 "read up to the next ampersand"
+                 ampIndex := self indexOf: $& startingAt: pos ifAbsent: [0].
+                 
+                 ampIndex = 0 ifTrue: [
+                         pos = 1 ifTrue: [ ^self ] ifFalse: [ ampIndex := self size+1 ] ].
+ 
+                 newOutPos := outPos + ampIndex - pos.
+                 outString
+                         replaceFrom: outPos + 1
+                         to: newOutPos
+                         with: self
+                         startingAt: pos.
+                 outPos := newOutPos.
+                 pos := ampIndex.
+ 
+                 ampIndex <= self size ifTrue: [
+                         "find the $;"
+                         scIndex := self indexOf: $; startingAt: ampIndex ifAbsent: [ self size + 1 ].
+ 
+                         special := self copyFrom: ampIndex+1 to: scIndex-1.       
+                         specialValue := HtmlEntity valueOfHtmlEntity: special. 
+ 
+                         specialValue
+                                 ifNil: [
+                                         "not a recognized entity.  wite it back"
+ 								  scIndex > self size ifTrue: [ scIndex := self size ].
+ 
+                                         newOutPos := outPos + scIndex - ampIndex + 1.
+                                         outString
+                                                 replaceFrom: outPos+1
+                                                 to: newOutPos
+                                                 with: self
+                                                 startingAt: ampIndex.
+                                         outPos := newOutPos.]
+                                 ifNotNil: [
+                                         outPos := outPos + 1.
+                                         outString at: outPos put: specialValue isoToSqueak.].
+                         
+                         pos := scIndex + 1. ]. ].
+ 
+ 
+         ^outString copyFrom: 1 to: outPos!



More information about the Squeak-dev mailing list