The Trunk: Collections-topa.733.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-topa.733.mcz

commits-2
Tobias Pape uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-topa.733.mcz

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

Name: Collections-topa.733
Author: topa
Time: 10 February 2017, 5:21:27.588874 pm
UUID: 98316bc6-4edd-4b8c-aae9-16d87505b8e9
Ancestors: Collections-topa.732

HtmlReadWriter: Support alignment, strike through

=============== Diff against Collections-topa.732 ===============

Item was added:
+ ----- Method: HtmlReadWriter>>mapAlignmentTag: (in category 'mapping') -----
+ mapAlignmentTag: aTag
+
+ | attributeStart |
+ " special html case ".
+ aTag = '<center>' ifTrue: [^ {TextAlignment centered}].
+
+ "<div align=justify> or <div align=""right"">"
+ attributeStart := aTag findString: 'align='.
+ attributeStart > 0 ifTrue: [
+ | attributeRest |
+ attributeRest := aTag copyAfter: $=.
+ attributeRest first = $" ifTrue: [attributeRest := attributeRest allButFirst].  " quoted case "
+ ^ self mapAlignmentValue: (attributeRest findTokens: ' ">') first].
+ ^ #()!

Item was added:
+ ----- Method: HtmlReadWriter>>mapAlignmentValue: (in category 'mapping') -----
+ mapAlignmentValue: aString
+
+ (aString = 'center' or: [aString = 'middle']) ifTrue: [^ {TextAlignment centered}].
+ aString = 'left' ifTrue: [^ {TextAlignment leftFlush}].
+ aString = 'right' ifTrue: [^ {TextAlignment rightFlush}].
+ aString = 'justify'  ifTrue: [^ {TextAlignment justified}].
+ ^ #()!

Item was changed:
  ----- Method: HtmlReadWriter>>mapTagToAttribute: (in category 'mapping') -----
  mapTagToAttribute: aTag
 
  aTag = '<b>' ifTrue: [^ {TextEmphasis bold}].
  aTag = '<i>' ifTrue: [^ {TextEmphasis italic}].
  aTag = '<u>' ifTrue: [^ {TextEmphasis underlined}].
+ aTag = '<s>' ifTrue: [^ {TextEmphasis struckOut}].
  aTag = '<code>' ifTrue: [^ self mapCodeTag].
  aTag = '<pre>' ifTrue: [self breakLines: false. ^ {}].
+ (aTag = '<center>' or: [aTag beginsWith: '<div'])
+ ifTrue: [^ self mapAlignmentTag: aTag].
  (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}].
 
  ^ {}!

Item was added:
+ ----- Method: TextAlignment>>closeHtmlOn: (in category 'html') -----
+ closeHtmlOn: aHtmlReadWriter
+
+ self alignment = Centered ifTrue: [aHtmlReadWriter nextPutAll: '</center>'].
+ ({ Justified. LeftFlush. RightFlush. } includes: self alignment)
+ ifTrue: [aHtmlReadWriter nextPutAll: '</div>'].
+ !

Item was added:
+ ----- Method: TextAlignment>>openHtmlOn: (in category 'html') -----
+ openHtmlOn: aHtmlReadWriter
+
+ self alignment = Centered ifTrue: [aHtmlReadWriter nextPutAll: '<center>'].
+ self alignment = Justified ifTrue: [aHtmlReadWriter nextPutAll: '<div align=justify>'].
+ self alignment = LeftFlush ifTrue: [aHtmlReadWriter nextPutAll: '<div align=left>'].
+ self alignment = RightFlush ifTrue: [aHtmlReadWriter nextPutAll: '<div align=right>'].
+ !

Item was changed:
  ----- Method: TextAlignment>>shouldFormBlocks (in category 'as yet unclassified') -----
  shouldFormBlocks
+
+ ^ true!
- " whether this attribute should form larger blocks even if split up for combination with other attributes "
- ^ false!

Item was changed:
  ----- Method: TextEmphasis>>closeHtmlOn: (in category 'html') -----
  closeHtmlOn: aStream
  "put on the given stream the tag to close the html  
  representation of the receiver"
  emphasisCode = 1
  ifTrue: [aStream nextPutAll: '</b>'].
  emphasisCode = 2
  ifTrue: [aStream nextPutAll: '</i>'].
  emphasisCode = 4
+ ifTrue: [aStream nextPutAll: '</u>'].
+ emphasisCode = 16
+ ifTrue: [aStream nextPutAll: '</s>'].!
- ifTrue: [aStream nextPutAll: '</u>']!

Item was changed:
  ----- Method: TextEmphasis>>openHtmlOn: (in category 'html') -----
  openHtmlOn: aStream
  "put on the given stream the tag to open the html  
  representation of the receiver"
  emphasisCode = 1
  ifTrue: [aStream nextPutAll: '<b>'].
  emphasisCode = 2
  ifTrue: [aStream nextPutAll: '<i>'].
  emphasisCode = 4
+ ifTrue: [aStream nextPutAll: '<u>'].
+ emphasisCode = 16
+ ifTrue: [aStream nextPutAll: '<s>']!
- ifTrue: [aStream nextPutAll: '<u>']!