From b73e5ae2124786c0ae6d834b1be8ed0cecc2934e Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Wed, 14 Mar 2018 10:52:07 +0100
Subject: [PATCH] add acsl.xml for pandoc highlighting + better Makefile

---
 src/plugins/markdown-report/Makefile       | 16 +++++-
 src/plugins/markdown-report/share/acsl.xml | 62 ++++++++++++++++++++++
 2 files changed, 76 insertions(+), 2 deletions(-)
 create mode 100644 src/plugins/markdown-report/share/acsl.xml

diff --git a/src/plugins/markdown-report/Makefile b/src/plugins/markdown-report/Makefile
index 14c4e4f4530..b1b5492f119 100644
--- a/src/plugins/markdown-report/Makefile
+++ b/src/plugins/markdown-report/Makefile
@@ -1,12 +1,19 @@
-FRAMAC_SHARE:=$(shell frama-c -print-share-path)
+ifndef FRAMAC_SHARE
+  FRAMAC_SHARE:=$(shell frama-c -print-share-path)
+endif
 
 PLUGIN_NAME:=Report_markdown
 PLUGIN_CMO:=markdown mdr_params parse_remarks eva_coverage md_gen
 PLUGIN_NO_TEST:=true
+PLUGIN_DISTRIB_EXTERNAL:=share/acsl.xml
 
 include $(FRAMAC_SHARE)/Makefile.dynamic
 
-Report_markdown.mli: mdr_params.mli markdown.mli md_gen.mli Makefile
+$(Report_markdown_DIR)/Report_markdown.mli: \
+  $(Report_markdown_DIR)/mdr_params.mli \
+  $(Report_markdown_DIR)/markdown.mli \
+  $(Report_markdown_DIR)/md_gen.mli \
+  $(Report_markdown_DIR)/Makefile
 	echo "module Mdr_params: sig" > $@
 	cat mdr_params.mli >> $@
 	echo "end" >> $@
@@ -16,3 +23,8 @@ Report_markdown.mli: mdr_params.mli markdown.mli md_gen.mli Makefile
 	echo "module Md_gen: sig" >> $@
 	cat md_gen.mli >> $@
 	echo "end" >> $@
+
+install::
+	$(PRINT_CP) $(FRAMAC_DATADIR)/Report_markdown
+	$(MKDIR) $(FRAMAC_DATADIR)/Report_markdown
+	$(CP) share/acsl.xml $(FRAMAC_DATADIR)/Report_markdown
diff --git a/src/plugins/markdown-report/share/acsl.xml b/src/plugins/markdown-report/share/acsl.xml
new file mode 100644
index 00000000000..0cd467cd748
--- /dev/null
+++ b/src/plugins/markdown-report/share/acsl.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<language name="ACSL" version="1" extensions="*.acsl"
+          section="Sources" kateversion="2.4">
+<highlighting>
+<list name="keywords">
+<item>allocates</item>
+<item>assert</item>
+<item>assigns</item>
+<item>assumes</item>
+<item>axiom</item>
+<item>axiomatic</item>
+<item>behavior</item>
+<item>behaviors</item>
+<item>boolean</item>
+<item>breaks</item>
+<item>complete</item>
+<item>continues</item>
+<item>data</item>
+<item>decreases</item>
+<item>disjoint</item>
+<item>ensures</item>
+<item>exit_behavior</item>
+<item>frees</item>
+<item>ghost</item>
+<item>global</item>
+<item>inductive</item>
+<item>integer</item>
+<item>invariant</item>
+<item>lemma</item>
+<item>logic</item>
+<item>loop</item>
+<item>model</item>
+<item>predicate</item>
+<item>reads</item>
+<item>real</item>
+<item>requires</item>
+<item>returns</item>
+<item>sizeof</item>
+<item>strong</item>
+<item>struct</item>
+<item>terminates</item>
+<item>type</item>
+<item>union</item>
+<item>variant</item>
+</list>
+<contexts>
+  <context attribute="Normal Text" lineEndContext="#pop" name="Normal Text">
+    <keyword attribute="Keyword" context="#stay" String="keywords"/>
+    <DetectChar attribute="Keyword" context="bskeyword" char="\"/>
+  </context>
+  <context name="bskeyword" attribute="Keyword" lineEndContext="#pop">
+    <DetectIdentifier attribute="Keyword" context="#pop" />
+  </context>
+</contexts>
+<itemDatas>
+  <itemData name="Normal Text" defStyleNum="dsNormal"/>
+  <itemData name="Keyword" defStyleNum="dsKeyword"/>
+</itemDatas>
+<general>
+</general>
+</highlighting>
+</language>
-- 
GitLab