Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
HtmlReadWriter
Last updated at 1:55 pm UTC on 9 September 2016
Newly added class in Squeak 5.1

Maps Text to HTML.

The method #mapTagToAttribut: describes the mapping.

 mapTagToAttribute: aTag

	aTag = '<b>' ifTrue: [^ {TextEmphasis bold}].
        aTag = '<i>' ifTrue: [^ {TextEmphasis italic}].
	aTag = '<u>' ifTrue: [^ {TextEmphasis underlined}].
	(aTag beginsWith: '<font') ifTrue: [^ self mapFontTag: aTag].
	(aTag beginsWith: '<a') ifTrue: [^ self mapATag: aTag].

	"h1, h2, h3, ..."
	(aTag second = $h and: [aTag third isDigit])
		ifTrue: [^ {TextEmphasis bold}].

	^ {}


HtmlReadWriterTest gives examples.

See also Convert HTML to Text