[BioRuby] Bioruby HTML output

Pjotr Prins pjotr.public14 at thebird.nl
Fri Jan 15 14:00:59 UTC 2010


On second thought, escaping is less obvious than I thought. I can
escape all generated HTML, but that leaves no way to customize the
output. Say I want to include an href in a sequence descriptor - which
is a fairly typical requirement - that would be disabled. Likewise if
someone wants to customize the title or footer - or even the
information on the match_line. 

The problem here is that we are defining use - forcing the generated
HTML into a straight jacket by adding business logic. 

Are we really telling our users not to use HTML in sequence
descriptors, even if it is tied to one type of output?

I don't like it.

I am going to add a 'master' switch for escaping of HTML. The default
will be with escaping.

Pj.

On Wed, Jan 13, 2010 at 06:44:01PM +0900, Tomoaki NISHIYAMA wrote:
> 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.
>>
>
> _______________________________________________
> BioRuby Project - http://www.bioruby.org/
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby



More information about the BioRuby mailing list