A new version of Collections was added to project The Inbox: http://source.squeak.org/inbox/Collections-ct.949.mcz
==================== Summary ====================
Name: Collections-ct.949 Author: ct Time: 30 June 2021, 12:40:15.630133 am UUID: af0bb5dc-fd59-5c46-805b-f923e93cdaf2 Ancestors: Collections-mt.945
Adds basic support for data URIs to HtmlReadWriter.
Usage:
'Hello <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAMFBMVEUAAACAAAAAgACAgAAAAICAAIAAgICAgIC/v7//AAAA/wD//wAAAP//AP8A//////94imqWAAAAEHRSTlP/////////////////////zSGylAAAAChJREFUeF5j+P///3+G/7t3/2f4zb1hP8Pv3bv3Q1kbuPdDJIAq/gMA/8wZcBN9r58AAAAASUVORK5CYII=" />' asTextFromHtml edit
=============== Diff against Collections-mt.945 ===============
Item was changed: ----- Method: HtmlReadWriter>>httpGetImage: (in category 'private') ----- httpGetImage: url "To not add a direct dependency to WebClient, provide this hook for getting am image from an HTTP url. Maybe we can have this via an AppRegistry at some point. Maybe extend WebBrowser." + - (url beginsWith: 'code://') ifTrue: [ "Same support for Smalltalk expressions as in TextURL >> #actOnClickFor:." ^ ([Compiler evaluate: (url allButFirst: 7)] ifError: [nil]) ifNotNil: [:object | object isForm ifTrue: [object] ifFalse: [nil]]]. + (url beginsWith: 'data:') ifTrue: [ | data mediaType separator | + separator := url indexOf: $, ifAbsent: [^ nil]. + mediaType := url copyFrom: 6 to: separator - 1. + data := url allButFirst: separator. + data := (mediaType endsWith: ';base64') + ifTrue: [ + mediaType := mediaType allButLast: 7. + [Base64MimeConverter mimeDecodeToBytes: data readStream] ifError: [nil]] + ifFalse: [data asByteArray readStream]. + ^ [ImageReadWriter formFromStream: data] ifError: [nil]]. + ^ (Smalltalk classNamed: 'WebClient') ifNotNil: [:client | ([client httpGet: url] ifError: [nil]) ifNotNil: [:response | response code = 200 ifFalse: [nil] ifTrue: [ [Form fromBinaryStream: response content asByteArray readStream] ifError: [nil]]]]!
Hi,
would any one object me to merge this? :-)
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2021-06-29T22:40:20+00:00, commits@source.squeak.org wrote:
A new version of Collections was added to project The Inbox: http://source.squeak.org/inbox/Collections-ct.949.mcz
==================== Summary ====================
Name: Collections-ct.949 Author: ct Time: 30 June 2021, 12:40:15.630133 am UUID: af0bb5dc-fd59-5c46-805b-f923e93cdaf2 Ancestors: Collections-mt.945
Adds basic support for data URIs to HtmlReadWriter.
Usage:
'Hello <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAMFBMVEUAAACAAAAAgACAgAAAAICAAIAAgICAgIC/v7//AAAA/wD//wAAAP//AP8A//////94imqWAAAAEHRSTlP/////////////////////zSGylAAAAChJREFUeF5j+P///3+G/7t3/2f4zb1hP8Pv3bv3Q1kbuPdDJIAq/gMA/8wZcBN9r58AAAAASUVORK5CYII=" />' asTextFromHtml edit
=============== Diff against Collections-mt.945 ===============
Item was changed: ----- Method: HtmlReadWriter>>httpGetImage: (in category 'private') ----- httpGetImage: url "To not add a direct dependency to WebClient, provide this hook for getting am image from an HTTP url. Maybe we can have this via an AppRegistry at some point. Maybe extend WebBrowser."
- (url beginsWith: 'code://') ifTrue: [ "Same support for Smalltalk expressions as in TextURL >> #actOnClickFor:." ^ ([Compiler evaluate: (url allButFirst: 7)] ifError: [nil]) ifNotNil: [:object | object isForm ifTrue: [object] ifFalse: [nil]]].
- (url beginsWith: 'data:') ifTrue: [ | data mediaType separator |
- separator := url indexOf: $, ifAbsent: [^ nil].
- mediaType := url copyFrom: 6 to: separator - 1.
- data := url allButFirst: separator.
- data := (mediaType endsWith: ';base64')
- ifTrue: [
- mediaType := mediaType allButLast: 7.
- [Base64MimeConverter mimeDecodeToBytes: data readStream] ifError: [nil]]
- ifFalse: [data asByteArray readStream].
- ^ [ImageReadWriter formFromStream: data] ifError: [nil]].
- ^ (Smalltalk classNamed: 'WebClient') ifNotNil: [:client | ([client httpGet: url] ifError: [nil]) ifNotNil: [:response | response code = 200 ifFalse: [nil] ifTrue: [ [Form fromBinaryStream: response content asByteArray readStream] ifError: [nil]]]]!
+1 Am 07.04.2022 19:51:19 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Hi,
would any one object me to merge this? :-)
Best, Christoph
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2021-06-29T22:40:20+00:00, commits@source.squeak.org wrote:
A new version of Collections was added to project The Inbox: http://source.squeak.org/inbox/Collections-ct.949.mcz
==================== Summary ====================
Name: Collections-ct.949 Author: ct Time: 30 June 2021, 12:40:15.630133 am UUID: af0bb5dc-fd59-5c46-805b-f923e93cdaf2 Ancestors: Collections-mt.945
Adds basic support for data URIs to HtmlReadWriter.
Usage:
'Hello <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAMFBMVEUAAACAAAAAgACAgAAAAICAAIAAgICAgIC/v7//AAAA/wD//wAAAP//AP8A//////94imqWAAAAEHRSTlP/////////////////////zSGylAAAAChJREFUeF5j+P///3+G/7t3/2f4zb1hP8Pv3bv3Q1kbuPdDJIAq/gMA/8wZcBN9r58AAAAASUVORK5CYII=" />' asTextFromHtml edit
=============== Diff against Collections-mt.945 ===============
Item was changed: ----- Method: HtmlReadWriter>>httpGetImage: (in category 'private') ----- httpGetImage: url "To not add a direct dependency to WebClient, provide this hook for getting am image from an HTTP url. Maybe we can have this via an AppRegistry at some point. Maybe extend WebBrowser."
(url beginsWith: 'code://') ifTrue: [ "Same support for Smalltalk expressions as in TextURL >> #actOnClickFor:." ^ ([Compiler evaluate: (url allButFirst: 7)] ifError: [nil]) ifNotNil: [:object | object isForm ifTrue: [object] ifFalse: [nil]]].
- (url beginsWith: 'data:') ifTrue: [ | data mediaType separator |
- separator := url indexOf: $, ifAbsent: [^ nil].
- mediaType := url copyFrom: 6 to: separator - 1.
- data := url allButFirst: separator.
- data := (mediaType endsWith: ';base64')
- ifTrue: [
- mediaType := mediaType allButLast: 7.
- [Base64MimeConverter mimeDecodeToBytes: data readStream] ifError: [nil]]
- ifFalse: [data asByteArray readStream].
- ^ [ImageReadWriter formFromStream: data] ifError: [nil]].
^ (Smalltalk classNamed: 'WebClient') ifNotNil: [:client | ([client httpGet: url] ifError: [nil]) ifNotNil: [:response | response code = 200 ifFalse: [nil] ifTrue: [ [Form fromBinaryStream: response content asByteArray readStream] ifError: [nil]]]]!
squeak-dev@lists.squeakfoundation.org