src/Pure/Thy/document_antiquotations.ML
changeset 67356 ba226b87c69e
parent 67354 f243af7b5be3
child 67381 146757999c8d
equal deleted inserted replaced
67355:4c8280aaf6ad 67356:ba226b87c69e
    82 (* theory text with tokens (unchecked) *)
    82 (* theory text with tokens (unchecked) *)
    83 
    83 
    84 val _ =
    84 val _ =
    85   Theory.setup
    85   Theory.setup
    86     (Thy_Output.antiquotation \<^binding>\<open>theory_text\<close> (Scan.lift Args.text_input)
    86     (Thy_Output.antiquotation \<^binding>\<open>theory_text\<close> (Scan.lift Args.text_input)
    87       (fn {context = ctxt, ...} => fn source =>
    87       (fn {state, context = ctxt, ...} => fn source =>
    88         let
    88         let
    89           val _ =
    89           val _ =
    90             Context_Position.report ctxt (Input.pos_of source)
    90             Context_Position.report ctxt (Input.pos_of source)
    91               (Markup.language_Isar (Input.is_delimited source));
    91               (Markup.language_Isar (Input.is_delimited source));
    92 
    92 
    99             |> Source.exhaust;
    99             |> Source.exhaust;
   100           val _ = Context_Position.reports_text ctxt (maps (Token.reports keywords) toks);
   100           val _ = Context_Position.reports_text ctxt (maps (Token.reports keywords) toks);
   101           val indentation =
   101           val indentation =
   102             Latex.output_symbols (replicate (Config.get ctxt Thy_Output.indent) Symbol.space);
   102             Latex.output_symbols (replicate (Config.get ctxt Thy_Output.indent) Symbol.space);
   103         in
   103         in
   104           Latex.output_text (maps Thy_Output.output_token toks) |>
   104           Latex.output_text (maps (Thy_Output.output_token state) toks) |>
   105            (if Config.get ctxt Thy_Output.display then
   105            (if Config.get ctxt Thy_Output.display then
   106               split_lines #> map (prefix indentation) #> cat_lines #>
   106               split_lines #> map (prefix indentation) #> cat_lines #>
   107               Latex.environment "isabelle"
   107               Latex.environment "isabelle"
   108             else enclose "\\isa{" "}")
   108             else enclose "\\isa{" "}")
   109         end));
   109         end));