more direct index_entry: no positions required -- text is eventually moved to .ind file;
authorwenzelm
Tue, 25 May 2021 21:44:01 +0200
changeset 73779 546e1e591635
parent 73778 a383c4340c25
child 73780 466fae6bf22e
more direct index_entry: no positions required -- text is eventually moved to .ind file;
src/Pure/Thy/latex.ML
--- a/src/Pure/Thy/latex.ML	Tue May 25 21:32:21 2021 +0200
+++ b/src/Pure/Thy/latex.ML	Tue May 25 21:44:01 2021 +0200
@@ -31,7 +31,6 @@
   val theory_entry: string -> string
   val index_escape: string -> string
   type index_item = {text: text, like: string}
-  val index_item: index_item -> text
   type index_entry = {items: index_item list, def: bool}
   val index_entry: index_entry -> text
   val index_variants: (binding -> bool option -> 'a -> 'a) -> binding -> 'a -> 'a
@@ -265,15 +264,16 @@
 fun index_item (item: index_item) =
   let
     val like_text =
-      if #like item = "" then []
-      else [string (index_escape (#like item) ^ "@")];
-  in block (like_text @ [map_text index_escape (#text item)]) end;
+      if #like item = "" then ""
+      else index_escape (#like item) ^ "@";
+    val item_text = index_escape (output_text [#text item]);
+  in like_text ^ item_text end;
 
 fun index_entry (entry: index_entry) =
-  (separate (string "!") (map index_item (#items entry)) @
-    [string ("|" ^ index_escape (if #def entry then "isaindexdef" else "isaindexref"))])
-  |> enclose_block "\\index{" "}";
-
+  (space_implode "!" (map index_item (#items entry)) ^
+    "|" ^ index_escape (if #def entry then "isaindexdef" else "isaindexref"))
+  |> enclose "\\index{" "}"
+  |> string;
 
 fun index_binding NONE = I
   | index_binding (SOME def) = Binding.map_name (suffix (if def then "_def" else "_ref"));