src/Pure/Thy/thy_output.ML
changeset 67572 a93cf1d6ba87
parent 67571 f858fe5531ac
child 68178 e3dd94d04eee
equal deleted inserted replaced
67571:f858fe5531ac 67572:a93cf1d6ba87
    58 and output_comment_document ctxt (comment, syms) =
    58 and output_comment_document ctxt (comment, syms) =
    59   (case comment of
    59   (case comment of
    60     SOME kind => output_comment ctxt (kind, syms)
    60     SOME kind => output_comment ctxt (kind, syms)
    61   | NONE => [Latex.symbols syms])
    61   | NONE => [Latex.symbols syms])
    62 and output_document_text ctxt syms =
    62 and output_document_text ctxt syms =
    63   (case Comment.read_body syms of
    63   Comment.read_body syms |> maps (output_comment_document ctxt)
    64     SOME res => maps (output_comment_document ctxt) res
       
    65   | NONE => [Latex.symbols syms])
       
    66 and output_document ctxt {markdown} source =
    64 and output_document ctxt {markdown} source =
    67   let
    65   let
    68     val pos = Input.pos_of source;
    66     val pos = Input.pos_of source;
    69     val syms = Input.source_explode source;
    67     val syms = Input.source_explode source;
    70 
    68 
   120   | (SOME comment, _) => output_comment ctxt (comment, syms));
   118   | (SOME comment, _) => output_comment ctxt (comment, syms));
   121 
   119 
   122 in
   120 in
   123 
   121 
   124 fun output_body ctxt antiq bg en syms =
   122 fun output_body ctxt antiq bg en syms =
   125   (case Comment.read_body syms of
   123   Comment.read_body syms
   126     SOME res => maps (output_comment_symbols ctxt {antiq = antiq}) res
   124   |> maps (output_comment_symbols ctxt {antiq = antiq})
   127   | NONE => output_symbols syms) |> Latex.enclose_body bg en
   125   |> Latex.enclose_body bg en
   128 and output_token ctxt tok =
   126 and output_token ctxt tok =
   129   let
   127   let
   130     fun output antiq bg en =
   128     fun output antiq bg en =
   131       output_body ctxt antiq bg en (Input.source_explode (Token.input_of tok));
   129       output_body ctxt antiq bg en (Input.source_explode (Token.input_of tok));
   132   in
   130   in
   146 
   144 
   147 fun output_source ctxt s =
   145 fun output_source ctxt s =
   148   output_body ctxt false "" "" (Symbol_Pos.explode (s, Position.none));
   146   output_body ctxt false "" "" (Symbol_Pos.explode (s, Position.none));
   149 
   147 
   150 fun check_comments ctxt =
   148 fun check_comments ctxt =
   151   Comment.read_body #> (Option.app o List.app) (fn (comment, syms) =>
   149   Comment.read_body #> List.app (fn (comment, syms) =>
   152     let
   150     let
   153       val pos = #1 (Symbol_Pos.range syms);
   151       val pos = #1 (Symbol_Pos.range syms);
   154       val _ =
   152       val _ =
   155         comment |> Option.app (fn kind =>
   153         comment |> Option.app (fn kind =>
   156           Context_Position.reports ctxt (map (pair pos) (Markup.cartouche :: Comment.markups kind)));
   154           Context_Position.reports ctxt (map (pair pos) (Markup.cartouche :: Comment.markups kind)));