[gnome-user-docs] Add schematron checks to CI for gnome-help & system-admin-guide



commit 061bcc9af91d0c2f2c6867eec6cbb1ae54ccc552
Author: Petr Kovar <pkovar redhat com>
Date:   Sun Aug 4 21:32:35 2019 +0200

    Add schematron checks to CI for gnome-help & system-admin-guide
    
    Wrap yelp-check tests in the shell script since they don't emit
    desired exit codes.
    
    Also, remove unused a11y-feature.page.tmpl.

 .gitlab-ci.yml                              |  5 +---
 check.sh                                    | 27 +++++++++++++++++++
 gnome-help/C/a11y-feature.page.tmpl         | 42 -----------------------------
 gnome-help/C/gnome-help.sct                 |  6 +++--
 gnome-help/C/schematron.sh                  |  1 -
 system-admin-guide/C/system-admin-guide.sct | 33 +++++++++++++++++++++++
 6 files changed, 65 insertions(+), 49 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 11c1415a..227e8eb7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,10 +3,7 @@ build-fedora:
   before_script:
     - dnf install -y git autoconf automake make gettext itstool libxslt yelp-tools
   script:
-    - yelp-check ids gnome-help/C system-admin-guide/C
-    - yelp-check links gnome-help/C system-admin-guide/C
-    - yelp-check orphans gnome-help/C system-admin-guide/C
-    - yelp-check validate gnome-help/C system-admin-guide/C
+    - ./check.sh
     - ./autogen.sh ITSTOOL="/usr/bin/itstool --strict"
     - make
     - make check
diff --git a/check.sh b/check.sh
new file mode 100755
index 00000000..d4154ba0
--- /dev/null
+++ b/check.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+xmllint --noout --schematron gnome-help/C/gnome-help.sct gnome-help/C/*.page 2>&1 | \
+grep -v validates | \
+grep . && echo 'schematron for gnome-help: FAIL' && exit 1 || \
+echo 'schematron for gnome-help: PASS'
+
+xmllint --noout --schematron system-admin-guide/C/system-admin-guide.sct system-admin-guide/C/*.page 2>&1 | \
+grep -v validates | \
+grep . && echo 'schematron for system-admin-guide: FAIL' && exit 1 || \
+echo 'schematron for system-admin-guide: PASS'
+
+yelp-check ids gnome-help/C system-admin-guide/C | \
+grep . && echo 'yelp-check ids: FAIL' && exit 1 || \
+echo 'yelp-check ids: PASS'
+
+yelp-check links gnome-help/C system-admin-guide/C | \
+grep . && echo 'yelp-check links: FAIL' && exit 1 || \
+echo 'yelp-check links: PASS'
+
+yelp-check orphans gnome-help/C system-admin-guide/C | \
+grep . && echo 'yelp-check orphans: FAIL' && exit 1 || \
+echo 'yelp-check orphans: PASS'
+
+yelp-check validate gnome-help/C system-admin-guide/C | \
+grep . && echo 'yelp-check validate: FAIL' && exit 1 || \
+echo 'yelp-check validate: PASS'
diff --git a/gnome-help/C/gnome-help.sct b/gnome-help/C/gnome-help.sct
index 6497a1fb..d443ac08 100644
--- a/gnome-help/C/gnome-help.sct
+++ b/gnome-help/C/gnome-help.sct
@@ -17,8 +17,10 @@ xmllint --noout --schematron gnome-help.sct *.page 2>&1 | grep -v 'validates$'
     </rule>
     <rule context="mal:page/mal:info/mal:desc">
       <assert test="mal:link or
-                    substring(normalize-space(.), string-length(normalize-space(.))) = '.'"
-                    >Desc must end with a period</assert>
+                    substring(normalize-space(.), string-length(normalize-space(.))) = '.' or
+                    mal:link or
+                    substring(normalize-space(.), string-length(normalize-space(.))) = '?'"
+                    >Desc must end with a period or question mark</assert>
     </rule>
     <rule context="mal:page/mal:info/mal:desc/mal:link">
       <assert test="substring(normalize-space(..), string-length(normalize-space(..)) - 2) = '...' or
diff --git a/system-admin-guide/C/system-admin-guide.sct b/system-admin-guide/C/system-admin-guide.sct
new file mode 100644
index 00000000..54af7060
--- /dev/null
+++ b/system-admin-guide/C/system-admin-guide.sct
@@ -0,0 +1,33 @@
+<?run this:
+xmllint --noout --schematron gnome-help.sct *.page 2>&1 | grep -v 'validates$'
+?>
+<schema xmlns="http://www.ascc.net/xml/schematron"; >
+  <title>Some sanity checks for the GNOME desktop help</title>
+  <ns prefix="mal" uri="http://projectmallard.org/1.0/"/>
+  <ns prefix="xi" uri="http://www.w3.org/2001/XInclude"/>
+  <pattern name="Info element checks">
+    <rule context="mal:page/mal:info">
+      <assert test="not(mal:license)">Must not include license directly</assert>
+      <!-- FIXME: https://gitlab.gnome.org/GNOME/gnome-user-docs/issues/9
+      <assert test="xi:include[@href='legal.xml']">Must include legal.xml</assert>
+      -->
+    </rule>
+  </pattern>
+  <pattern name="Desc checks">
+    <rule context="mal:page/mal:info">
+      <assert test="normalize-space(mal:desc) != ''">Must have non-empty desc</assert>
+    </rule>
+    <rule context="mal:page/mal:info/mal:desc">
+      <assert test="mal:link or
+                    substring(normalize-space(.), string-length(normalize-space(.))) = '.' or
+                    mal:link or
+                    substring(normalize-space(.), string-length(normalize-space(.))) = '?'"
+                    >Desc must end with a period or question mark</assert>
+    </rule>
+    <rule context="mal:page/mal:info/mal:desc/mal:link">
+      <assert test="substring(normalize-space(..), string-length(normalize-space(..)) - 2) = '...' or
+                    substring(normalize-space(..), string-length(normalize-space(..))) = '…'"
+                   >Desc with links must end with an ellipsis</assert>
+    </rule>
+  </pattern>
+</schema>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]