src/Pure/Thy/html.ML
changeset 27830 68de2a2780b3
parent 27829 c073006e0137
child 27832 992c6d984925
equal deleted inserted replaced
27829:c073006e0137 27830:68de2a2780b3
   267 
   267 
   268 fun href_opt_path NONE txt = txt
   268 fun href_opt_path NONE txt = txt
   269   | href_opt_path (SOME p) txt = href_path p txt;
   269   | href_opt_path (SOME p) txt = href_path p txt;
   270 
   270 
   271 fun para txt = "\n<p>" ^ txt ^ "</p>\n";
   271 fun para txt = "\n<p>" ^ txt ^ "</p>\n";
   272 fun preform txt = "<pre xml:space=\"preserve\">" ^ txt ^ "</pre>";
   272 fun preform txt = "<pre>" ^ txt ^ "</pre>";
   273 val verbatim = preform o output;
   273 val verbatim = preform o output;
   274 
   274 
   275 
   275 
   276 (* document *)
   276 (* document *)
   277 
   277 
   351 
   351 
   352 
   352 
   353 (* theory *)
   353 (* theory *)
   354 
   354 
   355 fun verbatim_source ss =
   355 fun verbatim_source ss =
   356   "\n</div>\n<hr/>\n<div class=\"source\">\n<pre xml:space=\"preserve\">" ^
   356   "\n</div>\n<hr/>\n<div class=\"source\">\n<pre>" ^
   357   implode (output_symbols ss) ^
   357   implode (output_symbols ss) ^
   358   "</pre>\n</div>\n<hr/>\n<div class=\"theorems\">\n";
   358   "</pre>\n</div>\n<hr/>\n<div class=\"theorems\">\n";
   359 
   359 
   360 
   360 
   361 local
   361 local
   400 
   400 
   401 fun string_of_thm ctxt =
   401 fun string_of_thm ctxt =
   402   Output.output o Pretty.setmp_margin 80 Pretty.string_of o
   402   Output.output o Pretty.setmp_margin 80 Pretty.string_of o
   403     setmp show_question_marks false (ProofContext.pretty_thm ctxt);
   403     setmp show_question_marks false (ProofContext.pretty_thm ctxt);
   404 
   404 
   405 fun thm ctxt th = preform (prefix_lines "  " (html_mode (string_of_thm ctxt) th));
   405 fun thm ctxt th = prefix_lines "  " (html_mode (string_of_thm ctxt) th);
   406 
   406 
   407 fun thm_name "" = ""
   407 fun thm_name "" = ""
   408   | thm_name a = " " ^ name (a ^ ":");
   408   | thm_name a = " " ^ name (a ^ ":");
   409 
   409 
   410 in
   410 in
   411 
   411 
   412 fun result ctxt k (a, ths) = para (cat_lines ((command k ^ thm_name a) :: map (thm ctxt) ths));
   412 fun result ctxt k (a, ths) = preform (cat_lines ((command k ^ thm_name a) :: map (thm ctxt) ths));
   413 
   413 
   414 fun results _ _ [] = ""
   414 fun results _ _ [] = ""
   415   | results ctxt k (res :: ress) = cat_lines (result ctxt k res :: map (result ctxt "and") ress);
   415   | results ctxt k (res :: ress) = cat_lines (result ctxt k res :: map (result ctxt "and") ress);
   416 
   416 
   417 end;
   417 end;