src/Pure/Thy/html.ML
changeset 66044 bd7516709051
parent 63934 397b25cee74c
child 67306 897344e33c26
equal deleted inserted replaced
66043:f704c063e95d 66044:bd7516709051
    23 
    23 
    24 
    24 
    25 (* common markup *)
    25 (* common markup *)
    26 
    26 
    27 fun span class = ("<span class=" ^ quote (XML.text class) ^ ">", "</span>");
    27 fun span class = ("<span class=" ^ quote (XML.text class) ^ ">", "</span>");
       
    28 val enclose_span = uncurry enclose o span;
    28 
    29 
    29 val hidden = span Markup.hiddenN |-> enclose;
    30 val hidden = enclose_span Markup.hiddenN;
    30 
    31 
    31 
    32 
    32 (* symbol output *)
    33 (* symbol output *)
    33 
    34 
    34 abstype symbols = Symbols of string Symtab.table
    35 abstype symbols = Symbols of string Symtab.table
    83 
    84 
    84 (* presentation *)
    85 (* presentation *)
    85 
    86 
    86 fun present_span symbols keywords =
    87 fun present_span symbols keywords =
    87   let
    88   let
       
    89     fun present_markup (name, props) =
       
    90       (case Properties.get props Markup.kindN of
       
    91         SOME kind =>
       
    92           if kind = Markup.commandN orelse kind = Markup.keywordN then enclose_span kind else I
       
    93       | NONE => I) #> enclose_span name;
    88     fun present_token tok =
    94     fun present_token tok =
    89       fold_rev (uncurry enclose o span o #1)
    95       fold_rev present_markup (Token.markups keywords tok)
    90         (Token.markups keywords tok) (output symbols (Token.unparse tok));
    96         (output symbols (Token.unparse tok));
    91   in implode o map present_token o Command_Span.content end;
    97   in implode o map present_token o Command_Span.content end;
    92 
    98 
    93 
    99 
    94 
   100 
    95 (** HTML markup **)
   101 (** HTML markup **)