From: Alistair Thomas Date: Thu, 19 Jan 2017 20:57:20 +0000 (+0000) Subject: manual: Switch to using DocBook from wiki.gnome.org as source X-Git-Tag: 0.35.6~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8c5ca22b4ad931f9b2ac459768831168f01dda9;p=thirdparty%2Fvala.git manual: Switch to using DocBook from wiki.gnome.org as source https://bugzilla.gnome.org/show_bug.cgi?id=779090 --- diff --git a/configure.ac b/configure.ac index 5e13182df..2c90ba41f 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ AC_PROG_CC AM_PROG_CC_C_O AC_PROG_LN_S AC_PROG_INSTALL +AC_PROG_MKDIR_P LT_PREREQ([2.2.6]) LT_INIT([disable-static]) diff --git a/doc/manual/.gitignore b/doc/manual/.gitignore index cccbd853e..34a65b647 100644 --- a/doc/manual/.gitignore +++ b/doc/manual/.gitignore @@ -1,2 +1,2 @@ -*.html -vala*.devhelp2 +html/ +devhelp/ diff --git a/doc/manual/Makefile.am b/doc/manual/Makefile.am index c980cf6a0..ffa87f996 100644 --- a/doc/manual/Makefile.am +++ b/doc/manual/Makefile.am @@ -1,69 +1,66 @@ NULL = -book_name=vala@PACKAGE_SUFFIX@ +BOOK_NAME = vala@PACKAGE_SUFFIX@ -bookdir=$(datadir)/devhelp/books/$(book_name) - -chapter_data = \ - overview.html \ - types.html \ - expressions.html \ - statements.html \ - namespaces.html \ - methods.html \ - classes.html \ - structs.html \ - interfaces.html \ - enums.html \ - delegates.html \ - exceptions.html \ - attributes.html \ - $(NULL) - -built_data = \ - index.html \ - $(chapter_data) \ - $(book_name).devhelp2 \ - $(NULL) +bookdir = $(datadir)/devhelp/books/$(BOOK_NAME) if HAVE_XSLTPROC -book_DATA = \ - $(built_data) \ - default.css \ +nobase_book_DATA = \ + devhelp/* \ $(NULL) endif -index.html: $(book_sources) xhtml.xsl - $(AM_V_GEN)$(XSLTPROC) --xinclude $(srcdir)/xhtml.xsl $(srcdir)/index.xml > index.html - -$(chapter_data): index.html +$(builddir)/devhelp/*: devhelp +devhelp: manual.xml devhelp.xsl xhtml.xsl + @$(MKDIR_P) $@ + $(AM_V_GEN)$(XSLTPROC) \ + --xinclude $(srcdir)/devhelp.xsl \ + $(srcdir)/manual.xml \ + > $(builddir)/devhelp/$(BOOK_NAME).devhelp2 + @$(XSLTPROC) \ + --xinclude \ + --stringparam outdir $@ \ + --output $@/index.html \ + $(srcdir)/xhtml.xsl \ + $(srcdir)/manual.xml + @cp $(srcdir)/default.css $@ -$(book_name).devhelp2: $(book_sources) devhelp.xsl - $(AM_V_GEN)$(XSLTPROC) --xinclude $(srcdir)/devhelp.xsl $(srcdir)/index.xml > $(book_name).devhelp2 +html: manual.xml xhtml.xsl + @$(MKDIR_P) $@ + $(AM_V_GEN)$(XSLTPROC) \ + --xinclude \ + --stringparam outdir $@ \ + --output $@/index.html \ + $(srcdir)/xhtml.xsl \ + $(srcdir)/manual.xml + @cp $(srcdir)/default.css $@ -book_sources = \ - index.xml \ - overview.xml \ - types.xml \ - expressions.xml \ - statements.xml \ - namespaces.xml \ - methods.xml \ - classes.xml \ - structs.xml \ - interfaces.xml \ - enums.xml \ - delegates.xml \ - exceptions.xml \ - attributes.xml \ - $(NULL) - -MOSTLYCLEANFILES = $(built_data) +mostlyclean-local: + rm -rf devhelp + rm -rf html EXTRA_DIST = \ - $(book_sources) \ + common.xsl \ default.css \ - xhtml.xsl \ devhelp.xsl \ + manual.xml \ + xhtml.xsl \ $(NULL) +MANUAL_DOCBOOK_URL=https://wiki.gnome.org/Projects/Vala/Manual/Export?action=format\&mimetype=text/docbook + +$(srcdir)/manual.xml: + @echo "Generating $@ from $(MANUAL_DOCBOOK_URL)" + @curl --silent $(MANUAL_DOCBOOK_URL) | \ + sed -e 's/.*<\/articleinfo>//g' | \ + sed -e 's/
/\n\n
/g' | \ + sed -e 's/<\/section>/\n<\/section>/g' | \ + sed -e 's//\n<title>/g' | \ + sed -e 's/<para>/\n<para>/g' \ + > $@ + +update-manual-from-wiki: + @rm $(srcdir)/manual.xml + $(MAKE) $(AM_MAKEFLAGS) manual.xml + $(MAKE) $(AM_MAKEFLAGS) + diff --git a/doc/manual/common.xsl b/doc/manual/common.xsl new file mode 100644 index 000000000..68cf4bf56 --- /dev/null +++ b/doc/manual/common.xsl @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0" + xmlns:str="http://exslt.org/strings" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + exclude-result-prefixes="str" +> + + <xsl:template name="normalizepath"> + <xsl:param name="title"/> + <xsl:variable name="space-to-underscore" select="str:replace($title, ' ', '_')"/> + <xsl:variable name="open-parens-to-underscore" select="str:replace($space-to-underscore, '(', '_')"/> + <xsl:value-of select="str:replace($open-parens-to-underscore, ')', '_')"/> + </xsl:template> + + <xsl:template name="linkto"> + <xsl:param name="page"/> + <xsl:param name="subpage"/> + <xsl:param name="title"/> + <xsl:variable name="path"> + <xsl:call-template name="normalizepath"> + <xsl:with-param name="title" select="$page"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="fragment"> + <xsl:call-template name="normalizepath"> + <xsl:with-param name="title" select="$subpage"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$fragment=''"> + <a href="{$path}.html"><xsl:value-of select="$title"/></a> + </xsl:when> + <xsl:otherwise> + <a href="{$path}.html#{$fragment}"><xsl:value-of select="$title"/></a> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/doc/manual/default.css b/doc/manual/default.css index 9294f2653..ee76427f9 100644 --- a/doc/manual/default.css +++ b/doc/manual/default.css @@ -1,13 +1,22 @@ body { background-color: white; - font-family: sans-serif; + font-family: cantarell, sans-serif; + text-align: justify; margin-top: 2.8em; + max-width: 35em; } h1, h2, h3, h4 { color: #005a9c; + margin: 1.5em 0 0 0; } +h3 { border-top: solid 0.5em #eee; } + +h4 { border-top: solid 0.2em #eee; } + +p { margin: 0 0 1em 0; } + a:link, a:visited, a:hover, a:active { color: #005a9c; text-decoration: none; @@ -15,7 +24,9 @@ a:link, a:visited, a:hover, a:active { .toc { font-weight: bold; - font-size: larger; + font-size: 120%; + line-height: 1.8; + max-width: 19em; } .toc li { @@ -23,13 +34,22 @@ a:link, a:visited, a:hover, a:active { } .toc li li { - font-size: smaller; + font-size: 80%; +} + +.toc a { + display:block; + border-radius: 0.4em; + padding-left: 0.4em; } -h3 a { +.toc a:hover, .toc a:focus { + background-color: #ddd; +} + +h3 { /* ensure anchors don't vanish below the fixed header */ - position: relative; - top: -2.8em; + padding-top: 1.4em; } .header { @@ -60,17 +80,49 @@ div.note p, div.note h4 { pre { background-color: #eee; border: 1px solid black; + border-radius: 4px; padding: .5em 1em; - margin: 0 2em 1em 2em; + margin: 0 0 1em 0; } -blockquote { +.o-box { padding: 1.2em; + margin: 0 0 1em 0; + line-height: 1.5; +} +.c-program { background-color: #f5f5f5; + border: 2px solid #ca8; + border-radius: 4px; + font-family: monospace; + white-space: pre-wrap; +} +.c-program-type { color: #533; } +.c-program-token { color: #000; + font-weight: bold; +} +.c-program-methodname { color: #520; font-style: italic; - white-space: pre; +} +.c-program-phrase { color: #161; } + +.c-informaltable { border: solid 2px #ccc; + border-radius: 4px; +} +.c-informaltable td { border-bottom: solid 1px #ccc; + border-right: solid 1px #ccc; +} +.c-informaltable td:last-child { border-right: none; } +.c-informaltable tr:last-child td { border-bottom: none; } +.c-informaltable tr:nth-child(even) { background-color: #f5f5f5; } + +.c-rules { border: solid 2px #729fcf; + border-radius: 4px; + background-color: #f5f5f5; + white-space: pre-wrap; } blockquote span.literal { font-family: monospace; - font-style: normal; font-weight: bold; + font-size: 110%; + padding-right: 0.5em; } diff --git a/doc/manual/devhelp.xsl b/doc/manual/devhelp.xsl index 735ff18be..3a1db148f 100644 --- a/doc/manual/devhelp.xsl +++ b/doc/manual/devhelp.xsl @@ -1,18 +1,42 @@ <?xml version="1.0"?> -<xsl:stylesheet xmlns="http://www.devhelp.net/book" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"> - <xsl:output method="xml" indent="yes"/> - <xsl:template match="/"> - <book title="{//title/text()}" link="index.html" author="" name="vala" version="2"> - <chapters> - <xsl:for-each select="//body/section"> - <sub name="{h/text()}" link="{@id}.html"> - <xsl:for-each select="section"> - <sub name="{h/text()}" link="{../@id}.html#{@id}"/> - </xsl:for-each> - </sub> - </xsl:for-each> - </chapters> - </book> - </xsl:template> +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.1" + xmlns="http://www.devhelp.net/book" + > + + <xsl:import href="common.xsl"/> + + <xsl:output + method="xml" + indent="yes" + /> + + <xsl:template match="/"> + <book title="{/article/section/title/text()}" link="index.html" author="" name="vala" version="2"> + <chapters> + <xsl:apply-templates select="/article/section/section"/> + </chapters> + </book> + </xsl:template> + + <xsl:template match="/article/section/section"> + <xsl:variable name="path"> + <xsl:call-template name="normalizepath"> + <xsl:with-param name="title" select="title"/> + </xsl:call-template> + </xsl:variable> + <sub name="{title/text()}" link="{$path}.html"> + <xsl:for-each select="section"> + <xsl:variable name="fragment"> + <xsl:call-template name="normalizepath"> + <xsl:with-param name="title" select="title"/> + </xsl:call-template> + </xsl:variable> + <sub name="{title/text()}" link="{$path}.html#{$fragment}"/> + </xsl:for-each> + </sub> + </xsl:template> + </xsl:stylesheet> diff --git a/doc/manual/xhtml.xsl b/doc/manual/xhtml.xsl index 607fbaccd..43420bc32 100644 --- a/doc/manual/xhtml.xsl +++ b/doc/manual/xhtml.xsl @@ -1,107 +1,297 @@ <?xml version="1.0"?> -<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"> - <xsl:output method="xml" indent="yes" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/> - <xsl:strip-space elements="blockquote/l"/> - <xsl:template match="/"> - <xsl:apply-templates select="html"/> - </xsl:template> - <xsl:template match="html"> - <html><xsl:apply-templates select="head|body"/></html> - </xsl:template> - <xsl:template match="head"> - <head> - <xsl:apply-templates select="title"/> - <link rel="stylesheet" type="text/css" href="default.css"/> - </head> - </xsl:template> - <xsl:template match="title"> - <title><xsl:value-of select="."/> - - - -
- -
- -
    - -
  • - - -
      - -
    • -
      -
    -
    -
  • -
    -
- -
- -

-
- - - - - <xsl:value-of select="h/text()"/> - <xsl:value-of select="//title/text()"/> - - - -
- -
- - - -
-
- -

-
- - - - -

-
- - - - -

-
- -
-
- -

-
- -

-
- - - - -
-
- -
-
- - - - -
-
- -
-
- -
  • -
    - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + +
      + +
    • + + + + + +
    • +
      +
    +
    + + + +
    +
    + + + <!DOCTYPE html> + + + + + <meta charset="UTF-8" /> + + + + + + + + + + <xsl:value-of select="text()"/> - <xsl:value-of select="/article/section/title"/> + + + + + + + + +
    + +
    +

    +
    + + + +
      + +
    • + + + + + + +
        + +
      • + + + + + +
      • +
        +
      +
      +
    • +
      +
    + +
    + + +

    +
    + + + + + + + + + + + + + +

    +
    + + + + + + + + + + + +

     

    +
    + + +

    +
    + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + \n + + + + \n\n + + + + +
    +
    + + +
  • +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +