[Tutor] To write data in two different fonts?

Dave Angel davea at ieee.org
Wed Aug 12 12:41:17 CEST 2009


prasad rao wrote:
>>> But I think you want the <pre> tag, which means the text is
>>>       
>> pre-formatted.  And you could >put that around the whole sorce file, instead
>> of doing <p> for each line.
>>
>>     
>>> See   http://www.w3schools.com/tags/tag_pre.asp
>>>       
>
>
> Thank you Dave.
> I put in tag <pre> and it worked. But at one particular line in a module
> the font changed colour.After that all the lines are in blue colour and
> under lined.
> I removed that module from the directory and now it is working well.I could
> not
> figure out why the change of colour of font took place.
>
> Thank you
>
>   
As I said, you'd probably get in trouble if any of the lines had '&' or 
'<' characters in them.  The following function from the standard 
library can be used to escape the line directly, or of course you could 
use the function Nick supplied.

xml.sax.saxutils.escape(/data/[, /entities/])

    Escape '&', '<', and '>' in a string of data.

    You can escape other strings of data by passing a dictionary as the
    optional /entities/ parameter. The keys and values must all be
    strings; each key will be replaced with its corresponding value. The
    characters '&', '<' and '>' are always escaped, even if /entities/
    is provided.

Let us know if that doesn't do the trick.

DaveA



More information about the Tutor mailing list