more explicit output of list items;
authorwenzelm
Sat, 17 Oct 2015 19:47:34 +0200
changeset 61461 77c9643a6353
parent 61460 732028edfbc7
child 61462 e16649b70107
more explicit output of list items;
NEWS
lib/texinputs/isabelle.sty
src/Pure/Thy/markdown.ML
src/Pure/Thy/thy_output.ML
--- a/NEWS	Sat Oct 17 19:32:01 2015 +0200
+++ b/NEWS	Sat Oct 17 19:47:34 2015 +0200
@@ -64,9 +64,12 @@
   \<^medskip>   \medskip
   \<^bigskip>   \bigskip
 
-  \<^item>  \item  (itemize)
-  \<^enum>  \item  (enumerate)
-  \<^descr>  \item  (description)
+* Paragraphs and nested lists may be specified similarly to Markdown,
+with control symbols to indicate list items as follows:
+
+  \<^item>  itemize
+  \<^enum>  enumerate
+  \<^descr>  description
 
 
 *** Isar ***
--- a/lib/texinputs/isabelle.sty	Sat Oct 17 19:32:01 2015 +0200
+++ b/lib/texinputs/isabelle.sty	Sat Oct 17 19:47:34 2015 +0200
@@ -43,9 +43,6 @@
 \def\isactrlsmallskip{\smallskip}
 \def\isactrlmedskip{\medskip}
 \def\isactrlbigskip{\bigskip}
-\def\isactrlitem{\item}
-\def\isactrlenum{\item}
-\def\isactrldescr{\item}
 
 \newenvironment{isaantiq}{{\isacharat\isacharbraceleft}}{{\isacharbraceright}}
 
--- a/src/Pure/Thy/markdown.ML	Sat Oct 17 19:32:01 2015 +0200
+++ b/src/Pure/Thy/markdown.ML	Sat Oct 17 19:47:34 2015 +0200
@@ -24,6 +24,7 @@
   val print_kind: kind -> string
   type line
   val line_source: line -> Antiquote.text_antiquote list
+  val line_is_item: line -> bool
   val line_content: line -> Antiquote.text_antiquote list
   val make_line: Antiquote.text_antiquote list -> line
   val empty_line: line
@@ -63,6 +64,7 @@
 
 fun line_source (Line {source, ...}) = source;
 fun line_is_empty (Line {is_empty, ...}) = is_empty;
+fun line_is_item (Line {item, ...}) = is_some item;
 fun line_content (Line {content, ...}) = content;
 
 
--- a/src/Pure/Thy/thy_output.ML	Sat Oct 17 19:32:01 2015 +0200
+++ b/src/Pure/Thy/thy_output.ML	Sat Oct 17 19:47:34 2015 +0200
@@ -192,9 +192,12 @@
     val output_antiquote = eval_antiquote state #> Symbol.explode #> Latex.output_ctrl_symbols;
     val output_antiquotes = map output_antiquote #> implode;
 
+    fun output_line line =
+      (if Markdown.line_is_item line then "\\item " else "") ^
+        output_antiquotes (Markdown.line_content line);
+
     fun output_blocks blocks = space_implode "\n\n" (map output_block blocks)
-    and output_block (Markdown.Paragraph lines) =
-          cat_lines (map (output_antiquotes o Markdown.line_source) lines)
+    and output_block (Markdown.Paragraph lines) = cat_lines (map output_line lines)
       | output_block (Markdown.List {kind, body, ...}) =
           let val env = Markdown.print_kind kind in
             "%\n\\begin{" ^ env ^ "}%\n" ^