From: Kevin A. <al...@se...> - 2005-12-19 23:49:05
|
I'm sending this message to the general list rather than the pythoncard-devel list in hopes that some HTML/CSS expert will have a suggestion for how we can clean up our Python example code in the documentation so it can be copied and pasted. ka --- It was pointed out to me by Don Taylor that source examples in the docs can't be copied and pasted and run correctly. He specifically mentioned this code block in walkthrough2.html which you can see here: http://pythoncard.sourceforge.net/walkthrough2.html <p class="code"> def on_incrBtn_mouseClick(self, event):<br /> startValue = int(self.components.field1.text)<br /> endValue = startValue + 1<br /> self.components.field1.text = str(endValue)</p> The code looks fine displayed in the browser, but if someone tries to copy, paste, and then run it then the messes it up. Since this isn't an old-style <pre></pre> block you can't simply use spaces in the code to get the desired effect. The CSS we have defined for the style is: code, tt { font-family: Courier, monospace } A friend of mine suggested that you might simply change the CSS to: code, tt { text-indent: -1em; font-family: Courier, monospace } and then remove all the and wrap all the code in: <div style='padding:10px'> He said, "you are essentially negative indenting the first line but you have to move all of it over far enough so that it doesn't go off the page." I no longer have any HTML chops, but this seems like a hack. Surely there is a cleaner and simpler way we can adopt that other web sites, wikis, whatever are using for Python code so that it will look right and people will be able to copy and paste it? ka |