<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Building a twiki with the Live* Style Sheet</title> <style type="text/css"> <!-- @import url(http://research.sun.com/projects/live/live.css); --> </style> </head> <body> <a class="linkindex" href="http://sunlabs.sfbay.sun.com/twiki/bin/view/Projects/Live*">Back to the Live* twiki</a> <p class="title">HTML editing with the Live* Style Sheet</p> <p class="text">Web pages built using the Live* style sheet will have html source that can be pasted anywhere with almost no modifications necessary to the code. This makes it easy to evangelize the project, as web pages (such as guides or walkthroughs) can be easily pasted into external blogs, wikis, etc. for the world to see. We'll explore how to format your html so that the code is portable.</p> <p class="text">Keep in mind that this guide itself is rendered using the Live* style sheet, so if you're familiar with html and css, you may refer to the html of this guide for an example and go from there. Click Edit on this twiki to do so.</p> <p class="sectionheader"><span class="sectionnum">1.</span> Picking an HTML Editor</p> <p class="text">It doesn't matter what HTML editor you use, but some members of the Live* project are using <span class="infoyellow">Coda</span> for html editing. It has an easy preview option so you can see how things render as they appear. <span class="infoyellow">Coda</span> runs only on the OS X platform. It can be found at <a href="http://www.panic.com/coda">http://www.panic.com/coda</a>. <p class="sectionheader"><span class="sectionnum">2.</span> Required HTML Tags</p> <p class="text">In order to render a pure-HTML document inside a twiki, your HTML document <b>must</b> follow the following format: <html><head>Header here</head><body>Body here</body></html> All of the aforementioned section tags are necessary or the twiki will not recognize the document as being HTML, and will attempt to render it using the standard twiki rules.</p> <p class="sectionheader"><span class="sectionnum">3.</span> Import the Live* style sheet</p> <p class="text">The next thing to do is import the Live* style sheet. This allows your text to be represented cleanly, and with a Sun-centric color palette. To do this, insert the following line in the <head></head> section of your document: <p class="infobox"><style type="text/css"> <!-- @import url(http://sunlabs.sfbay.sun.com/twiki/pub/Projects/Live/live.css); --> </style> </p> <p class="comment">(Once the Live* website is set up correctly, we should move the style sheet so it is accessible outside SWAN)</p> <p class="sectionheader"><span class="sectionnum">4.</span> Link to the Live* twiki index</p> <p class="text">Any twiki created for the Live* project <strong>must</strong> link back to the Live* index. This is achieved by including the following html as the first line of your body:</p> <p class="infobox"><a class="linkindex" href="http://sunlabs.sfbay.sun.com/twiki/bin/view/Projects/Live*"> Back to the Live* twiki</a></p> <p class="sectionheader"><span class="sectionnum">5.</span> Link From the Live* twiki index</p> <p class="text">Your twiki should be listed as a link in the Live* twiki index (<a href="http://sunlabs.sfbay.sun.com/twiki/bin/view/Projects/Live*">http://sunlabs.sfbay.sun.com/twiki/bin/view/Projects/Live*</a>) , as this is the central repository for Live* twikis.</p> <p class="sectionheader"><span class="sectionnum">6.</span> Using the style sheet</p> <p class="text">To use the style sheet, simply tag your text with the paragraph style you want to use. This is best illustrated using examples. Here is how you would tag a document title:</p> <p class="infobox"><p class="title">This is a test title</p></p> <p class="text">This would render as:</p> <p class="title">This is a test title</p> <p class="text">Another common paragraph style is for normal paragraph text. The sentence you are reading right now is rendered using this style. To use this style, simply tag your text with:</p> <p class="infobox"><p class="text">This is paragraph text.</p></p> <p class="text">There are additional classes for section headers, section numbers, comments, etc. Load the Live* style sheet in a browser window to view all paragraph classes.</p> <p class="sectionheader"><span class="sectionnum">7.</span> The infobox paragraph style</p> <p class="text">The infobox paragraph style is very useful for a verbatim illustration of actions that the user should perform. The below code snippet is used to show the user how to perform a directory listing, and what result they should expect.</p> <p class="infobox"><p class="infobox"><span class="prompt">$ </span>ls -l /usr/java <span class="output">total 3 default -> /usr/java/latest jdk1.6.0_06 latest -> /usr/java/jdk1.6.0_06</span></p> <p class="text">The above code would render as below:</p> <p class="infobox"><span class="prompt">$ </span>ls -l /usr/java <span class="output">total 3 default -> /usr/java/latest jdk1.6.0_06 latest -> /usr/java/jdk1.6.0_06</span></p> <p class="text">The above example uses the infobox paragraph style, along with two span styles. The span tag is useful if you want to apply a style to some subset of characters in a paragraph, not the whole thing. Here is a more in-depth explanation of the above snippet: <br><br> - The "infobox" style applies to the entire paragraph. If no spanning styles were used inside the infobox, all text would render via the "infobox" style. Since <span class="infoyellow">ls -l /usr/java</span> is not tagged, it is rendered in the "infobox" style.<br> - The <span class="infoyellow">$</span> character is tagged with a "prompt" spanning style. This is so that it looks like a true shell prompt.<br> - The output of the <span class="infoyellow">ls</span> command is tagged with an "output" span style. As a result, it looks like text on a computer console.<br> - Note that whitespace in an infobox is set to WYSIWYG. That is, three spaces in a row will show up as three spaces in the infobox. This is especially useful when putting code snippets in an infobox.<br><br> These are just a few of the styles that are defined in the Live* style sheet. Load the style sheet into a web browser to see all styles.</p> <p class="sectionheader"><span class="sectionnum">8.</span> Adding or Changing the Live* Style Sheet</p> <p class="text">The Live* style sheet is constructed so that html documents can be created using a clear style that is compatible with the Sun color palette. Not all of the styles in the sheet will work for every situation. You may find it necessary to add styles to the sheet. This should be done with caution, as style sheets can become unwieldly to the point where it is not clear what style to use in a given context.<br><br> You should <span class="comment">not</span> remove styles from the style sheet once people start rolling out blogs and wikis in the Live* style. If you remove a style from the sheet, someone's blog/wiki somewhere is going to look really ugly, and that hurts Live* evangelism efforts.</p> </body> </html> <nowiki>
Last updated January 22, 2009 08:38, by Eric Lalonde





