]> matita.cs.unibo.it Git - helm.git/commitdiff
web site update
authorFerruccio Guidi <fguidi@maelstrom.helm.cs.unibo.it>
Wed, 11 Dec 2019 22:40:24 +0000 (23:40 +0100)
committerFerruccio Guidi <fguidi@maelstrom.helm.cs.unibo.it>
Wed, 11 Dec 2019 22:40:24 +0000 (23:40 +0100)
+ updated automation for the generated LDDL web site
+ minor improvements

helm/www/lambdadelta/Makefile
helm/www/lambdadelta/bin/index/index.ml
helm/www/lambdadelta/images/bronze-03B4.png [new file with mode: 0644]
helm/www/lambdadelta/web/home/home.ldw.xml
helm/www/lambdadelta/xslt/ld_web_root.xsl
helm/www/lambdadelta/xslt/lddl_root.xsl

index 51ecbd1a5698e532571a967c8d09c4669c650403..df4a4b51942408d74a716fc85918d5464706eb97 100644 (file)
@@ -1,3 +1,4 @@
+SHELL := $(shell which bash)
 H=@
 
 TAGS = www up-html up-css up-images up-download \
@@ -17,6 +18,7 @@ XMLDIR     = xml
 SRCDIR     = web/home
 LDDLDIR    = web/lddl
 XHTBLDIR   = bin/xhtbl
+INDEXDIR   = bin/index
 HTMLDIR    = html/lddl
 JEDDIR     = $(HOME)/mps/jed
 BIBDIR     = $(HOME)/texmf/bibtex/bib
@@ -32,6 +34,9 @@ RXMLDIR  = $(RHOMEDIR)/xml
 RDOWNDIR = $(RHOMEDIR)/download
 RSTATICDIR = /projects/helm/public_html/lambda-delta/static
 
+DLHTMLSTAMP = $(ETCDIR)/lddl_html.stamp
+DLHTMLIXSTAMP = $(ETCDIR)/lddl_html_ix.stamp
+
 SLS     = helena.sl automath.sl
 BIB     = lambdadelta.bib
 CONTRIB = lambdadelta_2.tar.gz
@@ -52,6 +57,7 @@ MATITA = matita/root matita/grundlagen_2.ma
 XMLLINT = xmllint --noout
 XSLT    = xsltproc
 XHTBL   = $(XHTBLDIR)/xhtbl.native
+INDEX   = $(INDEXDIR)/index.native
 
 XHTBLOPTS =
 
@@ -94,7 +100,6 @@ ifeq ($(MAKECMDGOALS), www)
 endif
 
 all:
-       @echo $(HTMLS)
 
 www: $(HTMLS) $(TBLS) $(XHTBL)
 
@@ -121,13 +126,45 @@ test-html:
 
 html: $(ETCDIR)/make_html.sh
        @echo "  MAKE */*.ld"
-       $(H). $<
+#      $(H). $<
+       $(H)$(INDEX) -i $(LDDLDIR) -o $(HTMLDIR) .
+
+test: $(DLHTMLIXSTAMP)
+
+$(DLHTMLSTAMP):
+       $(H)for LDW in `find $(LDDLDIR) -name *.ldw.xml`; do \
+       TMP=$${LDW/web/html};HTML=$${TMP/ldw.xml/html}; \
+       echo "  XSLT $$LDW"; \
+       mkdir -p $${HTML%/*}; \
+       $(XSLT) $(XSLT_OUT) $$HTML $(XSLT_XSL) $(XSLTDIR)/ld_web.xsl $(XSLT_IN) $$LDW; \
+       done
+       $(H)touch $@
+       $(H)touch $(DLHTMLIXSTAMP)
+
+$(DLHTMLIXSTAMP):
+       $(H)for LDW in `find $(LDDLDIR) -name index.ldw.xml`; do \
+       TMP=$${LDW/web/html};HTML=$${TMP/ldw.xml/html}; \
+       echo "  XSLT $$LDW"; \
+       mkdir -p $${HTML%/*}; \
+       $(XSLT) $(XSLT_OUT) $$HTML $(XSLT_XSL) $(XSLTDIR)/ld_web.xsl $(XSLT_IN) $$LDW; \
+       done
+       $(H)touch $@
+
+install-html: $(ETCDIR)/html_lddl.tar.bz2
+
+$(ETCDIR)/html_lddl.tar.bz2:
+       @echo "  INSTALL html"
+       $(H)tar -cjf $@ $(HTMLDIR)
+       $(H)scp $@ $(RHOMEDIR)/$(ETCDIR)
+       $(H)ssh $(REMOTE) "cd $(RDIR) && tar -xjf $@"
+
+install-html-ix: $(ETCDIR)/html_lddl_ix.tar.bz2
 
-install-html $(DOWNDIR)/static_lddl.tar.bz2: $(ETCDIR)/exclude.txt $(ETCDIR)/make_html.sh
+$(ETCDIR)/html_lddl_ix.tar.bz2:
        @echo "  INSTALL html"
-       $(H)tar -cjf $(DOWNDIR)/static_lddl.tar.bz2 -C static -X $< lddl
-       $(H)scp $(DOWNDIR)/static_lddl.tar.bz2 $(RDOWNDIR)
-       $(H)ssh $(REMOTE) "cd $(RSTATICDIR) && tar -xjf ../../lambdadelta/download/static_lddl.tar.bz2
+#      $(H)tar -cjf $@ `find $(HTMLDIR) -name index.html`
+       $(H)scp $@ $(RHOMEDIR)/$(ETCDIR)
+       $(H)ssh $(REMOTE) "cd $(RDIR) && tar -xjf $@"
 
 install-jed: $(SLS:%=$(JEDDIR)/%)
        @echo "  INSTALL $(SLS)"
@@ -180,9 +217,9 @@ up-download:
 
 %.ld:
        @echo "  XSLT $@"
-       $(H)mkdir -p $(LDDLDIR)/$(@D)
-       $(H)$(XSLT) --novalid $(XSLT_OUT) $(LDDLDIR)/$@.ldw.xml $(XSLT_XSL) $(XSLTDIR)/lddl.xsl $(XSLT_IN) $(XMLDIR)/$@.xml
-       $(H)mkdir -p $(HTMLDIR)/$(@D)
-       $(H)$(XSLT) $(XSLT_OUT) $(HTMLDIR)/$@.html $(XSLT_XSL) $(XSLTDIR)/ld_web.xsl $(XSLT_IN) $(LDDLDIR)/$@.ldw.xml
+#      $(H)mkdir -p $(LDDLDIR)/$(@D)
+#      $(H)$(XSLT) --novalid $(XSLT_OUT) $(LDDLDIR)/$@.ldw.xml $(XSLT_XSL) $(XSLTDIR)/lddl.xsl $(XSLT_IN) $(XMLDIR)/$@.xml
+#      $(H)mkdir -p $(HTMLDIR)/$(@D)
+#      $(H)$(XSLT) $(XSLT_OUT) $(HTMLDIR)/$@.html $(XSLT_XSL) $(XSLTDIR)/ld_web.xsl $(XSLT_IN) $(LDDLDIR)/$@.ldw.xml
 
 .PHONY: $(TAGS)
index c7fd48d908985101a5f690fb35bd36cfc0d60a06..c22e290acd73f9befa4322f511ea591ec16866db 100644 (file)
@@ -2,48 +2,119 @@ module KF = Filename
 module KP = Printf
 module KU = Unix
 
-let out_entry dname och dirs name =
-  let fname = KF.concat dname name in
-  let stats = KU.lstat fname in
+type status = {
+(* base directory *)
+  bd: string;
+(* input prefix *)
+  ip: string;
+(* output prefix *)
+  op: string;
+(* current path *)
+  cp: string list
+}
+
+let initial_status = {
+  bd = ""; ip = ""; op = "";
+  cp = [];
+}
+
+let imp_st = ref initial_status
+
+let i_ext = ".ld.ldw.xml"
+let o_ext = ".ld.html"
+
+let concats l =
+  List.fold_left KF.concat "" l
+
+let concat st dname = {st with
+  ip = KF.concat st.ip dname; op = KF.concat st.op dname;
+}
+
+let normalize dname =
+  if dname = KF.current_dir_name then "" else dname
+
+let mk_rlink s_to s_body =
+  KP.sprintf "<rlink to=\"%s\">%s</rlink>" s_to s_body
+
+let out_entry st dname och dirs name =
+  let iname = concats [st.bd; st.ip; dname; name] in
+  let stats = KU.lstat iname in
   match stats.KU.st_kind with
-  | KU.S_REG -> 
-    KP.fprintf och "    <rlink to=\"%s\">%s</rlink>\n" fname name;
+  | KU.S_REG when KF.check_suffix name i_ext ->
+    let base = KF.chop_suffix name i_ext in 
+    let oname = concats [st.bd; st.op; dname; base^o_ext] in
+    KP.fprintf och "    <line class=\"global emph\">&#x1F5CF; <rlink to=\"%s\">%s.ld</rlink></line>\n" oname base;
     dirs
-  | KU.S_DIR -> name :: dirs
-  | _        -> dirs
+  | KU.S_DIR ->
+    let oname = concats [st.bd; st.op; dname; name] in
+    KP.fprintf och "    <line class=\"alpha emph\">&#x1F5C1; <rlink to=\"%s\">%s/</rlink></line>\n" oname name;
+    name :: dirs
+  | _        ->
+    dirs
+
+let mk_path st och =
+  let path = String.concat "/" (List.rev st.cp) in
+  KP.fprintf och "    Contents of %s/\n" path
 
-let list_dir dname och =
-  let dir = Sys.readdir dname in
+let list_dir st dname och =
+  let iname = concats [st.bd; st.ip; dname] in
+  let dir = Sys.readdir iname in
   Array.sort String.compare dir;
-  Array.fold_left (out_entry dname och) [] dir
+  Array.fold_left (out_entry st dname och) [] dir
 
-let out_index dname och =
+let out_index st dname och =
   KP.fprintf och "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
-  KP.fprintf och "<page description=\"\\lambda\\delta home page\"\n";
+  KP.fprintf och "<page xmlns=\"http://lambdadelta.info/\"\n";
+  KP.fprintf och "      description=\"\\lambda\\delta home page\"\n";
   KP.fprintf och "      title=\"\\lambda\\delta home page\"\n";
   KP.fprintf och "      head=\"λδ digital library (LDDL)\"\n";
   KP.fprintf och ">\n";
   KP.fprintf och "  <sitemap name=\"sitemap\"/>\n";
   KP.fprintf och "  <section5 name=\"index\">Index</section5>\n";
-  KP.fprintf och "  <subsection name=\"current\">\n";
-
+  KP.fprintf och "  <subsection name=\"path\">\n";
+  mk_path st och;
   KP.fprintf och "  </subsection>\n";
   KP.fprintf och "  <body>\n";
-  let dirs = list_dir dname och in
+  let dirs = list_dir st dname och in
   KP.fprintf och "  </body>\n";
-  KP.fprintf och "  <footer><helena-label/></footer>\n";
+  KP.fprintf och "  <footer><img label=\"helena\"/></footer>\n";
   KP.fprintf och "</page>\n";
   dirs
 
-let rec out_dir dname =
-  let och = open_out (KF.concat dname "index.ldw.xml") in
-  let dirs = out_index dname och in
+let rec out_dir st dname =
+  let s_to, s_body =
+    if dname = ""
+    then concats [st.bd; st.op], "ld:" 
+    else concats [st.bd; st.op; dname], dname
+  in
+  let st = {st with cp = mk_rlink s_to s_body :: st.cp} in
+  let oname = concats [st.bd; st.ip; dname; "index.ldw.xml"] in
+  let och = open_out oname in
+  let dirs = out_index st dname och in
   close_out och;
-  let map name = out_dir (KF.concat dname name) in
-  List.iter map dirs
+  let map st = out_dir (concat st dname) in
+  List.iter (map st) dirs
+
+let help_b = "<dir>  Set this base directory"
+let help_i = "<dir>  Set this input prefix"
+let help_o = "<dir>  Set this output prefix"
+let help = "Usage: index [ -bio <dir> | <dir> ]*"
+
+let set_b bd =
+  imp_st := {!imp_st with bd = normalize bd}
+
+let set_i ip =
+  imp_st := {!imp_st with ip = normalize ip}
+
+let set_o op =
+  imp_st := {!imp_st with op = normalize op}
 
-let help = "Usage: index [ <dir> ]*"
+let process dname =
+  out_dir !imp_st (normalize dname)
 
 let main =
   Arg.parse [
-  ] out_dir help
+    "-b", Arg.String set_b, help_b;
+    "-i", Arg.String set_i, help_i;
+    "-o", Arg.String set_o, help_o;
+  ] process help
diff --git a/helm/www/lambdadelta/images/bronze-03B4.png b/helm/www/lambdadelta/images/bronze-03B4.png
new file mode 100644 (file)
index 0000000..d65392f
Binary files /dev/null and b/helm/www/lambdadelta/images/bronze-03B4.png differ
index 5625cdb8c6af5f584329518dad93c446875cb103..cd7c4121b33746a37dda80f6661fa1922a32e59e 100644 (file)
@@ -22,7 +22,7 @@
       as a set of machine-checked <rlink to="html/specification.html">digital specifications</rlink>.
    </body>
    <topitem name="current">
-      <notice class="alpha" text="Current version:"/>
+      <notice class="alpha" text="Current version: "/>
       <rlink to="download/lambdadelta_2B.tar.bz2">λδ-2B for for Matita 0.99.4</rlink>
       (released: <notice class="gamma" notice="2019-11"/>).
       <rlink to="html/documentation.html#ldJ2a">Documentation (J2a)</rlink>.
    </body>
    <body>
       <notice class="alpha" text="Notice:"/>
-      to view this site correctly, please select a font
-      with <link to="http://www.unicode.org/">Unicode</link> support.
+      to view this site correctly, please install fonts
+      supporting <link to="http://www.unicode.org/">Unicode 7.0</link> (June 2014).
+      For instance <notice class="alpha" text="Unifont"/>
+      or <notice class="alpha" text="Symbola"/>.
    </body>
    <body>
       <ucs-bronze char="03BB"/>
+      <ucs-bronze char="03B4"/>
    </body>
 
 <!-- ===================================================================== -->
index f5cdfbed0464e7c055d161de1d28682471a90a11..d1faf246e920198a5c470110b7edf6168b39d67e 100644 (file)
    <li class="{@class}"><xsl:apply-templates/></li>
 </xsl:template>
 
+<xsl:template match="ld:line">
+  <div class="{@class}">
+    <xsl:choose>
+      <xsl:when test="@of"><xsl:value-of select="@of"/></xsl:when>
+      <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
+    </xsl:choose>
+  </div>
+</xsl:template>
+
 <xsl:template match="ld:style">
   <span class="{@class}">
     <xsl:choose>
index 5645dc7e80a99b0f7ccad8890556420663aa2cac..43aa1656e4d9e5ff36854c16cc5f234d7e9a5611 100644 (file)
@@ -23,7 +23,7 @@
    >
       <sitemap name="sitemap"/>
       <xsl:apply-templates select="*"/>
-      <footer><helena-label/></footer>         
+      <footer><img label="helena"/></footer>
    </page>
 </xsl:template>