HTML exporter background color mismatch

1 view
Skip to first unread message

Jingcheng Zhang

unread,
Oct 29, 2009, 5:17:41 AM10/29/09
to scite-interest
Hello everyone,

There seems to be a bug in HTML exporter with the following style
definitions:

style.*.32=back:#999999
style.hypertext.32=back:#000000
style.hypertext.121=

The html file exported has a background color of "#FFFFFF", which is
default value of back property in StyleDefinition class. It should
inherit style.hypertext.32, not use the default value. I explorered
Exporters.cxx and find a little issue in the following codes (line
465-470):

if (sd.back.length()) {
if (istyle != STYLE_DEFAULT && bgColour != sd.back) {
fprintf(fp, "\tbackground: %s;\n", sd.back.c_str());
fprintf(fp, "\ttext-decoration: inherit;\n");
}
}

here sd.back is valued "#FFFFFF" as style.hypertext.121 is empty. This
value should be style.hypertext.32.

A little patch (Well, I'm not familiar with C++, just my guessing
codes, anyway it works :p )

467c467,471
< fprintf(fp, "\tbackground: %s;\n", sd.back.c_str());
---
> if (sd.specified & StyleDefinition::sdBack) {
> fprintf(fp, "\tbackground: %s;\n", sd.back.c_str());
> } else {
> fprintf(fp, "\tbackground: %s;\n", bgColour.c_str());
> }

Neil Hodgson

unread,
Nov 1, 2009, 5:36:16 AM11/1/09
to scite-i...@googlegroups.com
Jingcheng Zhang:

> 467c467,471
> <                                                       fprintf(fp, "\tbackground: %s;\n", sd.back.c_str());
> ---
>>                             if (sd.specified & StyleDefinition::sdBack) {
>>                                 fprintf(fp, "\tbackground: %s;\n", sd.back.c_str());
>>                             } else {
>>                                 fprintf(fp, "\tbackground: %s;\n", bgColour.c_str());
>>                             }

The else branch doesn't appear necessary to me as bgColour is
already the default background colour. Even simpler would be moving
the check for specified into the overall guard:

+++ Exporters.cxx 1 Nov 2009 10:34:10 -0000
@@ -462,7 +462,7 @@
} else if (istyle == STYLE_DEFAULT) {
fprintf(fp, "\tcolor: #000000;\n");
}
- if (sd.back.length()) {
+ if ((sd.specified & StyleDefinition::sdBack) && sd.back.length()) {


if (istyle != STYLE_DEFAULT && bgColour != sd.back) {
fprintf(fp, "\tbackground: %s;\n", sd.back.c_str());
fprintf(fp, "\ttext-decoration: inherit;\n");

Neil

Reply all
Reply to author
Forward
0 new messages