200330.4 · 067807f4166ef25c9302ae7049f2ccc0e1282d52
2nd attempt to fix the format
reading declarations
@@ -3,35 +3,32 @@ Description="Generate coloured bio sequences in Sequence Alignment Maps" -- optional parameter: syntax description function syntaxUpdate(desc) - t = {}- t["A"] = "144;238;144" --144, 238, 144- t["T"] = "240;128;128" --240, 128, 128- t["C"] = "173;216;230" --173, 216, 230- t["G"] = "255;160;122" --255, 160, 122-- function Decorate(token, state, kwclass)-- if ( (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML or HL_OUTPUT == HL_FORMAT_TRUECOLOR)- and #token > 63 and state == HL_KEYWORD and not string.match(token,"[^ATCG]") ) then-- retVal = ""- for c in token:gmatch"." do- if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then- retVal = retVal .. "<span class='elem_".. c .. "'>".. c .. "</span>"- elseif (HL_OUTPUT == HL_FORMAT_TRUECOLOR) then- retVal = retVal .. "\27[48;2;".. t[c] .. "m".. c .. "\27m"- end-- --"\033[48;5;"<< ( int ) rgb2xterm ( bg_rgb ) << "m"-+ t = {}+ t["A"] = "144;238;144" --144, 238, 144+ t["T"] = "240;128;128" --240, 128, 128+ t["C"] = "173;216;230" --173, 216, 230+ t["G"] = "255;160;122" --255, 160, 122++ function Decorate(token, state, kwclass)++ if ( (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML or HL_OUTPUT == HL_FORMAT_TRUECOLOR)+ and #token > 63 and state == HL_KEYWORD and not string.match(token,"[^ATCG]") ) then++ retVal = ""+ for c in token:gmatch"." do+ if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then+ retVal = retVal .. "<span class='elem_".. c .. "'>".. c .. "</span>"+ elseif (HL_OUTPUT == HL_FORMAT_TRUECOLOR) then+ retVal = retVal .. "\27[48;2;".. t[c] .. "m".. c .. "\27m" end- return retVal- end+ end+ return retVal end+ end end function themeUpdate(desc)- if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then+ if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then Injections[#Injections+1]=[[ span.elem_A {@@ -46,12 +43,11 @@ span.elem_C { span.elem_G { background-color: lightsalmon; }- ]]- end+]]+ end end Plugins={-- { Type="lang", Chunk=syntaxUpdate },- { Type="theme", Chunk=themeUpdate }+ { Type="lang", Chunk=syntaxUpdate },+ { Type="theme", Chunk=themeUpdate } }