Skip to content

Commit

Permalink
Merge pull request #96 from SWTI2014/parsing/html-entities
Browse files Browse the repository at this point in the history
  • Loading branch information
rs22 committed Jun 10, 2014
2 parents 6de0053 + 4076024 commit b03550d
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
testing
test07HtmlEntitiesShouldBeParsedEverywhere
| document |
document := HtmlDocument new.
document parseContents:
(ReadStream on: '<title>Test &auml;, &ouml; and &uuml;</title>',
'<img src=''http:&#47;&#47;'' alt=''&#248; nothing''> </img>').
self assert: '<title>Test ä, ö and ü</title>' equals: document children first asString.
self assert: 'http://' equals: document children second src.
self assert: 'ø nothing' equals: document children second alt.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
"test03HtmlEntitiesShouldBeParsedCorrectly" : "SS 5/27/2014 22:08",
"test04DecimalHtmlEntitiesShouldBeParsedCorrectly" : "SS 5/27/2014 21:24",
"test05HexadecimalHtmlEntitiesShouldBeParsedCorrectly" : "SS 5/27/2014 22:09",
"test06NonHtmlEntitiesShouldBeReturned" : "SS 5/27/2014 22:09" } }
"test06NonHtmlEntitiesShouldBeReturned" : "SS 5/27/2014 22:09",
"test07HtmlEntitiesShouldBeParsedEverywhere" : "SS 6/5/2014 19:04" } }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
innerContents

^self rawContent asUnHtml
^self rawContent
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"asString" : "tb 1/3/2006 17:36",
"checkForUnescapedCharacters" : "tb 3/1/2006 15:36",
"initialize" : "j.c 6/6/2007 14:02",
"innerContents" : "SS 5/27/2014 20:35",
"innerContents" : "SS 6/5/2014 11:33",
"isCDATA" : "tb 12/2/2005 09:13",
"prefix" : "tb 12/8/2005 12:02",
"suffix" : "tb 12/8/2005 12:02",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ attributes: anObject
"Set the value of attributes"

| cstr |

attributes := anObject.

attributes := Dictionary new.
anObject keysAndValuesDo:
[ :eachKey :eachValue | attributes at: eachKey put: eachValue asUnHtml].
id := (attributes at: 'id' ifAbsent: [nil]).
cstr := attributes at: 'class' ifAbsent: [nil].
classes := cstr isNil ifTrue: [#()] ifFalse: [cstr findTokens: ' '].
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"addToHtmlMorph:" : "rs 5/28/2014 12:40:28.418",
"associatedForm" : "rs 5/29/2014 23:10:34.728",
"attributes" : "tb 11/30/2005 12:26",
"attributes:" : "tb 7/12/2007 11:04",
"attributes:" : "SS 6/7/2014 10:27",
"childDTDTags" : "tb 12/1/2005 09:11",
"childTags" : "tb 12/1/2005 09:12",
"classes" : "tb 1/4/2006 13:52",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
},
"instance" : {
"addToFormatter:" : "SN 5/25/2014 15:55",
"alt" : "pf 5/18/2014 13:54",
"alt" : "SS 6/5/2014 11:34",
"imageExtent" : "pf 5/18/2014 13:52",
"src" : "pf 5/18/2014 13:53",
"tag" : "" } }
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ rawContent

in := ReadStream on: self document content.
in position: self start.
^in next: (self end - self start)
^ (in next: (self end - self start)) asUnHtml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"parseContents:" : "tb 1/3/2006 17:15",
"prefix" : "tb 1/3/2006 16:47",
"prefixId" : "tb 1/3/2006 16:47",
"rawContent" : "tb 1/3/2006 16:47",
"rawContent" : "SS 6/5/2014 11:33",
"start" : "tb 1/3/2006 16:47",
"start:" : "sebastian.sastre 9/20/2010 11:52",
"startForNextElement" : "tb 1/3/2006 16:47",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
innerContents

^self rawContent
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
"class" : {
},
"instance" : {
"innerContents" : "SS 6/5/2014 11:33",
"tag" : "" } }
2 changes: 1 addition & 1 deletion packages/HTML.package/monticello.meta/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
395d3b09-0758-43c6-b996-b0bde1577d11
429e44ef-e21e-4f8a-9b16-0d1f975279c6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'HTML-SS.73'message 'Add test to check HTML entities are parsed everywhere correctly'id '265cd527-7860-4ed2-9ef0-84086c072947'date '5 June 2014'time '7:06:27.091 pm'author 'SS'ancestors ((id '395d3b09-0758-43c6-b996-b0bde1577d11'))stepChildren ())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'HTML-SS.74'message 'Run asUnHtml only once when attributes are set.'id '429e44ef-e21e-4f8a-9b16-0d1f975279c6'date '7 June 2014'time '10:29:46.122 am'author 'SS'ancestors ((id '265cd527-7860-4ed2-9ef0-84086c072947'))stepChildren ())
Expand Down

0 comments on commit b03550d

Please sign in to comment.