[BioRuby] Bioruby HTML output

Tomoaki NISHIYAMA tomoakin at kenroku.kanazawa-u.ac.jp
Wed Jan 13 09:44:01 UTC 2010


Hi,

> I think with a sequence we can assume the content is a legal string.
> Escaping is overkill and (if needed) points to a bigger problem. I
> think we should not clutter the code with (1) - or degrade performance
> by default.


If we are talking on Bio::Html::HtmlAlignment,
it is better to escape even for sequence or matchlines to make
the class more independent of the implementation of alignment class.
Note that sim4 uses >>>...>>> in its matchline, and a future
intron aware amino acid alignment processing program might use
special characters to indicate introns.

If the performance is really a problem and
it is in Bio::Alignment::Output, and the constructor guarantees
that there is no special characters, then the escape may be skipped.
Escaping everything is the default simple program structure and
removing that process is a kind of optimization with some programming  
effort
to guarantee its validity without escaping.
-- 
Tomoaki NISHIYAMA

Advanced Science Research Center,
Kanazawa University,
13-1 Takara-machi,
Kanazawa, 920-0934, Japan


On 2010/01/13, at 16:37, Pjotr Prins wrote:

> Hi all,
>
> OK, I'll adapt the output generator to escape symbols. And I think
> you are right it belongs in the generator. There are three scenario's
> really:
>
> 1. Output that never contains symbols (sequence)
> 2. Output that can contain symbols, but should be escaped
> (descriptions, id's)
> 3. Output that can contain HTML
>
> In my case I have all three.
>
> I think with a sequence we can assume the content is a legal string.
> Escaping is overkill and (if needed) points to a bigger problem. I
> think we should not clutter the code with (1) - or degrade performance
> by default.
>
> Case (2) yes!
>
> case (3), like a title or some text to plug in, we should escape by
> default, but add a parameter :html_escape == false for the cases  
> the user
> wants to plug in HTML.
>
> OK?
>
> Pj.
>




More information about the BioRuby mailing list