-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from SWTI2014/rendering/css-text-attribute
Rendering/css text attribute
- Loading branch information
Showing
31 changed files
with
175 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/HTML.package/CSSStyleResolver.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
10 changes: 10 additions & 0 deletions
10
packages/HTML.package/CSSTextFormatter.class/instance/attributeMap.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
accessing | ||
attributeMap | ||
|
||
^ attributeMap ifNil: | ||
[ Dictionary newFrom: { | ||
'text-decoration' -> [ :prop :fontAttribs | | ||
self readTextDecorationAttribute: prop propertyString to: fontAttribs ]. | ||
'text-align' -> [ :prop :fontAttribs | | ||
self readTextAlignAttribute: prop propertyString to: fontAttribs ] | ||
}] |
4 changes: 4 additions & 0 deletions
4
packages/HTML.package/CSSTextFormatter.class/instance/parseTextAttributesFrom.into..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
parsing | ||
parseTextAttributesFrom: aCSSProperty into: aContext | ||
(self attributeMap at: aCSSProperty propertyName ifAbsent: [nil]) | ||
ifNotNilDo: [:process | process value: aCSSProperty value: aContext ] |
7 changes: 7 additions & 0 deletions
7
packages/HTML.package/CSSTextFormatter.class/instance/readTextAlignAttribute.to..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
parsing | ||
readTextAlignAttribute: aString to: aContext | ||
aString splitBy: ' ' do: [:attribute | | ||
(attribute = 'center') ifTrue: [aContext at: #align put: #centered]. | ||
((attribute = 'left') or: [attribute = 'start']) ifTrue: [aContext at: #align put: #leftFlush]. | ||
((attribute = 'right') or: [attribute = 'end']) ifTrue: [aContext at: #align put: #rightFlush]. | ||
(attribute = 'justify') ifTrue: [aContext at: #align put: #justified].] |
5 changes: 5 additions & 0 deletions
5
packages/HTML.package/CSSTextFormatter.class/instance/readTextDecorationAttribute.to..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
parsing | ||
readTextDecorationAttribute: aString to: aContext | ||
aString splitBy: ' ' do: [:attribute | | ||
(attribute = 'underline') ifTrue: [aContext at: #underlined put: true]. | ||
(attribute = 'line-through') ifTrue: [aContext at: #struckOut put: true]] |
8 changes: 8 additions & 0 deletions
8
packages/HTML.package/CSSTextFormatter.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"attributeMap" : "SN 7/5/2014 12:30", | ||
"parseTextAttributesFrom:into:" : "SN 7/5/2014 12:12", | ||
"readTextAlignAttribute:to:" : "SN 7/5/2014 12:20", | ||
"readTextDecorationAttribute:to:" : "SN 7/5/2014 11:57" } } |
14 changes: 14 additions & 0 deletions
14
packages/HTML.package/CSSTextFormatter.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"category" : "HTML-Formatter", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
"attributeMap" ], | ||
"name" : "CSSTextFormatter", | ||
"pools" : [ | ||
], | ||
"super" : "CSSFormatter", | ||
"type" : "normal" } |
Empty file.
3 changes: 3 additions & 0 deletions
3
packages/HTML.package/CSSTextFormatterTest.class/instance/setUp.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
running | ||
setUp | ||
self textFormatter: CSSTextFormatter new |
10 changes: 10 additions & 0 deletions
10
...TextFormatterTest.class/instance/test01TextDecorationUnderlinedShouldBeParsedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
test01TextDecorationUnderlinedShouldBeParsedCorrectly | ||
| prop result | | ||
result := Dictionary new. | ||
prop := CSSProperty new | ||
propertyName: 'text-decoration'; | ||
propertyString: 'underline'; | ||
yourself. | ||
self textFormatter parseTextAttributesFrom: prop into: result. | ||
self assert: true equals: (result at: #underlined) |
10 changes: 10 additions & 0 deletions
10
...extFormatterTest.class/instance/test02TextDecorationLineThroughShouldBeParsedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
test02TextDecorationLineThroughShouldBeParsedCorrectly | ||
| prop result | | ||
result := Dictionary new. | ||
prop := CSSProperty new | ||
propertyName: 'text-decoration'; | ||
propertyString: 'line-through'; | ||
yourself. | ||
self textFormatter parseTextAttributesFrom: prop into: result. | ||
self assert: true equals: (result at: #struckOut) |
11 changes: 11 additions & 0 deletions
11
...erTest.class/instance/test03TextDecorationUnderlinedLineThroughShouldBeParsedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
testing | ||
test03TextDecorationUnderlinedLineThroughShouldBeParsedCorrectly | ||
| prop result | | ||
result := Dictionary new. | ||
prop := CSSProperty new | ||
propertyName: 'text-decoration'; | ||
propertyString: 'underline line-through'; | ||
yourself. | ||
self textFormatter parseTextAttributesFrom: prop into: result. | ||
self assert: true equals: (result at: #underlined). | ||
self assert: true equals: (result at: #struckOut) |
11 changes: 11 additions & 0 deletions
11
...ckage/CSSTextFormatterTest.class/instance/test04TextAlignCenterShouldBeParsedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
testing | ||
test04TextAlignCenterShouldBeParsedCorrectly | ||
| prop result | | ||
result := Dictionary new. | ||
prop := CSSProperty new | ||
propertyName: 'text-align'; | ||
propertyString: 'center'; | ||
yourself. | ||
self textFormatter parseTextAttributesFrom: prop into: result. | ||
self assert: #centered equals: (result at: #align). | ||
self assert: (TextAlignment respondsTo: #centered) |
11 changes: 11 additions & 0 deletions
11
...package/CSSTextFormatterTest.class/instance/test05TextAlignLeftShouldBeParsedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
testing | ||
test05TextAlignLeftShouldBeParsedCorrectly | ||
| prop result | | ||
result := Dictionary new. | ||
prop := CSSProperty new | ||
propertyName: 'text-align'; | ||
propertyString: 'left'; | ||
yourself. | ||
self textFormatter parseTextAttributesFrom: prop into: result. | ||
self assert: #leftFlush equals: (result at: #align). | ||
self assert: (TextAlignment respondsTo: #leftFlush) |
11 changes: 11 additions & 0 deletions
11
...ackage/CSSTextFormatterTest.class/instance/test06TextAlignRightShouldBeParsedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
testing | ||
test06TextAlignRightShouldBeParsedCorrectly | ||
| prop result | | ||
result := Dictionary new. | ||
prop := CSSProperty new | ||
propertyName: 'text-align'; | ||
propertyString: 'right'; | ||
yourself. | ||
self textFormatter parseTextAttributesFrom: prop into: result. | ||
self assert: #rightFlush equals: (result at: #align). | ||
self assert: (TextAlignment respondsTo: #rightFlush) |
11 changes: 11 additions & 0 deletions
11
...kage/CSSTextFormatterTest.class/instance/test07TextAlignJustifyShouldBeParsedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
testing | ||
test07TextAlignJustifyShouldBeParsedCorrectly | ||
| prop result | | ||
result := Dictionary new. | ||
prop := CSSProperty new | ||
propertyName: 'text-align'; | ||
propertyString: 'justify'; | ||
yourself. | ||
self textFormatter parseTextAttributesFrom: prop into: result. | ||
self assert: #justified equals: (result at: #align). | ||
self assert: (TextAlignment respondsTo: #justified) |
4 changes: 4 additions & 0 deletions
4
packages/HTML.package/CSSTextFormatterTest.class/instance/textFormatter..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
textFormatter: anObject | ||
|
||
textFormatter := anObject |
4 changes: 4 additions & 0 deletions
4
packages/HTML.package/CSSTextFormatterTest.class/instance/textFormatter.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
textFormatter | ||
|
||
^ textFormatter |
14 changes: 14 additions & 0 deletions
14
packages/HTML.package/CSSTextFormatterTest.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"setUp" : "SN 7/5/2014 12:04", | ||
"test01TextDecorationUnderlinedShouldBeParsedCorrectly" : "SN 7/5/2014 12:06", | ||
"test02TextDecorationLineThroughShouldBeParsedCorrectly" : "SN 7/5/2014 12:05", | ||
"test03TextDecorationUnderlinedLineThroughShouldBeParsedCorrectly" : "SN 7/5/2014 12:06", | ||
"test04TextAlignCenterShouldBeParsedCorrectly" : "SN 7/5/2014 12:28", | ||
"test05TextAlignLeftShouldBeParsedCorrectly" : "SN 7/5/2014 12:28", | ||
"test06TextAlignRightShouldBeParsedCorrectly" : "SN 7/5/2014 12:28", | ||
"test07TextAlignJustifyShouldBeParsedCorrectly" : "SN 7/5/2014 12:29", | ||
"textFormatter" : "SN 7/5/2014 12:03", | ||
"textFormatter:" : "SN 7/5/2014 12:03" } } |
14 changes: 14 additions & 0 deletions
14
packages/HTML.package/CSSTextFormatterTest.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"category" : "HTML-CSS-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
"textFormatter" ], | ||
"name" : "CSSTextFormatterTest", | ||
"pools" : [ | ||
], | ||
"super" : "TestCase", | ||
"type" : "normal" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
6e188467-d07d-4e49-be20-fa225e8f7845 | ||
ab6c8e1b-655f-184d-b480-fa6e02b7296a |
1 change: 1 addition & 0 deletions
1
...s/HTML.package/monticello.meta/version.d/HTML-SN.114_ab6c8e1b-655f-184d-b480-fa6e02b7296a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...s/HTML.package/monticello.meta/version.d/HTML-rs.113_b49e40ea-38e5-3241-9e1a-5d692da8925f
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...s/HTML.package/monticello.meta/version.d/HTML-rs.114_d8a3e21d-3ec3-0944-bc0b-bbb4351006a8
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...s/HTML.package/monticello.meta/version.d/HTML-rs.115_c886c165-d5f3-6e4b-a787-a61dfb704d95
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...s/HTML.package/monticello.meta/version.d/HTML-rs.116_9a45a462-f02e-314e-9f9c-602b1c738d0d
This file was deleted.
Oops, something went wrong.