[squeak-dev] The Inbox: Collections-ct.944.mcz

commits at source.squeak.org commits at source.squeak.org
Thu May 6 17:19:25 UTC 2021

A new version of Collections was added to project The Inbox:

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

Name: Collections-ct.944
Author: ct
Time: 6 May 2021, 7:19:19.626252 pm
UUID: ff2ccbdf-62a6-9040-ba1a-5c7ae932a1c9
Ancestors: Collections-mt.943

Fixes a slip in HtmlReadWriter when encountering an empty CSS value.

Note that according to W3C, empty CSS values are not permitted, but let's not make our converter fail for such a trivial reason, in particular since I met such a tag in the wild. Also, the check already exists anyway. :-)

=============== Diff against Collections-mt.943 ===============

Item was changed:
  ----- Method: HtmlReadWriter>>mapContainerTag: (in category 'mapping') -----
  mapContainerTag: aTag
  	| result styleStart styleEnd styleAttributes |
  	result := OrderedCollection new.
  	styleStart := (aTag findString: 'style="' ) + 7.
  	styleStart <= 7 ifTrue: [^#()].
  	styleEnd := (aTag findString: '"' startingAt: styleStart) - 1.
  	styleAttributes := (aTag copyFrom: styleStart to: styleEnd) subStrings: ';'.
  	styleAttributes do: [:ea | |keyValue key value|
  		keyValue := (ea subStrings: ':') collect: [:s | s withBlanksTrimmed].
  		key := keyValue first asLowercase.
- 		value := keyValue second.
  		keyValue size = 2 ifTrue: [
+ 			value := keyValue second.
  			key = 'color' ifTrue: [result add: (TextColor color: (Color fromString: value))].
  			(key beginsWith: 'font') ifTrue: [
  				(value includesSubstring: 'bold')
  					ifTrue: [result add: TextEmphasis bold].
  				(value includesSubstring: 'italic')
  					ifTrue: [result add: TextEmphasis italic]]]].
  	^ result!

More information about the Squeak-dev mailing list