parserImport XOCL; /****************************************************************************** * * * HTML Rendering Aspect * * --------------------- * * * * Each entry can be rendered as HTML ready for display using a suitable * * engine such as a web-browser. The aspect is defined in this file. * * * ******************************************************************************/ import IO; import DocTables; import Basic; import Forms; // Basic HTML aspects context Big @Operation html(out:OutputChannel) format(out,""); entry.html(out); format(out,"") end context Bold @Operation html(out:OutputChannel) format(out,""); entry.html(out); format(out,"") end context Break @Operation html(out:OutputChannel) format(out,"
") end context Centre @Operation html(out:OutputChannel) format(out,"
"); entry.html(out); format(out,"
") end context Code @Operation html(out:OutputChannel) format(out,"
~S
",Seq{text}) end context Col @Operation html(out:OutputChannel) format(out,""); entry.html(out); format(out,"") end context Entries @Operation html(out:OutputChannel) @For entry in entries do entry.html(out) end end context Font @Operation html(out:OutputChannel) format(out,"",Seq{face,size,colour}); entry.html(out); format(out,"") end context Heading @Operation html(out:OutputChannel) format(out,"~S",Seq{level,text,level}) end context HTML @Operation html(out:OutputChannel) format(out,"~S",Seq{text}) end context Image @Operation html(out:OutputChannel) if width = 0 or height = 0 then format(out,"",Seq{file}) else format(out,"",Seq{file,width,height,align}) end end context Link @Operation html(out:OutputChannel) format(out,""); entry.html(out); format(out,"") end context LinkAnchor @Operation html(out:OutputChannel) format(out,""); @For entry in entries do entry.html(out) end; format(out,"") end context List @Operation html(out:OutputChannel) if ordered then format(out,"
    ") else format(out,"
") else format(out,"") end end context Page @Operation html() let sout = StringOutputChannel() in self.html(sout); sout.getString() end end context Page @Operation html(out:OutputChannel) format(out,""); format(out,""); if stylesheet <> "" then format(out,"",Seq{stylesheet}) end; format(out,"~S",Seq{title}); format(out,""); format(out,""); @For entry in entries do entry.html(out) end; format(out,""); format(out,"") end context Para @Operation html(out:OutputChannel) format(out,""); @For entry in entries do entry.html(out) end; format(out,"") end context Row @Operation html(out:OutputChannel) format(out,""); @For col in cols do @TypeCase(col) Col do col.html(out) end else format(out,""); col.html(out); format(out,"") end end; format(out,"") end context Section @Operation html(out:OutputChannel) format(out,"
",Seq{name}); @For entry in entries do entry.html(out) end; format(out,"
") end context Table @Operation html(out:OutputChannel) format(out,"",Seq{borderSize}); // format(out,"",Seq{headerColor}); if header <> "" then format(out,"",Seq{headerColor}); format(out,""); format(out,"") end; @For row in rows do row.html(out) end; format(out,"
",Seq{self.maxRowWidth()}); format(out,"~S",Seq{header}); format(out,"
") end context Text @Operation html(out:OutputChannel) format(out,"~S~%",Seq{text}) end context Underline @Operation html(out:OutputChannel) format(out,""); entry.html(out); format(out,"") end // Forms HTML aspects context ActiveText @Operation html(out:OutputChannel) format(out,"~S",Seq{id,text}) end context Form @Operation html(out:OutputChannel) format(out,"
",Seq{action}); @For entry in entries do entry.html(out) end; format(out,"
") end context Button @Operation html(out:OutputChannel) format(out,"",Seq{label,value}) end context CheckBox @Operation html(out:OutputChannel) let checked = if checked then "checked" else "" end in format(out,"",Seq{label,checked}) end end context ComboBox @Operation html(out:OutputChannel) format(out,"") end context TextField @Operation html(out:OutputChannel) if hideInput then format(out,"",Seq{"password",label,size,value}) else format(out,"",Seq{"text",label,size,value}) end end context TextArea @Operation html(out:OutputChannel) format(out,"",Seq{label,cols,rows,value}) end