diff options
author | Shaun McCance <shaunm@src.gnome.org> | 2007-02-02 19:11:02 +0000 |
---|---|---|
committer | Shaun McCance <shaunm@src.gnome.org> | 2007-02-02 19:11:02 +0000 |
commit | 02d0d9fc2f6d1c3db5c322483b3c8df903c9c79e (patch) | |
tree | 92603d8abecb5db1352a46789178736bd5866ed8 /sandbox | |
parent | 55f8182565e6c57c7d572b021835930c77c65837 (diff) | |
download | gnome-doc-utils-02d0d9fc2f6d1c3db5c322483b3c8df903c9c79e.tar.gz |
- Brining in the new
* rng/*:
* spec/*:
* xslt/*:
- Brining in the new
svn path=/trunk/; revision=878
Diffstat (limited to 'sandbox')
52 files changed, 1791 insertions, 0 deletions
diff --git a/sandbox/mallard/ChangeLog b/sandbox/mallard/ChangeLog index 3370b0b..cce27a1 100644 --- a/sandbox/mallard/ChangeLog +++ b/sandbox/mallard/ChangeLog @@ -1,5 +1,12 @@ 2007-02-02 Shaun McCance <shaunm@gnome.org> + * rng/*: + * spec/*: + * xslt/*: + - Brining in the new + +2007-02-02 Shaun McCance <shaunm@gnome.org> + * doc/Makefile.am: * doc/*: * rng/*: diff --git a/sandbox/mallard/rng/Makefile b/sandbox/mallard/rng/Makefile new file mode 100644 index 0000000..28cffd5 --- /dev/null +++ b/sandbox/mallard/rng/Makefile @@ -0,0 +1,9 @@ +all: mallard.rnc mallard.rng + +mallard.rnc: $(wildcard ../spec/*.xml) + for file in ../spec/*.xml; do \ + xsltproc ../xslt/mal2rnc.xsl $$file; \ + done > mallard.rnc + +mallard.rng: mallard.rnc rnc2rng.awk + awk -f rnc2rng.awk mallard.rnc | xmllint --format - > mallard.rng diff --git a/sandbox/mallard/rng/rnc2rng.awk b/sandbox/mallard/rng/rnc2rng.awk new file mode 100644 index 0000000..7fcf5bf --- /dev/null +++ b/sandbox/mallard/rng/rnc2rng.awk @@ -0,0 +1,210 @@ +#!/bin/awk +# rnc2rng.awk - Convert RELAX NG Compact Syntax to XML Syntax +# Copyright (C) 2007 Shaun McCance <shaunm@gnome.org> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This program is free software, but that doesn't mean you should use it. +# I wanted to write and maintain the Mallard schema in RNC in code blocks +# within the specification, but I needed to distribute the schema in RNG. +# Since xmllint (libxml2) does not currently support RNC, and since I'm +# not willing to introduce more dependencies, awk was my only option. +# +# This awk script is *NOT* a complete implementation, and probably never +# will be. Its sole purpose is to handle the Mallard schema, and it is +# sufficient for that task. +# +# You are, of course, free to use any of this. If you do proliferate this +# hack, it is requested (though not required, that would be non-free) that +# you atone for your actions. A good atonement would be contributing to +# free software. + +function runline (line) { + sub(/^ */, "", line) + c = substr(line, 1, 1); + if (c == "(" || c == "{") { + stack[++stack_i] = substr(line, 1, 1); + paren[++paren_i] = stack_i; + runline(substr(line, 2)); + } + else if (c == ")" || c == "}") { + open = stack[paren[paren_i]]; + oc = substr(open, 1, 1) c; + if (oc != "()" && oc != "{}") { + print "Mismatched parentheses on line " FNR | "cat 1>&2"; + error = 1; + exit 1 + } + + tag = ""; + if (length(open) > 1 && substr(open, 2, 1) == "&") { + tag = "interleave"; + } + else if (length(open) > 1 && substr(open, 2, 1) == "|") { + tag = "choice"; + } + else if (oc == "()") { + tag = "group"; + } + + tmp = ""; + if (tag != "") { + tmp = "<" tag ">"; + } + for (i = paren[paren_i] + 1; i <= stack_i; i++) { + tmp = tmp stack[i] "\n"; + } + if (tag != "") { + tmp = tmp "</" tag ">"; + } + stack_i = paren[paren_i]; + stack[stack_i] = tmp; + paren_i--; + + if (oc == "{}") { + if (substr(stack[stack_i - 1], 1, 8) == "<element") { + tmp = stack[stack_i - 1] "\n"; + tmp = tmp stack[stack_i] "\n"; + tmp = tmp "</element>"; + stack[--stack_i] = tmp; + } + else if (substr(stack[stack_i - 1], 1, 10) == "<attribute") { + tmp = stack[stack_i - 1] "\n"; + tmp = tmp stack[stack_i] "\n"; + tmp = tmp "</attribute>"; + stack[--stack_i] = tmp; + } + } + if (paren_i == 0) { + mode = "top"; + } + runline(substr(line, 2)); + } + else if (c == "|" || c == "&" || c == ",") { + if (length(stack[paren[paren_i]]) == 1) { + stack[paren[paren_i]] = stack[paren[paren_i]] c; + } + else if (substr(stack[paren[paren_i]], 2) != c) { + print "Mismatched infix operators on line " FNR | "cat 1>&2"; + error = 1; + exit 1 + } + runline(substr(line, 2)); + } + else if (c == "?") { + stack[stack_i] = "<optional>" stack[stack_i] "</optional>" + runline(substr(line, 2)); + } + else if (c == "*") { + stack[stack_i] = "<zeroOrMore>" stack[stack_i] "</zeroOrMore>" + runline(substr(line, 2)); + } + else if (c == "+") { + stack[stack_i] = "<oneOrMore>" stack[stack_i] "</oneOrMore>" + runline(substr(line, 2)); + } + else if (c == "\"") { + txt = substr(line, 2); + sub(/".*/, "", txt) + stack[++stack_i] = "<value>" txt "</value>"; + runline(substr(line, length(txt) + 3)); + } + else if (substr(line, 1, 8) == "element ") { + aft = substr(line, 8); + sub(/^ */, "", aft); + name = aft; + sub(/[^[:alpha:]_]+.*/, "", name); + aft = substr(aft, length(name) + 1); + stack[++stack_i] = sprintf("<element name=\"%s\">", name); + runline(aft); + } + else if (substr(line, 1, 10) == "attribute ") { + aft = substr(line, 10); + sub(/^ */, "", aft); + name = aft; + sub(/[^[:alpha:]_]+.*/, "", name); + aft = substr(aft, length(name) + 1); + stack[++stack_i] = sprintf("<attribute name=\"%s\">", name); + runline(aft); + } + else if (match(line, /^text[^[:alpha:]]/)) { + stack[++stack_i] = "<text/>"; + runline(substr(line, 5)); + } + else if (match(line, /^[[:alpha:]]/)) { + name = substr(line, 1); + sub(/[^[:alpha:]_]+.*/, "", name); + aft = substr(line, length(name) + 1); + stack[++stack_i] = sprintf("<ref name=\"%s\"/>", name); + runline(aft); + } +} + +function printstack () { + if (substr(stack[pos], 1, 6) == "<start") { + print stack[pos++]; + printstack(); + print "</start>" + } + else if (substr(stack[pos], 1, 7) == "<define") { + print stack[pos++]; + printstack(); + print "</define>" + } + else { + print stack[pos++]; + } +} + +BEGIN { + mode = "top"; + stack_i = 0; + paren_i = 0; +} + +END { + if (!error) { + printf "<grammar xmlns='http://relaxng.org/ns/structure/1.0' ns='%s'>\n", namespace; + tab = 1; + pos = 1; + while (pos <= stack_i) { + printstack() + } + print "</grammar>" + } +} + +mode != "top" { + runline($0); +} +mode == "top" && /.*=/ { + name = substr($0, 1, index($0, "=") - 1); + sub(/ /, "", name); + if (substr($0, 1, 17) == "default namespace") { + namespace = substr($0, index($0, "=") + 1); + sub(/^ *"/, "", namespace); + sub(/" *$/, "", namespace); + } + else if (name == "start") { + stack[++stack_i] = "<start>" + mode = "blank"; + runline(substr($0, index($0, "=") + 1)) + } + else { + stack[++stack_i] = sprintf("<define name=\"%s\">", name); + mode = "blank"; + runline(substr($0, index($0, "=") + 1)) + } +} diff --git a/sandbox/mallard/spec/Makefile b/sandbox/mallard/spec/Makefile new file mode 100644 index 0000000..df816e3 --- /dev/null +++ b/sandbox/mallard/spec/Makefile @@ -0,0 +1,22 @@ +.PHONY: check-validate check-links + +check-validate: + @(cd ../rnc/ && $(MAKE) mallard.rnc) + xmllint --noout --relaxng ../rnc/mallard.rng *.xml + +check-links: + @files=$$(for file in *.xml; do \ + xml sel -t -m "//*[@xref and contains(@xref, '#')]" \ + -v "substring-before(@xref, '#')" -n "$$file"; \ + xml sel -t -m "//*[@xref and not(contains(@xref, '#'))]" \ + -v "@xref" -n "$$file"; \ + done | sort -u); \ + for file in $$files; do \ + if [ ! -f "$$file.xml" -a ! -f "$$file.TODO" ]; then \ + echo "$$file not found"; \ + exit 1; \ + fi; \ + done; + + + diff --git a/sandbox/mallard/spec/TODO b/sandbox/mallard/spec/TODO new file mode 100644 index 0000000..e5d19e4 --- /dev/null +++ b/sandbox/mallard/spec/TODO @@ -0,0 +1,3 @@ +@status on guide, topic, section + + diff --git a/sandbox/mallard/spec/mal_TODO.xml b/sandbox/mallard/spec/mal_TODO.xml new file mode 100644 index 0000000..6e70073 --- /dev/null +++ b/sandbox/mallard/spec/mal_TODO.xml @@ -0,0 +1,13 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_TODO"> +<info> +</info> + +<title>TODO</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +default namespace = "http://www.gnome.org/~shaunm/mallard" +start = (mal_guide | mal_topic) +</code></synopsis> + +</topic> diff --git a/sandbox/mallard/spec/mal_app.xml b/sandbox/mallard/spec/mal_app.xml new file mode 100644 index 0000000..1b548e9 --- /dev/null +++ b/sandbox/mallard/spec/mal_app.xml @@ -0,0 +1,20 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_app"> +<info> + <link type="guide" xref="mal_inline"/> +</info> + +<title>Application Names</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_app = element app { + <link xref="mal_inline#simple">mal_inline_simple</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_attr.xml b/sandbox/mallard/spec/mal_attr.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_attr.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_block.xml b/sandbox/mallard/spec/mal_block.xml new file mode 100644 index 0000000..bed954b --- /dev/null +++ b/sandbox/mallard/spec/mal_block.xml @@ -0,0 +1,45 @@ +<guide xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_block"> +<info> +</info> + +<title>Block Elements</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_block = ( + <link xref="mal_comment">mal_comment</link> | + <link xref="mal_figure">mal_figure</link> | + <link xref="mal_list">mal_list</link> | + <link xref="mal_note">mal_note</link> | + <link xref="mal_synopsis">mal_synopsis</link> | + <link xref="#simple">mal_block_simple</link> ) +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2006-11-16</date></cite> + <p>Add some intro text</p> +</comment> + + +<!-- BEGIN simple --> +<section id="simple"> +<title>Simple Block Elements</title> + +<synopsis><code>mal_block_simple = ( + <link xref="mal_code">mal_code_block</link> | + <link xref="mal_p">mal_p</link> | + <link xref="mal_screen">mal_screen</link> ) +</code></synopsis> + +</section> +<!-- END simple --> + + +<!-- BEGIN containers --> +<section id="containers"> +<title>Block Container Elements</title> + +</section> +<!-- END containers --> + +</guide> diff --git a/sandbox/mallard/spec/mal_caption.xml b/sandbox/mallard/spec/mal_caption.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_caption.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_cite.xml b/sandbox/mallard/spec/mal_cite.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_cite.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_cmd.xml b/sandbox/mallard/spec/mal_cmd.xml new file mode 100644 index 0000000..2fc2364 --- /dev/null +++ b/sandbox/mallard/spec/mal_cmd.xml @@ -0,0 +1,20 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_cmd"> +<info> + <link type="guide" xref="mal_inline"/> +</info> + +<title>Commands</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_cmd = element cmd { + <link xref="mal_inline#simple">mal_inline_simple</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_code.xml b/sandbox/mallard/spec/mal_code.xml new file mode 100644 index 0000000..f59dcfd --- /dev/null +++ b/sandbox/mallard/spec/mal_code.xml @@ -0,0 +1,63 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_block_code"> +<info> + <link type="guide" xref="mal_block#simple"/> + <link type="guide" xref="mal_inline"/> +</info> + +<title>Code Snippets</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_code_block = element code { + <link xref="mal_attr">mal_attr_common</link>, + attribute mime { text }, + <link xref="mal_inline">mal_inline</link>+ +}</code></synopsis> + +<synopsis><code> +mal_code_inline = element code { + <link xref="mal_attr">mal_attr_common</link>, + attribute mime { text }, + <link xref="mal_inline">mal_inline_simple</link>+ +}</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2006-12-08</date></cite> + <p>Add intro material.</p> +</comment> + + +<!-- BEGIN examples --> +<section id="examples" status="tentative"> + <title>Examples</title> + <comment> + <cite><name>Shaun McCance</name><date>2007-01-25</date></cite> + <p>Add examples.</p> + </comment> +</section> +<!-- END examples --> + + +<!-- BEGIN processing --> +<section id="processing" status="tentative"> + <title>Processing Expectations</title> + <comment> + <cite><name>Shaun McCance</name><date>2007-01-25</date></cite> + <p>Add processing expectations. For block, strip leading/trailing + newline. Do not strip leading indentation.</p> + </comment> +</section> +<!-- END processing --> + + +<!-- BEGIN docbook --> +<section id="docbook" status="tentative"> + <title>Comparison to DocBook</title> + <comment> + <cite><name>Shaun McCance</name><date>2007-01-25</date></cite> + <p>Add: code, class*, func*, programlisting</p> + </comment> +</section> +<!-- END docbook --> + +</topic> diff --git a/sandbox/mallard/spec/mal_comment.xml b/sandbox/mallard/spec/mal_comment.xml new file mode 100644 index 0000000..59fea8f --- /dev/null +++ b/sandbox/mallard/spec/mal_comment.xml @@ -0,0 +1,49 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_comment"> +<info> + <link type="guide" xref="mal_block#containers"/> +</info> + +<title>Editorial Comments</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_comment = element comment { + <link xref="mal_attr">mal_attr_common</link>, + <link xref="mal_title">mal_title</link>?, + <link xref="mal_cite">mal_cite</link>, + <link xref="mal_block#simple">mal_block_simple</link>+, + mal_comment* +} +</code></synopsis> + +<p>The <code>comment</code> element allows you to insert editorial comments +into your document. These comments are intended to be displayed only when +editing or reviewing the document, and not when the document is viewed by the +end reader. A <code>comment</code> element can contain other <code>comment</code> +elements, allowing you to have a threaded discussion inside editorial comments.</p> + +<p>A <code>comment</code> element may optionally contain a +<code xref="mal_title">title</code> element to provide a brief description +of the subject of the comment. Titles are encouraged in top-level comments; +however, they are usually unnecessary in replies.</p> + +<!-- FIXME +<p>The <code xref="mal_credit">credit</code> element is a required element +that specifies the person making the comment. The content model for the +<code>credit</code> element is specified in <link xref="mal_credit"/>, but +the element is listed here explicitly to prohimit the <code>type</code> +attribute. Writers are highly encouraged to provide a <code xref="mal_date">mal_date</code> +</p> +--> + +<comment> + <cite><name>Shaun McCance</name><date>2006-11-16</date></cite> + <p>Add examples, processing expectations</p> + + <comment> + <cite><name>Shaun McCance</name><date>2007-01-23</date></cite> + <p>This is a test of nested comments.</p> + </comment> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_copyright.xml b/sandbox/mallard/spec/mal_copyright.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_copyright.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_credit.xml b/sandbox/mallard/spec/mal_credit.xml new file mode 100644 index 0000000..0e5bc9a --- /dev/null +++ b/sandbox/mallard/spec/mal_credit.xml @@ -0,0 +1,23 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_credit"> +<info> + <link type="guide" xref="mal_TODO"/> +</info> + +<title>Credits</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_credit = element credit { + attribute type { "author" | "editor" | "collaborator" | "translator" }, + ( <link xref="mal_name">mal_name</link> & + <link xref="mal_date">mal_date</link>? & + <link xref="mal_email">mal_email</link>? ) +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-22</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_date.xml b/sandbox/mallard/spec/mal_date.xml new file mode 100644 index 0000000..5e769e3 --- /dev/null +++ b/sandbox/mallard/spec/mal_date.xml @@ -0,0 +1,20 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_date"> +<info> + <link type="guide" xref="mal_inline"/> +</info> + +<title>Dates</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_date = element date { + <link xref="mal_inline#simple">mal_inline_simple</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_em.xml b/sandbox/mallard/spec/mal_em.xml new file mode 100644 index 0000000..ba1d64f --- /dev/null +++ b/sandbox/mallard/spec/mal_em.xml @@ -0,0 +1,20 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_em"> +<info> + <link type="guide" xref="mal_inline"/> +</info> + +<title>Emphasis</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_em = element em { + <link xref="mal_inline#simple">mal_inline_simple</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_email.xml b/sandbox/mallard/spec/mal_email.xml new file mode 100644 index 0000000..8896a92 --- /dev/null +++ b/sandbox/mallard/spec/mal_email.xml @@ -0,0 +1,20 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_email"> +<info> + <link type="guide" xref="mal_inline"/> +</info> + +<title>Email Address</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_email = element email { + <link xref="mal_inline#simple">mal_inline_simple</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_figure.xml b/sandbox/mallard/spec/mal_figure.xml new file mode 100644 index 0000000..02b142d --- /dev/null +++ b/sandbox/mallard/spec/mal_figure.xml @@ -0,0 +1,23 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_figure"> +<info> + <link type="guide" xref="mal_block#containers"/> +</info> + +<title>Figures</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_figure = element figure { + <link xref="mal_attr">mal_attr_common</link>, + <link xref="mal_title">mal_title</link>?, + <link xref="mal_block#simple">mal_block_simple</link>+, + <link xref="mal_caption">mal_caption</link>? +}</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2006-11-16</date></cite> + <p>Add explanation, examples, processing expectations</p> + <p>A way to float right, a'la wikipedia?</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_file.xml b/sandbox/mallard/spec/mal_file.xml new file mode 100644 index 0000000..fcd3367 --- /dev/null +++ b/sandbox/mallard/spec/mal_file.xml @@ -0,0 +1,20 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_file"> +<info> + <link type="guide" xref="mal_inline"/> +</info> + +<title>File Names</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_file = element file { + <link xref="mal_inline#simple">mal_inline_simple</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_gui.xml b/sandbox/mallard/spec/mal_gui.xml new file mode 100644 index 0000000..d9f3ba3 --- /dev/null +++ b/sandbox/mallard/spec/mal_gui.xml @@ -0,0 +1,20 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_gui"> +<info> + <link type="guide" xref="mal_inline"/> +</info> + +<title>Graphical Interface Elements</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_gui = element gui { + <link xref="mal_inline#simple">mal_inline_simple</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_guide.xml b/sandbox/mallard/spec/mal_guide.xml new file mode 100644 index 0000000..3673385 --- /dev/null +++ b/sandbox/mallard/spec/mal_guide.xml @@ -0,0 +1,21 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_guide"> +<info> +</info> + +<title>Guide Pages</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_guide = element guide { + <link xref="mal_info">mal_info_guide</link>?, + <link xref="mal_title">mal_title</link>, + <link xref="mal_block">mal_block</link>+, + <link xref="mal_section">mal_section_guide</link>* +}</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add some intro text, examples, processing expectations.</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_info.xml b/sandbox/mallard/spec/mal_info.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_info.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_inline.xml b/sandbox/mallard/spec/mal_inline.xml new file mode 100644 index 0000000..8ebc9eb --- /dev/null +++ b/sandbox/mallard/spec/mal_inline.xml @@ -0,0 +1,47 @@ +<guide xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_inline"> +<info> +</info> + +<title>Inline Elements</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_inline = ( + <link xref="mal_app">mal_app</link> | + <link xref="mal_cmd">mal_cmd</link> | + <link xref="mal_code">mal_code_inline</link> | + <link xref="mal_date">mal_date</link> | + <link xref="mal_em">mal_em</link> | + <link xref="mal_email">mal_email</link> | + <link xref="mal_file">mal_file</link> | + <link xref="mal_gui">mal_gui</link> | + <link xref="mal_input">mal_input</link> | + <link xref="mal_key">mal_key</link> | + <link xref="mal_link">mal_link</link> | + <link xref="mal_media">mal_media</link> | + <link xref="mal_name">mal_name</link> | + <link xref="mal_output">mal_output</link> | + <link xref="mal_quote">mal_quote_inline</link> | + <link xref="mal_sys">mal_sys</link> | + <link xref="#simple">mal_inline_simple</link> ) +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2006-11-16</date></cite> + <p>Add some intro text</p> +</comment> + + +<!-- BEGIN simple --> +<section id="simple"> +<title>Simple Inline</title> + +<synopsis><code>mal_inline_simple = ( + <link xref="mal_var">mal_var</link> | + text ) +</code></synopsis> + +</section> +<!-- END simple --> + +</guide> diff --git a/sandbox/mallard/spec/mal_input.xml b/sandbox/mallard/spec/mal_input.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_input.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_item.xml b/sandbox/mallard/spec/mal_item.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_item.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_key.xml b/sandbox/mallard/spec/mal_key.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_key.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_link.xml b/sandbox/mallard/spec/mal_link.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_link.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_list.xml b/sandbox/mallard/spec/mal_list.xml new file mode 100644 index 0000000..0a62d3f --- /dev/null +++ b/sandbox/mallard/spec/mal_list.xml @@ -0,0 +1,70 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_list"> +<info> + <link type="guide" xref="mal_block#containers"/> +</info> + +<title>Lists</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_list = ( + <link xref="#bullet">mal_list_bullet</link> | + <link xref="#numbered">mal_list_numbered</link> | + <link xref="#definition">mal_list_definition</link> ) +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add explanation, examples, processing expectations</p> +</comment> + + +<!-- BEGIN bullet --> +<section id="bullet"> +<title>Bullet Lists</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_list_bullet = element_list { + attribute type { "bullet" } ?, + attribute style { text } ?, + element item { + <link xref="mal_block#simple">mal_block_simple</link> + + } + +}</code></synopsis> +</section> +<!-- END bullet --> + + +<!-- BEGIN numbered --> +<section id="numberd"> +<title>Numbered Lists</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_list_numbered = element_list { + attribute type { "numbered" }, + attribute style { text } ?, + element item { + <link xref="mal_block#simple">mal_block_simple</link> + + } + +}</code></synopsis> +</section> +<!-- END numbered --> + + +<!-- BEGIN definition --> +<section id="definition"> +<title>Definition Lists</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_list_definition = element_list { + attribute type { "definition" }, + attribute style { text } ?, + element item { + <link xref="mal_title">mal_title</link> +, + <link xref="mal_block#simple">mal_block_simple</link> + + } + +}</code></synopsis> +</section> +<!-- END definition --> + +</topic> diff --git a/sandbox/mallard/spec/mal_media.xml b/sandbox/mallard/spec/mal_media.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_media.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_name.xml b/sandbox/mallard/spec/mal_name.xml new file mode 100644 index 0000000..a79030c --- /dev/null +++ b/sandbox/mallard/spec/mal_name.xml @@ -0,0 +1,20 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_name"> +<info> + <link type="guide" xref="mal_inline"/> +</info> + +<title>Names</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_name = element name { + <link xref="mal_inline#simple">mal_inline_simple</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add examples, processing expectations</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_note.xml b/sandbox/mallard/spec/mal_note.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_note.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_output.xml b/sandbox/mallard/spec/mal_output.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_output.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_p.xml b/sandbox/mallard/spec/mal_p.xml new file mode 100644 index 0000000..717e5b0 --- /dev/null +++ b/sandbox/mallard/spec/mal_p.xml @@ -0,0 +1,62 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_p"> +<info> + <link type="guide" xref="mal_block#simple"/> +</info> + +<title>Paragraphs</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_p = element p { + <link xref="mal_attr">mal_attr_common</link>, + <link xref="mal_inline">mal_inline</link>+ +}</code></synopsis> + +<p>The most basic block-level element in Mallard is the <code>p</code> +element. The <code>p</code> element creates a paragraph in the formatted +outout.</p> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-25</date></cite> + <p>Add some more description.</p> +</comment> + + +<!-- BEGIN examples --> +<section id="examples" status="tentative"> + <title>Examples</title> + <comment> + <cite><name>Shaun McCance</name><date>2007-01-25</date></cite> + <p>Add examples.</p> + </comment> +</section> +<!-- END examples --> + + +<!-- BEGIN processing --> +<section id="processing" status="tentative"> + <title>Processing Expectations</title> + <comment> + <cite><name>Shaun McCance</name><date>2007-01-25</date></cite> + <p>Add processing expectations. Very basic. Mention margins and + indentation as means of demarkating paragraphs. Explicitly mention + the no-block-nesting thing.</p> + </comment> +</section> +<!-- END processing --> + + +<!-- BEGIN docbook --> +<section id="docbook" status="tentative"> + <title>Comparison to DocBook</title> + <p>The <code>p</code> element in Mallard appears to be equivalent to to the + <code href="http://www.docbook.org/tdg/en/html/para.html">para</code> element + in DocBook. While both elements create a paragraph in the formatted output, + the <code>p</code> element in Mallard is actually much more restrictive, as it + does not permit nested block content. In this regard, it is actaully similar + to the <code href="http://www.docbook.org/tdg/en/html/simpara.html">simpara</code> + element in DocBook.</p> +</section> +<!-- END docbook --> + +</topic> diff --git a/sandbox/mallard/spec/mal_quote.xml b/sandbox/mallard/spec/mal_quote.xml new file mode 100644 index 0000000..cc04201 --- /dev/null +++ b/sandbox/mallard/spec/mal_quote.xml @@ -0,0 +1,4 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +render quotes around inline +style="epipgraph" +</topic> diff --git a/sandbox/mallard/spec/mal_screen.xml b/sandbox/mallard/spec/mal_screen.xml new file mode 100644 index 0000000..c0ea56b --- /dev/null +++ b/sandbox/mallard/spec/mal_screen.xml @@ -0,0 +1,21 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_block_code"> +<info> + <link type="guide" xref="mal_block#simple"/> +</info> + +<title>Screens</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_screen = element screen { + <link xref="mal_attr">mal_attr_common</link>, + <link xref="mal_inline">mal_inline</link>+ +} +</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2006-12-08</date></cite> + <p>Add intro, examples, and processing expectations.</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_section.xml b/sandbox/mallard/spec/mal_section.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_section.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_subtitle.xml b/sandbox/mallard/spec/mal_subtitle.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_subtitle.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_synopsis.xml b/sandbox/mallard/spec/mal_synopsis.xml new file mode 100644 index 0000000..7bdf57d --- /dev/null +++ b/sandbox/mallard/spec/mal_synopsis.xml @@ -0,0 +1,42 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_synopsis"> +<info> + <link type="guide" xref="mal_block#containers"/> +</info> + +<title>Synopses</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_synopsis = element synopsis { + <link xref="mal_attr">mal_attr_common</link>, + <link xref="mal_title">mal_title</link>?, + <link xref="mal_block#simple">mal_block_simple</link>+, +}</code></synopsis> + +<p>The <code>synopsis</code> element allows you to mark up a block as +providing an overview of the material being presented. It is useful +for providing a listing of functions, commands, or options in reference +material, or for enumerating the items in a menu or other graphical +control element.</p> + +<comment> + <cite><name>Shaun McCance</name><date>2006-11-16</date></cite> + <p>Add explanation, examples</p> +</comment> + +<section> + <title>Processing Expectations</title> + + <p>A <code>synopsis</code> element is rendered as a displayed block, + with each of its child elements interpreted as block elements. Since + a <code>synopsis</code> element often contains large blocks, and is + generally offset from the running text, processing tools may opt to + render it inside a colored or screened box, with a border, or + otherwise differently from the surrounding text.</p> + + <p>If a <code xref="mal_title">title</code> element is provided, it + should appear at the top of the block and be clearly marked as the + title using font variations or other stylistic means.</p> +</section> + +</topic> diff --git a/sandbox/mallard/spec/mal_sys.xml b/sandbox/mallard/spec/mal_sys.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_sys.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_table.xml b/sandbox/mallard/spec/mal_table.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_table.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_title.xml b/sandbox/mallard/spec/mal_title.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_title.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/spec/mal_topic.xml b/sandbox/mallard/spec/mal_topic.xml new file mode 100644 index 0000000..014c113 --- /dev/null +++ b/sandbox/mallard/spec/mal_topic.xml @@ -0,0 +1,21 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard" + id="mal_topic"> +<info> +</info> + +<title>Topic Pages</title> + +<synopsis><code mime="application/relax-ng-compact-syntax"> +mal_topic = element topic { + <link xref="mal_info">mal_info_topic</link>?, + <link xref="mal_title">mal_title</link>, + <link xref="mal_block">mal_block</link>+, + <link xref="mal_section">mal_section_topic</link>* +}</code></synopsis> + +<comment> + <cite><name>Shaun McCance</name><date>2007-01-30</date></cite> + <p>Add some intro text, examples, processing expectations.</p> +</comment> + +</topic> diff --git a/sandbox/mallard/spec/mal_var.xml b/sandbox/mallard/spec/mal_var.xml new file mode 100644 index 0000000..b65623e --- /dev/null +++ b/sandbox/mallard/spec/mal_var.xml @@ -0,0 +1,2 @@ +<topic xmlns="http://www.gnome.org/~shaunm/mallard"> +</topic> diff --git a/sandbox/mallard/xslt/mal-link.xsl b/sandbox/mallard/xslt/mal-link.xsl new file mode 100644 index 0000000..abb8d12 --- /dev/null +++ b/sandbox/mallard/xslt/mal-link.xsl @@ -0,0 +1,95 @@ +<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> +<!-- +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; see the file COPYING.LGPL. If not, write to the +Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!--!!========================================================================== +Mallard Links +--> + + +<!--**========================================================================== +mal.link.content +Generates the content for a #{link} element +$node: FIXME +$xref: FIXME +--> +<xsl:template name="mal.link.content"> + <xsl:param name="node" select="."/> + <xsl:param name="xref" select="$node/@xref"/> + <!-- FIXME --> +</xsl:template> + + +<!--**========================================================================== +mal.link.target +Generates the target for a #{link} element +$node: FIXME +$xref: FIXME +--> +<xsl:template name="mal.link.target"> + <xsl:param name="node" select="."/> + <xsl:param name="xref" select="$node/@xref"/> + <!-- FIXME --> + <xsl:choose> + <xsl:when test="contains($xref, '#')"> + <xsl:variable name="page" select="substring-before($xref, '#')"/> + <xsl:variable name="sect" select="substring-after($xref, '#')"/> + <xsl:if test="$page != ''"> + <xsl:value-of select="concat($page, $mal.extension)"/> + </xsl:if> + <xsl:value-of select="concat('#', $sect)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($xref, $mal.extension)"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + +<!--**========================================================================== +mal.link.tooltip +Generates the tooltip for a #{link} element +$node: FIXME +$xref: FIXME +$href: FIXME +--> +<xsl:template name="mal.link.tooltip"> + <xsl:param name="node" select="."/> + <xsl:param name="xref" select="$node/@xref"/> + <xsl:param name="href" select="$node/@href"/> + <xsl:choose> + <xsl:when test="$xref"> + <!-- FIXME --> + </xsl:when> + <xsl:when test="starts-with($href, 'mailto:')"> + <xsl:variable name="addy" select="substring-after($href, 'mailto:')"/> + <xsl:call-template name="l10n.gettext"> + <xsl:with-param name="msgid" select="'email.tooltip'"/> + <xsl:with-param name="string" select="$addy"/> + <xsl:with-param name="format" select="true()"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space($href)"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> diff --git a/sandbox/mallard/xslt/mal2cache.xsl b/sandbox/mallard/xslt/mal2cache.xsl new file mode 100644 index 0000000..a94e257 --- /dev/null +++ b/sandbox/mallard/xslt/mal2cache.xsl @@ -0,0 +1,49 @@ +<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> +<!-- +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; see the file COPYING.LGPL. If not, write to the +Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +--> + +<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' + xmlns:mal='http://www.gnome.org/~shaunm/mallard' + version='1.0'> + +<xsl:output omit-xml-declaration="yes"/> + +<xsl:template match='mal:guide'> + <mal:guide id='{@id}'><mal:info> + <xsl:copy-of select='mal:info/*'/> + </mal:info> + <xsl:apply-templates select='mal:section'/> + </mal:guide> +</xsl:template> + +<xsl:template match='mal:topic'> + <mal:topic id='{@id}'><mal:info> + <xsl:copy-of select='mal:info/*'/> + </mal:info> + <xsl:apply-templates select='mal:section'/> + </mal:topic> +</xsl:template> + +<xsl:template match='mal:section'> + <mal:section id='{@id}'><mal:info> + <xsl:copy-of select='mal:info/*'/> + </mal:info> + <xsl:apply-templates select='mal:section'/> + </mal:section> +</xsl:template> + +</xsl:stylesheet> diff --git a/sandbox/mallard/xslt/mal2html-block.xsl b/sandbox/mallard/xslt/mal2html-block.xsl new file mode 100644 index 0000000..8967311 --- /dev/null +++ b/sandbox/mallard/xslt/mal2html-block.xsl @@ -0,0 +1,213 @@ +<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> +<!-- +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; see the file COPYING.LGPL. If not, write to the +Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:mal="http://www.gnome.org/~shaunm/mallard" + xmlns="http://www.w3.org/1999/xhtml" + version="1.0"> + +<!--!!========================================================================== +Mallard to HTML - Block Elements + +REMARK: Describe this module +--> + + +<!--**========================================================================== +mal2html.block.css +Outputs CSS that controls the appearance of block elements + +REMARK: Describe this template +--> +<xsl:template name="mal2html.block.css"> +<xsl:text> +<!-- FIXME: margins should be original ems, not adjusted --> +h1 { font-size: 1.72em; margin: 0; } +h2 { font-size: 1.44em; margin: 0; } +h3 { font-size: 1.2em; margin: 0; } +h4 { font-size: 1em; margin: 0 0; } +h5 { font-size: 1em; margin: 0 0; } +h6 { font-size: 1em; margin: 0 0; } +h7 { font-size: 1em; margin: 0 0; } +div.section { margin-top: 2em; } +div.section div.section { margin-top: 1.44em; } +div.section div.section div.section { margin-top: 1.2em; } +pre.code { + background-color: #eeeeec; + border: solid 2px #babdb6; +} +div.comment { + margin-left: 1.72em; + margin-right: 1em; + padding: 0 1em 1em 1em; + background-color: #fcaf3e; + border: solid 1px #f57900; + -moz-border-radius: 8px; +} +div.comment div.cite { font-style: italic; } +div.comment div.titlecite { margin-top: 0; } + +div.synopsis { + background-color: #eeeeec; + border: solid 1px #babdb6; + -moz-border-radius: 8px; + padding: 0 1em 1em 1em; +} +div.synopsis pre.code { + background: none; + border: none; +} +div.title { + font-size: 1.2em; + margin-top: 0.83em; + font-weight: bold; +} +</xsl:text> +</xsl:template> + + +<!-- == Matched Templates == --> + +<!-- = code = --> +<xsl:template mode="mal2html.block.mode" match="mal:code"> + <!-- FIXME: strip leading/trailing newline --> + <pre class="code"> + <!-- FIXME: if there's only one piece of text() --> + <xsl:if test="node()[1]/self::text()"> + <xsl:choose> + <!-- CR LF --> + <xsl:when test="starts-with(text()[1], '
')"> + <xsl:value-of select="substring-after(text()[1], '
')"/> + </xsl:when> + <!-- CR --> + <xsl:when test="starts-with(text()[1], '
')"> + <xsl:value-of select="substring-after(text()[1], '
')"/> + </xsl:when> + <!-- LF --> + <xsl:when test="starts-with(text()[1], '
')"> + <xsl:value-of select="substring-after(text()[1], '
')"/> + </xsl:when> + <!-- NEL --> + <xsl:when test="starts-with(text()[1], '…')"> + <xsl:value-of select="substring-after(text()[1], '…')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="text()[1]"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:apply-templates mode="mal2html.inline.mode" + select="node()[not((position() = 1 or position() = last()) + and self::text())]"/> + <xsl:if test="node()[last()]/self::text()"> + <xsl:variable name="text" select="text()[last()]"/> + <xsl:choose> + <!-- CR LF --> + <xsl:when test="substring($text, -2) = '
'"> + <xsl:value-of select="substring($text, 1, string-length($text) - 2 )"/> + </xsl:when> + <!-- CR --> + <xsl:when test="substring($text, -1) = '
'"> + <xsl:value-of select="substring($text, 1, string-length($text) - 1 )"/> + </xsl:when> + <!-- LF --> + <xsl:when test="substring($text, -1) = '
'"> + <xsl:value-of select="substring($text, 1, string-length($text) - 1 )"/> + </xsl:when> + <!-- NEL --> + <xsl:when test="substring($text, -1) = '…'"> + <xsl:value-of select="substring($text, 1, string-length($text) - 1 )"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </pre> +</xsl:template> + +<!-- = comment = --> +<xsl:template mode="mal2html.block.mode" match="mal:comment"> + <div class="comment"> + <xsl:apply-templates mode="mal2html.block.mode"/> + </div> +</xsl:template> + +<!-- = comment/title = --> +<xsl:template mode="mal2html.block.mode" match="mal:comment/mal:title"> + <div class="title"> + <xsl:apply-templates/> + </div> +</xsl:template> + +<!-- = comment/cite = --> +<xsl:template mode="mal2html.block.mode" match="mal:comment/mal:cite"> + <div class="cite"> + <xsl:attribute name="class"> + <xsl:text>cite</xsl:text> + <xsl:if test="preceding-sibling::*[1]/self::mal:title"> + <xsl:text> titlecite</xsl:text> + </xsl:if> + </xsl:attribute> + <!-- FIXME: i18n --> + <xsl:choose> + <xsl:when test="mal:name and mal:date"> + <xsl:text>from </xsl:text> + <xsl:apply-templates mode="mal2html.inline.mode" select="mal:name"/> + <xsl:text> on </xsl:text> + <xsl:apply-templates mode="mal2html.inline.mode" select="mal:date"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>from </xsl:text> + <xsl:apply-templates select="mal:name"/> + </xsl:otherwise> + </xsl:choose> + </div> +</xsl:template> + +<!-- = p = --> +<xsl:template mode="mal2html.block.mode" match="mal:p"> + <p class="p"> + <xsl:apply-templates mode="mal2html.inline.mode"/> + </p> +</xsl:template> + +<!-- = synopsis = --> +<xsl:template mode="mal2html.block.mode" match="mal:synopsis"> + <div class="synopsis"> + <xsl:apply-templates mode="mal2html.block.mode"/> + </div> +</xsl:template> + +<!-- = synopsis/title = --> +<xsl:template mode="mal2html.block.mode" match="mal:synopsis/mal:title"> + <div class="title"> + <xsl:apply-templates/> + </div> +</xsl:template> + +<!-- FIXME --> +<xsl:template mode="mal2html.block.mode" match="*"> + <xsl:message> + <xsl:text>Unmatched block element: </xsl:text> + <xsl:value-of select="local-name(.)"/> + </xsl:message> + <xsl:apply-templates mode="mal2html.inline.mode"/> +</xsl:template> + +</xsl:stylesheet> diff --git a/sandbox/mallard/xslt/mal2html-css.xsl b/sandbox/mallard/xslt/mal2html-css.xsl new file mode 100644 index 0000000..8649bee --- /dev/null +++ b/sandbox/mallard/xslt/mal2html-css.xsl @@ -0,0 +1,121 @@ +<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> +<!-- +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; see the file COPYING.LGPL. If not, write to the +Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:exsl="http://exslt.org/common" + xmlns="http://www.w3.org/1999/xhtml" + extension-element-prefixes="exsl" + version="1.0"> + +<!--!!========================================================================== +Mallard to HTML - CSS + +REMARK: Describe this module +--> + + +<!--@@========================================================================== +mal2html.css.file +The file to output CSS to + +This parameter allows you to output the CSS to separate file which is referenced +by each HTML file. If this parameter is blank, then the CSS is embedded inside +a #{style} tag in the HTML instead. +--> +<xsl:param name="mal2html.css.file" select="''"/> + + +<!--**========================================================================== +mal2html.css +Outputs the CSS that controls the appearance of the entire document +$css_file: Whether to create a CSS file when @{mal2html.css.file} is set. + +This template outputs a #{style} or #{link} tag and calls *{mal2html.css.content} +to output the actual CSS directives. An external CSS file will only be created +when ${css_file} is true. +--> +<xsl:template name="mal2html.css"> + <xsl:param name="css_file" select="false()"/> + <xsl:choose> + <xsl:when test="$mal2html.css.file != ''"> + <xsl:if test="$css_file"> + <exsl:document href="{$mal2html.css.file}" method="text"> + <xsl:call-template name="mal2html.css.content"/> + </exsl:document> + </xsl:if> + <link rel="stylesheet" type="text/css" href="{$mal2html.css.file}"/> + </xsl:when> + <xsl:otherwise> + <style type="text/css"> + <xsl:call-template name="mal2html.css.content"/> + </style> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + +<!--**========================================================================== +mal2html.css.content +Outputs the actual CSS directives + +This template is called by *{mal2html.css} to output CSS content. It also calls +templates from other modules to output CSS specific to the content addressed in +those modules. + +This template calls *{mal2html.css.custom} at the end. That template may be used +by extension stylesheets to extend or override the CSS. +--> +<xsl:template name="mal2html.css.content"> + <xsl:call-template name="mal2html.block.css"/> + <xsl:call-template name="mal2html.inline.css"/> +<xsl:text> +body { + margin: 0px; + direction: </xsl:text><xsl:call-template name="l10n.direction"/><xsl:text>; +} +div.body { margin: 0; padding: 12px; max-width: 60em; } +div { margin: 1em 0 0 0; padding: 0; } +pre { margin: 1em 0 0 0; padding: 0; } +p { margin: 1em 0 0 0; padding: 0; } +</xsl:text> +<xsl:call-template name="mal2html.css.custom"/> +</xsl:template> +<!-- +2.4 +2 +1.72 +1.44 +1.2 +1 +0.83 +0.69 +0.5 +--> + + +<!--**========================================================================== +mal2html.css.custom +Allows extension stylesheets to extend or override CSS +:Stub: true + +This stub template has no content. Extension stylesheets can override this +template to output extra CSS. +--> +<xsl:template name="mal2html.css.custom"/> + +</xsl:stylesheet> diff --git a/sandbox/mallard/xslt/mal2html-inline.xsl b/sandbox/mallard/xslt/mal2html-inline.xsl new file mode 100644 index 0000000..8db29d9 --- /dev/null +++ b/sandbox/mallard/xslt/mal2html-inline.xsl @@ -0,0 +1,246 @@ +<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> +<!-- +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; see the file COPYING.LGPL. If not, write to the +Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:mal="http://www.gnome.org/~shaunm/mallard" + xmlns="http://www.w3.org/1999/xhtml" + version="1.0"> + +<!--!!========================================================================== +Mallard to HTML - Inline Elements + +REMARK: Describe this module +--> + + +<!--**========================================================================== +mal2html.span +Renders an inline element as a #{span} +$node: The element to render +$content: An optional parameter specifying the content of the #{span} + +REMARK: Document this template +--> +<xsl:template name="mal2html.span"> + <xsl:param name="node" select="."/> + <xsl:param name="content" select="false()"/> + <span class="{local-name($node)}"> + <xsl:choose> + <xsl:when test="$node/@xref"> + <a class="xref"> + <xsl:attribute name="href"> + <xsl:call-template name="mal.link.target"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="xref" select="$node/@xref"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:call-template name="mal.link.tooltip"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="xref" select="$node/@xref"/> + </xsl:call-template> + </xsl:attribute> + <xsl:choose> + <xsl:when test="$content"> + <xsl:copy-of select="$content"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates mode="mal2html.inline.mode" select="$node/node()"/> + </xsl:otherwise> + </xsl:choose> + </a> + </xsl:when> + <xsl:when test="$node/@href"> + <a class="href" href="{$node/@href}"> + <xsl:attribute name="title"> + <xsl:call-template name="mal.link.tooltip"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="href" select="$node/@href"/> + </xsl:call-template> + </xsl:attribute> + <xsl:choose> + <xsl:when test="$content"> + <xsl:copy-of select="$content"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates mode="mal2html.inline.mode" select="$node/node()"/> + </xsl:otherwise> + </xsl:choose> + </a> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$content"> + <xsl:copy-of select="$content"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates mode="mal2html.inline.mode" select="$node/node()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </span> +</xsl:template> + + +<!--**========================================================================== +mal2html.inline.css +Outputs CSS that controls the appearance of inline elements + +REMARK: Describe this template +--> +<xsl:template name="mal2html.inline.css"> +<xsl:text> +span.app { color: red; } +span.cmd { font-family: monospace; } +span.code { font-family: monospace; } +span.em { font-style: italic; } +span.email { color: red; } +span.file { font-family: monospace; } +span.gui { color: red; } +span.input { color: red; } +span.key { color: red; } +span.output { color: red; } +span.sys { font-family: monospace; } +span.var { font-style: italic; } +</xsl:text> +</xsl:template> + + +<!-- == Matched Templates == --> + +<!-- = app = --> +<xsl:template mode="mal2html.inline.mode" match="mal:app"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = cmd = --> +<xsl:template mode="mal2html.inline.mode" match="mal:cmd"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = code = --> +<xsl:template mode="mal2html.inline.mode" match="mal:code"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = date = --> +<xsl:template mode="mal2html.inline.mode" match="mal:date"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = em = --> +<xsl:template mode="mal2html.inline.mode" match="mal:em"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = email = --> +<xsl:template mode="mal2html.inline.mode" match="mal:email"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = file = --> +<xsl:template mode="mal2html.inline.mode" match="mal:file"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = gui = --> +<xsl:template mode="mal2html.inline.mode" match="mal:gui"> + <!-- FIXME: menu --> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = input = --> +<xsl:template mode="mal2html.inline.mode" match="mal:input"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = key = --> +<xsl:template mode="mal2html.inline.mode" match="mal:key"> + <!-- FIXME: keycombo --> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = link = --> +<xsl:template mode="mal2html.inline.mode" match="mal:link"> + <xsl:call-template name="mal2html.span"> + <xsl:with-param name="content"> + <xsl:choose> + <xsl:when test="normalize-space(.) != ''"> + <xsl:apply-templates/> + </xsl:when> + <xsl:when test="@xref"> + <xsl:call-template name="mal.link.content"> + <xsl:with-param name="node" select="."/> + <xsl:with-param name="xref" select="@xref"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@href"> + <xsl:value-of select="@href"/> + </xsl:when> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> +</xsl:template> + +<!-- = media = --> +<xsl:template mode="mal2html.inline.mode" match="mal:media"> + <!-- FIXME --> +</xsl:template> + +<!-- = name = --> +<xsl:template mode="mal2html.inline.mode" match="mal:name"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = output = --> +<xsl:template mode="mal2html.inline.mode" match="mal:output"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = quote = --> +<xsl:template mode="mal2html.inline.mode" match="mal:quote"> + <!-- FIXME: auto-quote --> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = sys = --> +<xsl:template mode="mal2html.inline.mode" match="mal:sys"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = var = --> +<xsl:template mode="mal2html.inline.mode" match="mal:var"> + <xsl:call-template name="mal2html.span"/> +</xsl:template> + +<!-- = text() = --> +<xsl:template mode="mal2html.inline.mode" match="text()"> + <xsl:value-of select="."/> +</xsl:template> + +<!-- = FIXME = --> +<xsl:template mode="mal2html.inline.mode" match="*"> + <xsl:message> + <xsl:text>Unmatched inline element: </xsl:text> + <xsl:value-of select="local-name(.)"/> + </xsl:message> + <xsl:apply-templates mode="mal2html.inline.mode"/> +</xsl:template> + +</xsl:stylesheet> diff --git a/sandbox/mallard/xslt/mal2html.xsl b/sandbox/mallard/xslt/mal2html.xsl new file mode 100644 index 0000000..b7e4447 --- /dev/null +++ b/sandbox/mallard/xslt/mal2html.xsl @@ -0,0 +1,85 @@ +<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> +<!-- +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; see the file COPYING.LGPL. If not, write to the +Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:mal="http://www.gnome.org/~shaunm/mallard" + xmlns="http://www.w3.org/1999/xhtml" + version="1.0"> + +<!--!!========================================================================== +Mallard to HTML + +REMARK: Describe this module +--> + +<xsl:include href="mal-link.xsl"/> + +<xsl:include href="mal2html-block.xsl"/> +<xsl:include href="mal2html-css.xsl"/> +<xsl:include href="mal2html-inline.xsl"/> + +<xsl:param name="mal.extension" select="'.xhtml'"/> + +<xsl:template match="/mal:guide | /mal:topic"> + <html> + <head> + <title> + <xsl:value-of select="mal:title"/> + </title> + <xsl:call-template name="mal2html.css"/> + </head> + <body> + <div class="body"> + <xsl:apply-templates mode="mal2html.block.mode"/> + </div> + </body> + </html> +</xsl:template> + +<xsl:template mode="mal2html.block.mode" match="mal:section"> + <div class="section" id="{@id}"> + <xsl:apply-templates mode="mal2html.block.mode"/> + </div> +</xsl:template> + +<xsl:template mode="mal2html.block.mode" match="mal:title"> + <xsl:variable name="depth" + select="count(ancestor::mal:section) + 1"/> + <xsl:element name="{concat('h', $depth)}"> + <xsl:apply-templates/> + </xsl:element> +</xsl:template> + +<xsl:template match="*"> + <xsl:message> + <xsl:text>Unmatched element: </xsl:text> + <xsl:value-of select="local-name(.)"/> + </xsl:message> + <xsl:apply-templates/> +</xsl:template> + +<!-- FIXME --> +<xsl:template name="l10n.gettext"> + <xsl:param name="msgid" select="'email.tooltip'"/> + <xsl:value-of select="$msgid"/> +</xsl:template> +<xsl:template name="l10n.direction"> + <xsl:text>ltr</xsl:text> +</xsl:template> + +</xsl:stylesheet> diff --git a/sandbox/mallard/xslt/mal2rnc.xsl b/sandbox/mallard/xslt/mal2rnc.xsl new file mode 100644 index 0000000..baaeb0d --- /dev/null +++ b/sandbox/mallard/xslt/mal2rnc.xsl @@ -0,0 +1,31 @@ +<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> +<!-- +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; see the file COPYING.LGPL. If not, write to the +Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:mal="http://www.gnome.org/~shaunm/mallard" + version="1.0"> + +<xsl:output method="text"/> + +<xsl:template match="/"> + <xsl:for-each select="//mal:code[@mime='application/relax-ng-compact-syntax']"> + <xsl:value-of select="."/> + </xsl:for-each> +</xsl:template> + +</xsl:stylesheet> |