links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 8:25 pm UTC on 9 September 2017
HTML generation (file out from Pharo 6 attached to this page; file in into Squeak)

I am ZnHtmlOutputStream. I wrap another character write stream to offer a richer API for generating correct HTML markup.

See https://en.wikipedia.org/wiki/HTML

My streaming protocol contains the traditional write stream operations. These are raw and do not do any conversions/escaping.

My html protocols contains a rich API for generating correct HTML.

String streamContents: [ :out | | html |
	html := ZnHtmlOutputStream on: out.
	html html5.
	html tag: #html do: [ 
		html tag: #body do: [
			html tag: #div class: #main do: [
				html tag: #p with: 'Hello World & Universe !'.
				html tag: #hr.
					tag: #em 
					attributes: #(class big id 1 disable nil) 
					with: 'The END' ] ] ] ].

ZnHtmlOutputStream streamContents: [ :html |
	html page: 'Hello World' do: [ 
		html tag: #div class: #main do: [
			html tag: #p with: 'Hello World & Universe !' ] ] ]

Part of Zinc HTTP Components.

Protocol 'html tags'

 ZnHtmlOutputStream selectors select: [:sel | sel beginsWith: 'tag']