Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Additional Schematron Rules for GeekoDoc #48

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 3 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The following procedure can be used for openSUSE Leap 42.1:
1. Add the repository:

```
$ sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Leap_42.3/devel:languages:python.repo
$ sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Leap_\$releasever/devel:languages:python.repo
```

2. Install it:
Expand Down Expand Up @@ -88,31 +88,10 @@ The executable can be found in `.env3/bin/rnginline`.

1. Update your GitHub repository.

2. Convert the official compact version into the XML version with trang:
2. Change the directory to `geekodoc/rng`.

```
$ trang geekodoc.rnc geekodoc5.rng
```

3. Create the flat RNG version:

```
$ rnginline geekodoc5.rng geekodoc5-flat.rng
```

4. Optional: Cleanup and remove unnecessary namespaces:
3. Run `make`.

```
$ mv geekodoc5-flat.rng _flat.rng
$ xmllint -o geekodoc5-flat.rng --nsclean --format flat.rng
$ rm _flat.rng
```

5. Optional: Create the compact version:

```
$ trang geekodoc5-flat.rng geekodoc5-flat.rnc
```

## Supporting Vim

Expand Down
55 changes: 55 additions & 0 deletions geekodoc/rng/geekodoc5.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt">
<s:title>Schematron Schema for GeekoDoc</s:title>
<s:p>GeekoDoc Schematron</s:p>

<s:ns prefix="a" uri="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<s:ns prefix="ctrl" uri="http://nwalsh.com/xmlns/schema-control/"/>
<s:ns prefix="db" uri="http://docbook.org/ns/docbook"/>
<s:ns prefix="html" uri="http://www.w3.org/1999/xhtml"/>
<s:ns prefix="its" uri="http://www.w3.org/2005/11/its"/>
<s:ns prefix="mml" uri="http://www.w3.org/1998/Math/MathML"/>
<s:ns prefix="rng" uri="http://relaxng.org/ns/structure/1.0"/>
<s:ns prefix="s" uri="http://purl.oclc.org/dsdl/schematron"/>
<s:ns prefix="svg" uri="http://www.w3.org/2000/svg"/>
<s:ns prefix="xlink" uri="http://www.w3.org/1999/xlink"/>

<s:pattern>
<s:title>General Checks</s:title>
<s:rule id="spaces-in-xmlid" context="*/@xml:id" see="spaces-in-xmlid">
<s:assert test="not(contains(., ' '))">No spaces in xml:id's!</s:assert>
</s:rule>
</s:pattern>

<s:pattern id="list-with-title-and-xmlid">
<s:title>All lists with a title should have a xml:id</s:title>
<s:rule id="itemizedlist-title-and-xmlid" context="db:itemizedlist[db:title]">
<s:assert test="@xml:id">an <s:value-of select="local-name()"/> with a title must have a xml:id attribute</s:assert>
</s:rule>
<s:rule id="orderedlist-title-and-xmlid" context="db:orderedlist[db:title]">
<s:assert test="@xml:id">an <s:value-of select="local-name()"/> with a title must have a xml:id attribute</s:assert>
</s:rule>
<s:rule id="variablelist-title-and-xmlid" context="db:variablelist[db:title]">
<s:assert test="@xml:id">an <s:value-of select="local-name()"/> with a title must have a xml:id attribute</s:assert>
</s:rule>
<s:rule id="procedure-title-and-xmlid" context="db:procedure[db:title]">
<s:assert test="@xml:id">a <s:value-of select="local-name()"/> with a title must have a xml:id attribute</s:assert>
</s:rule>
</s:pattern>

<s:pattern id="list-checks">
<s:title>Checks for amount of child elements in lists</s:title>
<s:rule id="procedure-one-step" context="db:procedure">
<s:assert test="not(count(db:step) = 1)">A procedure must contain more than one step</s:assert>
</s:rule>
<s:rule id="orderedlist-one-listitem" context="db:orderedlist">
<s:assert test="not(count(db:listitem) = 1)">An orderedlist must contain more than one listitems</s:assert>
</s:rule>
<s:rule id="itemizedlist-one-listitem" context="db:itemizedlist">
<s:assert test="not(count(db:listitem) = 1)">An orderedlist must contain more than one listitems</s:assert>
</s:rule>
<s:rule id="simplelist-one-member" context="db:simplelist">
<s:assert test="not(count(db:member) = 1)">A simplelist must contain more than one member</s:assert>
</s:rule>
</s:pattern>
</s:schema>