-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial attempt at schema for project.ptx files * Add Github action to make sure the compiled and compact schemas are identical * Test all `project.ptx` template files against the schema * Updated schema to work on all template documents * Update schema * set up folder * possibly fix tag issue with deploy * First stab at .rnc version * fix syntax errors, verify working --------- Co-authored-by: Jason Siefken <[email protected]>
- Loading branch information
1 parent
4b508bb
commit 03d0641
Showing
6 changed files
with
444 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
This directory will contain the RelaxNG schema for the project manifest `project.ptx`. | ||
|
||
There are two versions, a compact syntax (`.rnc`) and XML (`.rng`). Edits should be made to the `.rnc` file which can then be converted to the `.rng` version using [trang](https://github.com/relaxng/jing-trang) via | ||
``` | ||
> trang project-ptx.rnc project-ptx.rng | ||
``` | ||
|
||
You can then use [jing](https://github.com/relaxng/jing-trang) to test | ||
whether a `project.ptx` file conforms to the schema. | ||
``` | ||
> jing project-ptx.rng path/to/project.ptx | ||
``` | ||
|
||
If you are running these commands directly from Java `.jar` files, you will | ||
instead run | ||
``` | ||
> java -jar path/to/jing.jar [...other arguments...] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Relax-ng grammar for `project.ptx` files. | ||
# To use this grammar, it must first be converted from | ||
# "compact" form (the `.rnc` file) into XML (the `.rng` file). | ||
# This conversion is accomplished with [trang](https://github.com/relaxng/jing-trang) via | ||
# ``` | ||
# > trang project-ptx.rnc project-ptx.rng | ||
# ``` | ||
# You can then use [jing](https://github.com/relaxng/jing-trang) to test | ||
# whether a `project.ptx` file conforms to the schema. | ||
# ``` | ||
# > jing project-ptx.rng path/to/project.ptx | ||
# ``` | ||
# | ||
# If you are running these commands directly from Java `.jar` files, you will | ||
# instead run | ||
# ``` | ||
# > java -jar path/to/jing.jar [...other arguments...] | ||
# ``` | ||
|
||
grammar { | ||
|
||
start = Project | ||
|
||
Project = element project { | ||
ProjectReqAttributes, | ||
ProjectOptAttributes, | ||
Targets | ||
} | ||
|
||
ProjectReqAttributes = attribute ptx-version { "2" } | ||
|
||
ProjectOptAttributes = ( | ||
attribute source { text }?, | ||
attribute publication { text }?, | ||
attribute output-dir { text }?, | ||
attribute site {text}?, | ||
attribute xsl { text }?, | ||
attribute asy-method { "server" | "local" }? | ||
) | ||
|
||
Targets = element targets { Target+ } | ||
|
||
Target = element target { | ||
## Unique identifier for this build target. This is the name you pass on the | ||
## command line when building via the `pretext` CLI. | ||
attribute name { text }, | ||
## the required format can be `html`, `pdf`, `latex`, `epub`, `kindle`, `braille`, `revealjs`, `webwork`, or `custom`. | ||
( | ||
HtmlAttributes | ||
| PdfAttributes | ||
| LatexAttributes | ||
| EpubAttributes | ||
| BrailleAttributes | ||
| RevealjsAttributes | ||
| WebworkAttributes | ||
| CustomAttributes | ||
), | ||
CommonAttributes, | ||
## Parameters that get passed directly to the XSL processing backend. | ||
## These parameters are rarely used by content authors. | ||
Stringparams* | ||
} | ||
|
||
CommonAttributes = ( | ||
attribute source { text }?, | ||
attribute publication { text }?, | ||
attribute output-dir { text }?, | ||
attribute deploy-dir { text }?, | ||
attribute site {text}?, | ||
attribute xsl { text }?, | ||
attribute asy-method { "server" | "local" }? | ||
) | ||
|
||
HtmlAttributes = ( | ||
attribute format { "html" }, | ||
(attribute platform { "runestone" }? | ||
| attribute compression { "zip" }?) | ||
) | ||
|
||
PdfAttributes = ( | ||
attribute format { "pdf" }, | ||
attribute latex-engine { "xelatex" | "pdflatex" | "latex" }?, | ||
attribute output-filename { text }? | ||
) | ||
|
||
LatexAttributes = ( | ||
attribute format { "latex" }, | ||
attribute output-filename { text }? | ||
) | ||
|
||
EpubAttributes = ( | ||
attribute format { "epub"|"kindle" }, | ||
attribute output-filename { text }? | ||
) | ||
|
||
BrailleAttributes = ( | ||
attribute format { "braille" }, | ||
attribute braille-mode { "emboss" | "electronic" }? | ||
) | ||
|
||
RevealjsAttributes = ( | ||
attribute format { "revealjs" }, | ||
attribute output-filename { text }? | ||
) | ||
|
||
WebworkAttributes = ( | ||
attribute format { "webwork" }, | ||
attribute compression { "zip" }? | ||
) | ||
|
||
CustomAttributes = ( | ||
attribute format { "custom" } | ||
) | ||
|
||
|
||
Stringparams = element stringparams { | ||
# Attributes are the name of the string-param and the value is the value of the string-param. | ||
attribute debug.datedfiles {"yes"|"no"}?, | ||
attribute debug.mathjax4 { "yes" | "no" }?, | ||
attribute debug.react.local { "yes" | "no" }?, | ||
attribute debug.react.global { "yes" | "no" }?, | ||
attribute debug.html.annotate { "yes" | "no" }?, | ||
attribute debug.skip-knowls { "yes" | "no" }?, | ||
attribute author.tools { "yes" | "no" }?, | ||
attribute html.css.extra { text }? | ||
} | ||
|
||
} |
Oops, something went wrong.