'From Squeak5.1 of 23 August 2016 [latest update: #16548] on 30 August 2016 at 1:07:21 pm'! !FileList methodsFor: 'own services' stamp: 'sumim 11/22/2015 12:19'! viewContentsInWorkspace "View the contents of my selected file in a new workspace" | aStringOrText aName | directory readOnlyFileNamed: self fullName do: [:file | file setConverterForCode. aStringOrText := (file localName endsWith: '.html') ifFalse: [ file contentsOfEntireFile ] ifTrue: [ (HtmlReadWriter on: file) nextText ]. aName := file localName. ]. UIManager default edit: aStringOrText withSqueakLineEndings label: 'Workspace from ', aName! ! !HtmlReadWriter methodsFor: 'mapping' stamp: 'sumim 8/30/2016 13:05'! mapFontTag: aTag | result colorStartIndex colorStopIndex attribute | result := OrderedCollection new. " or " attribute := 'color'. colorStartIndex := aTag findString: attribute. colorStartIndex > 0 ifTrue: [ colorStartIndex := aTag findString: '"' startingAt: colorStartIndex+attribute size. colorStopIndex := aTag findString: '"' startingAt: colorStartIndex+1. result add: (TextColor color: (Color fromString: (aTag copyFrom: colorStartIndex+1 to: colorStopIndex-1)))]. attribute := 'size'. colorStartIndex := aTag findString: attribute. colorStartIndex > 0 ifTrue: [ | size index | colorStartIndex := aTag findString: '"' startingAt: colorStartIndex+attribute size. colorStopIndex := aTag findString: '"' startingAt: colorStartIndex+1. size := [(aTag copyFrom: colorStartIndex+1 to: colorStopIndex-1) asNumber] ifError: [0]. index := TextStyle default fontArray findFirst: [:font | font htmlSize = size]. index ~= 0 ifTrue: [result add: (TextFontChange fontNumber: index)]]. ^ result! ! !HtmlReadWriter methodsFor: 'mapping' stamp: 'sumim 11/24/2015 17:18'! mapTagToAttribute: aTag aTag = '' ifTrue: [^ {TextEmphasis bold}]. aTag = '' ifTrue: [^ {TextEmphasis italic}]. aTag = '' ifTrue: [^ {TextEmphasis underlined}]. aTag = '' ifTrue: [^ {TextEmphasis struckOut}]. "aTag = '' ifTrue: [^ {TextFontReference toFont: Preferences standardCodeFont}]." (aTag beginsWith: '']. emphasisCode = 2 ifTrue: [aStream nextPutAll: '']. emphasisCode = 4 ifTrue: [aStream nextPutAll: '']. emphasisCode = 16 ifTrue: [aStream nextPutAll: '']! ! !TextEmphasis methodsFor: 'html' stamp: 'sumim 11/24/2015 17:06'! openHtmlOn: aStream "put on the given stream the tag to open the html representation of the receiver" emphasisCode = 1 ifTrue: [aStream nextPutAll: '']. emphasisCode = 2 ifTrue: [aStream nextPutAll: '']. emphasisCode = 4 ifTrue: [aStream nextPutAll: '']. emphasisCode = 16 ifTrue: [aStream nextPutAll: '']! !