I have found why the copy of scilex controls lost some information.
The following code fragment contains the corrected getHTML and WriteHTML predicates and clauses.
Code: Select all
predicates
% 2014.11.21. Modified by Ferenc Nagy
% Write HTML with background colors and ornamentation.
writeHTML : (outputStream S, sciLexer_native::sci_style Style, integer From, integer Next, integer To).
getHTML : (integer From, integer To) -> string HTML.
constants
font_format="<span style=\"font-family:'%';font-size:%pt%".
color_format='%:#%02x%02x%02x%'.
clauses
getHTML(From, To) = S:getString():-
From<To,
S = outputStream_string::new(),
writeHTML(S, noStyle, From, From, To),
!.
getHTML(_,_) = "".
constants
noStyle = 255.
facts - ornamentation
unclosed_span: boolean := false.
font_is_Bold:vpiDomains::fs := 0.
font_is_Underline:vpiDomains::fs := 0.
font_is_Italic:vpiDomains::fs := 0.
clauses
writeHTML(S, StylePre, Start, From, To) :-
From < To,
Char = tryGetCharAt(From),
!,
if Style = tryGetStyleAt(From) then else Style = noStyle end if,
if StylePre <> Style then
if Start<From then
if noStyle <> StylePre then
if unclosed_span=true then
S:write("</span>"),
unclosed_span:=false
end if,
if font_is_Italic=vpiDomains::fs_Italic then
S:write("</i>"),
font_is_Italic:=0
end if,
if font_is_Underline=vpiDomains::fs_UnderLine then
S:write("</u>"),
font_is_Underline:=0
end if,
if font_is_Bold=vpiDomains::fs_Bold then
S:write("</b>"),
font_is_Bold:=0
end if
end if
end if,
if noStyle <> Style then
if styleGetBold(Style)=true then
Bold = fs_Bold,
S:write("<b>")
else
Bold = 0
end if,
font_is_Bold:=Bold,
if styleGetUnderline(Style)=true then
Underline = fs_Underline,
S:write("<u>")
else
Underline = 0
end if,
font_is_Underline:=Underline,
if styleGetItalic(Style)=true then
Italic = fs_Italic,
S:write("<i>")
else
Italic = 0
end if,
font_is_Italic:=Italic,
% Ferenc Nagy 2014.11.21. Write HTML with background and ornamentation.
FColor = styleGetFore(Style),
FB = FColor mod 0x100,
FG = FColor div 0x100 mod 0x100,
FR = FColor div 0x10000 mod 0x100,
BColor = styleGetBack(Style),
BB = BColor mod 0x100,
BG = BColor div 0x100 mod 0x100,
BR = BColor div 0x10000 mod 0x100,
unclosed_span:=true,
S:writef(font_format,
styleGetFont(Style), styleGetSize(Style),";"),
S:writef(color_format,'color', FB, FG, FR,";"),
S:writef(color_format,'background-color', BG, BB, BR,'">')
% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
end if
end if,
if Encoded = mustEncode(Char) then
S:write(Encoded)
else
S:write(Char)
end if,
if Next = tryPositionAfter(From) then
writeHTML(S, Style, Start, Next, To)
end if.
writeHTML(S, _Style, _Start, _From, _To) :-
if unclosed_span=true then
S:write("</span>"),
unclosed_span:=false
end if,
if font_is_Italic=vpiDomains::fs_Italic then
S:write("</i>"),
font_is_Italic:=0
end if,
if font_is_Underline=vpiDomains::fs_UnderLine then
S:write("</u>"),
font_is_Underline:=0
end if,
if font_is_Bold=vpiDomains::fs_Bold then
S:write("</b>"),
font_is_Bold:=0
end if.
saved as Word and HTML.