doc-src/antiquote_setup.ML
changeset 46524 8d51b375e926
parent 46518 11b6471c2f50
child 47825 4f25960417ae
equal deleted inserted replaced
46523:7ca897381b26 46524:8d51b375e926
   148   let val thy = Proof_Context.theory_of ctxt
   148   let val thy = Proof_Context.theory_of ctxt
   149   in defined thy o intern thy end;
   149   in defined thy o intern thy end;
   150 
   150 
   151 fun check_tool name =
   151 fun check_tool name =
   152   File.exists (Path.append (Path.explode "~~/lib/Tools") (Path.basic name));
   152   File.exists (Path.append (Path.explode "~~/lib/Tools") (Path.basic name));
   153 
       
   154 fun is_ancestor thy name =
       
   155   exists (fn thy => Context.theory_name thy = name) (thy :: Context.ancestors_of thy);
       
   156 
   153 
   157 val arg = enclose "{" "}" o clean_string;
   154 val arg = enclose "{" "}" o clean_string;
   158 
   155 
   159 fun entity check markup kind index =
   156 fun entity check markup kind index =
   160   Thy_Output.antiquotation
   157   Thy_Output.antiquotation
   208     "" "antiquotation option" #>
   205     "" "antiquotation option" #>
   209   entity_antiqs (fn _ => fn name => is_some (OS.Process.getEnv name)) "isatt" "setting" #>
   206   entity_antiqs (fn _ => fn name => is_some (OS.Process.getEnv name)) "isatt" "setting" #>
   210   entity_antiqs no_check "" "inference" #>
   207   entity_antiqs no_check "" "inference" #>
   211   entity_antiqs no_check "isatt" "executable" #>
   208   entity_antiqs no_check "isatt" "executable" #>
   212   entity_antiqs (K check_tool) "isatt" "tool" #>
   209   entity_antiqs (K check_tool) "isatt" "tool" #>
   213   entity_antiqs (is_ancestor o Proof_Context.theory_of) "" "theory" #>
       
   214   entity_antiqs (thy_check ML_Context.intern_antiq ML_Context.defined_antiq)
   210   entity_antiqs (thy_check ML_Context.intern_antiq ML_Context.defined_antiq)
   215     "" Isabelle_Markup.ML_antiquotationN;
   211     "" Isabelle_Markup.ML_antiquotationN;
   216 
   212 
   217 end;
   213 end;
   218 
   214