'From etoys3.0 of 18 March 2008 [latest update: #1958] on 7 April 2008 at 3:09:55 pm'! "Change Set: QGuide-web2-tk Date: 7 April 2008 Author: Ted Kaehler Enhancements to the code that writes QuickGuides out as web pages. This is only used by Ted, and is not needed by normal EToys users. See web pages of the guides at: http://wiki.laptop.org/go/Etoys_QuickGuides_Index Add the text in each page of the guide to the 'alt=' field of each image in the web page, and also add the text to the bottom of the page. This is so that search engines will find it. Users will be able to search for a QuickGuide topic on Google and find the guide page. "! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 3/17/2008 14:49'! allTextIn: aPage "Return a string of all the text in all the textMorphs on this page. separated by period space space." | tt | ^ String streamContents: [:strm | aPage allMorphsDo: [:mm | (mm isKindOf: TextMorph) ifTrue: [ tt _ mm contents string withBlanksTrimmed. strm nextPutAll: tt. (tt size > 0 and: [tt last ~= $.]) ifTrue: [strm nextPut: $.]. strm space; space]]].! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 3/15/2008 16:27'! guideToWeb "Write all the info in this guide to a web page. Pages are images (jPEGs). Create a page to hold them." self guideToWebWithJPEGs: true.! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 3/18/2008 00:10'! guideToWebWithJPEGs: withPics "Write all the info in this guide to a web page. Pages are images (jPEGs). Create a page to hold them." | dir qgh bk strm ff allText thisText | dir _ FileDirectory default directoryNamed: 'QG-web'. "picutres of guide pages" qgh _ self submorphOfClass: QuickGuideHolderMorph. bk _ qgh submorphOfClass: BookMorph. strm _ WriteStream on: (String new: 500). strm nextPutAll: (self htmlPreamble: qgh guideNameInWords). "includes index side bar" allText _ ''. 1 to: bk pages size do: [:ii | withPics ifTrue: [ "Make images of pages" bk goToPage: ii. "show it" self jPegOutDir: dir]. thisText _ self allTextIn: (bk pages at: ii). strm nextPutAll: ' '.
		strm nextPutAll: qgh guideName, ', page ', ii printString,'. ', thisText, ' '. allText _ allText, thisText]. strm nextPutAll: '

Jump to Top

Squeak Etoys is a "media authoring tool"-- software that you can download to your computer
and then use to create your own media. You can write out your project and share it with others.
Etoys runs on any Mac or Windows machine, as well as on the OLPC XO machine.
It is free.    Find out about Etoys.



Text of this guide (for searching): ', allText, '

'. ff _ dir fileNamed: qgh guideName, '.html'. ff nextPutAll: strm contents; close.! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 3/15/2008 16:56'! htmlForJumpTo "Create the html for a long list of guide categories and guides. Each is a clickable link. Store in the class var HTMLJumpTo. For creating web pages from the Guides." | strm categories | strm _ WriteStream on: (String new: 500). strm nextPutAll: 'Guides about topics in EToys
Help screens for the OLPC
XO machine.

'. categories _ self class suggestedCategoryOrder. categories do: [:catName | strm nextPutAll: catName translated; nextPutAll: '
'; cr. pages do: [:pp | pp guideCategory = catName ifTrue: [ strm tab; tab. strm nextPutAll: '   '. strm nextPutAll: pp guideNameInWords translated; nextPutAll: '
'; cr. ]]. ]. ^ HTMLJumpTo _ strm contents! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 3/15/2008 14:18'! htmlPreamble: theGuideName "All the stuff at the beginning of an html file. Includes the JumpTo menu of links to other Guides." | strm | strm _ WriteStream on: (String new: 500). strm nextPutAll: ' '. strm nextPutAll: theGuideName. strm nextPutAll: ', an Etoys Quick Guide

'. strm nextPutAll: theGuideName. strm nextPutAll: '

'. strm nextPutAll: '

A Quick Guide for Etoys on the OLPC XO


'. strm nextPutAll: HTMLJumpTo. "Jump to menu" strm nextPutAll: '
'. ^ strm contents! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 3/15/2008 14:27'! jPegOutDir: fileDir "Write the current page of the current Guide as an image file on the directory" "Does it need to be showing?" | fName gn num qgh bk | qgh _ self submorphOfClass: QuickGuideHolderMorph. bk _ qgh submorphOfClass: BookMorph. num _ (bk pages indexOf: bk currentPage ifAbsent: [0]) printString. gn _ qgh guideName. fName _ fileDir pathName, fileDir pathNameDelimiter asString, gn, '-', num, '.jpg'. currentPage imageForm writeJPEGfileNamed: fName. "need to go deeper??" ^ ''! !