540 likes | 567 Vues
Web Creole. Stephen Taylor with big thanks to Morten Kromberg and Stefano Lanzavecchia Dyalog User Conference 2008 Elsinore, Denmark. Agenda. Creolisation and the Web Handling webspace: FTP, IIS, Apache Structure content with HTML Style with CSS Static site from a DWS
E N D
Web Creole Stephen Taylor with big thanks to Morten Kromberg and Stefano Lanzavecchia Dyalog User Conference 2008 Elsinore, Denmark Web Creole
Agenda • Creolisation and the Web • Handling webspace: FTP, IIS, Apache • Structure content with HTML • Style with CSS • Static site from a DWS • Dynamic site from a Dyalog script Web Creole
Creolisation and the Web Web Creole
Browsers are a key interface Web Creole
But most web pages are code-heavy Web Creole
Creolised technology • software stays soft, modifiable • code must be readable • use minimal technology • know it well Web Creole
Creole methods buy us • fast, readable web pages • good relationships with search engines • simple generation of such pages from APL • lightly adding a web to an application Web Creole
Creolisation costs us • learning • careful writing Web Creole
Simplifying the problem space (staying out of the mud) Web Creole
Six mud patches • ‘slice and dice’ – beware Photoshop • Frames • Pixel perfection • Old browsers • Not encoding in UTF-8 • Invalid markup Web Creole
Writing lucid web pages • Encode in UTF-8 • Use minimal, valid markup • Abstract the presentation rules Web Creole
Some UTF-8 editors Windows • Notepad • Notepad2 from Flo's Freeware • UltraEdit from IDM MacOS • TextWrangler or BBEdit from Bare Bones Software Web Creole
Handling webspace Web Creole
Creole 101: do nothing • Copy your existing output to the webspace • For common file types (eg .doc, .pdf, .xls) • Server will serve it • Browser will display it • Duh Web Creole
FTP • Use FTP client such as WS_FTP • or Windows Explorer • Drag and drop… Web Creole
Creole 102: write plain text • Your app can write text files • Browsers can display them • Eg http://www.hixie.ch/advocacy/xhtml Web Creole
Good enough? • If this is all you need, stop here • examples\ex101.txt Web Creole
Structure content with HTML Web Creole
Creole 103: HTML Use HTML to add: • Structure (paras, headers) • Images • Links • examples\ex103.htm Web Creole
Validation is free http://validator.w3.org Web Creole
Style with CSS Web Creole
Separate content and style Web Creole
Cascading Style Sheets • W3C on Cascading Style Sheets, http://www.w3.org/Style/CSS/ • CSS Zen Garden, http://www.csszengarden.com/ • A List Apart, http://www.alistapart.com/ • Various books, eg The Zen of CSS Design Web Creole
Power of CSS Web Creole
Same document, new style Web Creole
And another style… Web Creole
KISS: keep it sharp & simple Web Creole
And keep the markup simple examples\apc Web Creole
Where to rule on style • In the CSS stylesheet for rules used across multiple pages • In the STYLEelement for rules used only on one page • In the styleattribute for rules used on only one element Web Creole
Now we’ve simplified the problem space and we’re ready for a creole solution Web Creole
Static site from a DWS Web Creole
Creole 201 Generate a static web site • from content organised in a .DWS • in English • (oh, and Japanese too, why not) • pook\pook.dws Web Creole
Simple tag function Web Creole
Array tag (1) lines←'The quick brown fox' 'jumps over the lazy dog.' 'p'tag⊃lines <p>The quick brown fox</p> ↑'p'tag¨lines <p>The quick brown fox</p> <p>jumps over the lazy dog.</p> ↑'body'tag'p'tag¨lines <body> <p>The quick brown fox</p> <p>jumps over the lazy dog.</p> </body> Web Creole
Array tag (2) ↑⊃tag/'html' 'body' 'p' lines <html> <body> <p> The quick brown fox jumps over the lazy dog. </p> </body> </html> Web Creole
Array tag (3) +tbl←↑('cat' 'mammal')('gecko' 'reptile')('dog' 'mammal') cat mammal gecko reptile dog mammal 'td'∘tag¨tbl <td>cat</td> <td>mammal</td> <td>gecko</td> <td>reptile</td> <td>dog</td> <td>mammal</td> ↑bdy←'tr'∘tag¨,/'td'∘tag¨tbl <tr><td>cat</td><td>mammal</td></tr> <tr><td>gecko</td><td>reptile</td></tr> <tr><td>dog</td><td>mammal</td></tr> Web Creole
Array tag (4) ↑⊃tag/'table' 'tbody' bdy <table> <tbody> <tr><td>cat</td><td>mammal</td></tr> <tr><td>gecko</td><td>reptile</td></tr> <tr><td>dog</td><td>mammal</td></tr> </tbody> </table> ↑⊃tag/'table' 'tbody',⊂'tr'∘tag¨,/'td'∘tag¨tbl <table> <tbody> <tr><td>cat</td><td>mammal</td></tr> <tr><td>gecko</td><td>reptile</td></tr> <tr><td>dog</td><td>mammal</td></tr> </tbody> </table> Web Creole
A page fn to write pages Web Creole
MakeAt to write the site Web Creole
And the site’s written language bar Web Creole
In two languages Web Creole
Content organised in .DWS Web Creole
In Unicode Web Creole
Dynamic site from a Dyalog script Web Creole
Creole 301 Use the WildServer to generate pages on request Web Creole
Research project • Stripped content of dyalog.com to a folder of text files marked up in HTML • Wrote a SiteMap object to relate files to sections, pages and page positions • Site’s content map now describable in 11 lines of code • And served from a single .apls file Web Creole
Content mapping (1) Web Creole
Content mapping (2) Web Creole
Creole content mapping (1) Web Creole
Creole content mapping (2) Web Creole