Hi all,
I have attached two changesets for SmallWiki1 in Squeak:
*HierarchyMenu* outputs a menu like the one on our site, for example
http://www.squeak-ev.de/Dokumentation/Glossar/Malkasten/
*Umlaut* just adds one line to SWHtmlWriteStream.text:
text: aString
| table escape |
table := self escapeTable.
aString do: [ :character |
">>> following line added"
character _ character isoToSqueak.
escape := table at: character ifAbsent: [ nil ].
escape isNil
ifTrue: [ self nextPut: character]
ifFalse: [ self nextPutAll: escape] ]
If I am not completely wrong, this line is essential to anyone, who
wants to properly handle characters > 127, unless he runs his image on a
MacOs-Server...
Regards
Andreas
'From Squeak3.6 of ''6 October 2003'' [latest update: #5429] on 20
December 2004 at 3:18:33 pm'!
"Change Set: SmallWikiUmlaut
Date: 20 December 2004
Author: Andreas Gerdes
Adds one line to properly handle characters whose ascii value > 127."!
!SWHtmlWriteStream methodsFor: 'html-primitive' stamp: 'ag 10/22/2004
15:49'!
text: aString
| table escape |
table := self escapeTable.
aString do: [ :character |
character _ character isoToSqueak.
escape := table at: character ifAbsent: [ nil ].
escape isNil
ifTrue: [ self nextPut: character]
ifFalse: [ self nextPutAll: escape] ]
! !
'From Squeak3.6 of ''6 October 2003'' [latest update: #5429] on 20
December 2004 at 3:11:18 pm'!
"Change Set: SmallWikiHierarchyMenu
Date: 20 December 2004
Author: Andreas Gerdes
Adds a Hierarchical Menu to the templates of SmallWiki. In your CSS you should define an
ID named #hierarchymenu and two selectors named .current and .norm"!
SWTemplateBody subclass: #SWHierarchyMenu
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'SmallWiki-Templates-Menu'!
!SWHierarchyMenu commentStamp: 'skag 12/20/2004 13:59' prior: 0!
Hierarchical Menu showing the tree of a selected node.
In css it can be formatted via #hierarchymenu !
!SWHierarchyMenu methodsFor: 'as yet unclassified' stamp: 'skag 12/20/2004
14:57'!
buildUlForChild: aChild ofParents: aParentCollection baseStruct: aStructure on: html
html unorderedList: [
aChild isComposite ifTrue:[
aChild children do: [:child |
self doRenderChild: child on:html currentStructure: aStructure.
(aParentCollection includes: child) ifTrue: [
self buildUlForChild: child ofParents: aParentCollection baseStruct: aStructure
on:html]
]
]
]! !
!SWHierarchyMenu methodsFor: 'as yet unclassified' stamp: 'skag 12/20/2004
14:08'!
doRenderChild: aStructure on: html currentStructure: aCurStructure
(aStructure = aCurStructure)
ifTrue: [html cssClass: 'current']
ifFalse: [html cssClass: 'norm'].
html listItem: [html anchorWithUrl: aStructure url do: aStructure title ].! !
!SWHierarchyMenu methodsFor: 'as yet unclassified' stamp: 'skag 12/20/2004
15:00'!
renderBodyWith: anAction on: html
"this template does not involve a visitor class, because it recursively rebuilds the
whole document tree by itself"
|current theRoot theParents |
current _ anAction structure.
theParents _ current parents. "note that SWStructure.parents includes
current!!"
theRoot _ current root.
self renderDivFor: anAction on: html with: [
html unorderedList: [
"always render the rootnode"
self doRenderChild: theRoot on: html currentStructure: current.
"render the rootnodes children"
theRoot children do: [:aChild |
self doRenderChild: aChild on: html currentStructure: current.
(theParents notEmpty) ifTrue: [
(theParents includes: aChild) ifTrue: [
"aChild is THE FIRST LEVEL ANCESTOR of the current node,
so go on recursively showing aChilds children,
until current itself is included in theParents:"
self buildUlForChild: aChild ofParents: theParents baseStruct:
current on: html.
]
]
]
]
]
! !
!SWHierarchyMenu class methodsFor: 'as yet unclassified' stamp: 'skag
12/20/2004 13:54'!
title
^'HierarchyMenu'! !