equal
deleted
inserted
replaced
108 val ((xname, _), pos) = Args.dest_src src; |
108 val ((xname, _), pos) = Args.dest_src src; |
109 val (name, f) = Name_Space.check (Context.Proof ctxt) (#1 (Antiquotations.get thy)) (xname, pos); |
109 val (name, f) = Name_Space.check (Context.Proof ctxt) (#1 (Antiquotations.get thy)) (xname, pos); |
110 in |
110 in |
111 f src state ctxt handle ERROR msg => |
111 f src state ctxt handle ERROR msg => |
112 cat_error msg ("The error(s) above occurred in document antiquotation: " ^ |
112 cat_error msg ("The error(s) above occurred in document antiquotation: " ^ |
113 quote name ^ Position.str_of pos) |
113 quote name ^ Position.here pos) |
114 end; |
114 end; |
115 |
115 |
116 fun option ((xname, pos), s) ctxt = |
116 fun option ((xname, pos), s) ctxt = |
117 let |
117 let |
118 val thy = Proof_Context.theory_of ctxt; |
118 val thy = Proof_Context.theory_of ctxt; |
196 | expand (Antiquote.Open _) = "" |
196 | expand (Antiquote.Open _) = "" |
197 | expand (Antiquote.Close _) = ""; |
197 | expand (Antiquote.Close _) = ""; |
198 val ants = Antiquote.read (Symbol_Pos.explode (txt, pos), pos); |
198 val ants = Antiquote.read (Symbol_Pos.explode (txt, pos), pos); |
199 in |
199 in |
200 if Toplevel.is_toplevel state andalso not (forall Antiquote.is_text ants) then |
200 if Toplevel.is_toplevel state andalso not (forall Antiquote.is_text ants) then |
201 error ("Unknown context -- cannot expand document antiquotations" ^ Position.str_of pos) |
201 error ("Unknown context -- cannot expand document antiquotations" ^ Position.here pos) |
202 else implode (map expand ants) |
202 else implode (map expand ants) |
203 end; |
203 end; |
204 |
204 |
205 |
205 |
206 fun check_text (txt, pos) state = |
206 fun check_text (txt, pos) state = |
307 if nesting = 0 andalso not (Toplevel.is_proof state) then tag_stack |
307 if nesting = 0 andalso not (Toplevel.is_proof state) then tag_stack |
308 else if nesting >= 0 then (tag', replicate nesting tag @ tags) |
308 else if nesting >= 0 then (tag', replicate nesting tag @ tags) |
309 else |
309 else |
310 (case drop (~ nesting - 1) tags of |
310 (case drop (~ nesting - 1) tags of |
311 tgs :: tgss => (tgs, tgss) |
311 tgs :: tgss => (tgs, tgss) |
312 | [] => err_bad_nesting (Position.str_of cmd_pos)); |
312 | [] => err_bad_nesting (Position.here cmd_pos)); |
313 |
313 |
314 val buffer' = |
314 val buffer' = |
315 buffer |
315 buffer |
316 |> end_tag edge |
316 |> end_tag edge |
317 |> close_delim (fst present_cont) edge |
317 |> close_delim (fst present_cont) edge |
533 fun pretty_prf full ctxt = Proof_Syntax.pretty_proof_of ctxt full; |
533 fun pretty_prf full ctxt = Proof_Syntax.pretty_proof_of ctxt full; |
534 |
534 |
535 fun pretty_theory ctxt (name, pos) = |
535 fun pretty_theory ctxt (name, pos) = |
536 (case find_first (fn thy => Context.theory_name thy = name) |
536 (case find_first (fn thy => Context.theory_name thy = name) |
537 (Theory.nodes_of (Proof_Context.theory_of ctxt)) of |
537 (Theory.nodes_of (Proof_Context.theory_of ctxt)) of |
538 NONE => error ("No ancestor theory " ^ quote name ^ Position.str_of pos) |
538 NONE => error ("No ancestor theory " ^ quote name ^ Position.here pos) |
539 | SOME thy => (Position.report pos (Theory.get_markup thy); Pretty.str name)); |
539 | SOME thy => (Position.report pos (Theory.get_markup thy); Pretty.str name)); |
540 |
540 |
541 |
541 |
542 (* default output *) |
542 (* default output *) |
543 |
543 |