First experiments with a more liberal LaTeX parser for meta-args.

This commit is contained in:
Burkhart Wolff 2018-10-04 15:58:20 +02:00
parent c0b27698ae
commit ac835ea028
3 changed files with 25 additions and 15 deletions

View File

@ -31,7 +31,7 @@ theory Isa_DOF (* Isabelle Document Ontology Framework *)
and "lemma*" "theorem*" "assert*" ::thy_decl
and "print_doc_classes" "print_doc_items" "generate_template_sty" :: diag
and "print_doc_classes" "print_doc_items" "gen_sty_template" :: diag
begin
@ -517,7 +517,7 @@ fun write_ontology_latex_sty_template thy =
val _ =
Outer_Syntax.command @{command_keyword generate_template_sty}
Outer_Syntax.command @{command_keyword gen_sty_template}
"generate a template LaTeX style file for this ontology"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (write_ontology_latex_sty_template o Toplevel.theory_of)));
@ -685,6 +685,8 @@ fun meta_args_2_string thy ((((lab, _), cid_opt), attr_list) : meta_args_t) =
end
val semi = Scan.option (Parse.$$$ ";");
val is_improper = not o (Token.is_proper orf Token.is_begin_ignore orf Token.is_end_ignore);
val improper = Scan.many is_improper;
val attribute =
Parse.position Parse.const
@ -697,19 +699,21 @@ val attribute_upd : (((string * Position.T) * string) * string) parser =
val reference =
Parse.position Parse.name
-- Scan.option (Parse.$$$ "::" |-- Parse.!!! (Parse.position Parse.name));
-- Scan.option (Parse.$$$ "::" -- improper |-- Parse.!!! (Parse.position Parse.name));
val attributes =
(Parse.$$$ "["
(Parse.$$$ "["
-- improper
|-- (reference --
(Scan.optional(Parse.$$$ "," |-- (Parse.enum "," attribute))) []))
(Scan.optional(Parse.$$$ "," -- improper |-- (Parse.enum "," ( attribute)))) []))
--| Parse.$$$ "]" : meta_args_t parser
val attributes_upd =
(Parse.$$$ "["
-- improper
|-- (reference --
(Scan.optional(Parse.$$$ "," |-- (Parse.enum "," attribute_upd))) []))
(Scan.optional(Parse.$$$ "," -- improper |-- (Parse.enum "," attribute_upd))) []))
--| Parse.$$$ "]"
@ -1277,6 +1281,7 @@ text*[sdfg] {* fg @{thm refl}*}
text*[xxxy] {* dd @{docitem_ref \<open>sdfg\<close>} @{thm refl}*}
(*
ML\<open>
writeln (DOF_core.toStringDocItemCommand "section" "scholarly_paper.introduction" []);
writeln (DOF_core.toStringDocItemLabel "scholarly_paper.introduction" []);
@ -1284,4 +1289,5 @@ writeln (DOF_core.toStringDocItemRef "scholarly_paper.introduction" "XX" []);
(DOF_core.write_ontology_latex_sty_template @{theory})
\<close>
*)
end

View File

@ -4,10 +4,14 @@ theory IsaDofApplications
begin
(*>*)
title*[tit::title]\<open>Using the Isabelle Ontology Framework\<close>
subtitle*[stit::subtitle]\<open>Linking the Formal with the Informal\<close>
title*[
tit::
title]\<open>Using the Isabelle Ontology Framework\<close>
subtitle*[stit::subtitle]
\<open>Linking the Formal with the Informal\<close>
text*[adb::author,email="''a.brucker@sheffield.ac.uk''",orcid="''0000-0002-6355-1200''",affiliation="''The University of Sheffield, Sheffield, UK''"]\<open>Achim D. Brucker\<close>
text*[adb::author,
email="''a.brucker@sheffield.ac.uk''",orcid="''0000-0002-6355-1200''",affiliation="''The University of Sheffield, Sheffield, UK''"]\<open>Achim D. Brucker\<close>
text*[idir::author,email="''idir.aitsadoune@centralesupelec.fr''",affiliation="''CentraleSupelec, Paris, France''"]\<open>Idir Ait-Sadoune\<close>
text*[paolo::author,email="''paolo.crisafulli@irt-systemx.fr''",affiliation="''IRT-SystemX, Paris, France''"]\<open>Paolo Crisafulli\<close>
text*[bu::author,email="''wolff@lri.fr''",affiliation="''Universit\\'e Paris-Sud, Paris, France''"]\<open>Burkhart Wolff\<close>

View File

@ -49,7 +49,7 @@ doc_class bibliography =
style :: "string option" <= "Some ''LNCS''"
text{* Besides subtyping, there is another relation between
doc_classes: a class can be a \emph{monitor} to other ones,
doc_classes: a class can be a \<^emph>\<open>monitor\<close> to other ones,
which is expressed by occurrence in the where clause.
While sub-classing refers to data-inheritance of attributes,
a monitor captures structural constraints -- the order --
@ -65,13 +65,13 @@ text{* Besides subtyping, there is another relation between
Monitors can be nested.
Classes neither directly or via inheritance indirectly
mentioned in the monitor are \emph{independent} from
mentioned in the monitor are \<^emph>\<open>independent\<close> from
a monitor and may occur freely.
*}
-- \<open>underlying idea: capture the essence of a monitor class as trace.
trace would be `predefined id` like `main` in C. \<close>
trace would be \<^emph>\<open>`predefined id`\<close> like \<^verbatim>\<open>main\<close> in C. \<close>
text{* @{cite bla} *}
doc_class article =
@ -88,8 +88,8 @@ doc_class article =
\<lbrace>technical || example\<rbrace>\<^sup>+ ~~
conclusion ~~
bibliography)"
generate_template_sty
(*
gen_sty_template
*)
end