Import Upstream version 1.0.2

This commit is contained in:
su-fang 2022-09-16 13:55:36 +08:00
commit 9bb57e0e61
580 changed files with 9361 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
*~
/build/
/dist/
/ducktype.egg-info/
/tests/*.out
__pycache__/

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
Shaun McCance <shaunm@gnome.org>

17
COPYING Normal file
View File

@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

19
README.md Normal file
View File

@ -0,0 +1,19 @@
# mallard-ducktype
Parser for the lightweight Ducktype syntax for Mallard
## Install Ducktype
Ducktype is Python-3-only, so to build and install:
```
python3 setup.py build
sudo python3 setup.py install
```
Or to get the latest version uploaded to pypi:
```
virtualenv --python=python3 venv
source venv/bin/activate
pip-python3 install mallard-ducktype
```

58
bin/ducktype Executable file
View File

@ -0,0 +1,58 @@
#!/usr/bin/env python3
# -*- Mode: python; indent-tabs-mode: nil -*-
# Copyright (c) 2014 Shaun McCance <shaunm@gnome.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import argparse
import os
import sys
import mallard.ducktype
if __name__ == '__main__':
argparser = argparse.ArgumentParser()
argparser.add_argument('-o', '--output', nargs='?',
help='specify the output file or directory')
argparser.add_argument('files', nargs='+',
help='list of input duck files')
args = argparser.parse_args()
if args.output is not None:
if len(args.files) > 1 and not os.path.isdir(args.output):
sys.stderr.write('Output must be a directory for multiple files\n')
sys.exit(1)
for file in args.files:
try:
parser = mallard.ducktype.DuckParser()
parser.parse_file(file)
parser.finish()
except mallard.ducktype.SyntaxError as e:
sys.stderr.write(e.fullmessage + '\n')
basename = os.path.basename(file)
if basename.endswith('.duck'):
basename = basename[:-5]
if args.output is None:
outfile = os.path.join(os.path.dirname(file), basename + '.page')
elif os.path.isdir(args.output):
# FIXME: try to recreate directory structure?
outfile = os.path.join(args.output, basename + '.page')
else:
outfile = args.output
parser.document.write_xml(outfile)

19
mallard/__init__.py Normal file
View File

@ -0,0 +1,19 @@
# Copyright (c) 2015 Shaun McCance <shaunm@gnome.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

21
mallard/ducktype/__init__.py Executable file
View File

@ -0,0 +1,21 @@
# Copyright (c) 2014-2015 Shaun McCance <shaunm@gnome.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from .parser import DuckParser, SyntaxError

2262
mallard/ducktype/entities.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
# Copyright (c) 2018 Shaun McCance <shaunm@gnome.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
__import__('pkg_resources').declare_namespace(__name__)

View File

@ -0,0 +1,200 @@
# Copyright (c) 2018 Shaun McCance <shaunm@gnome.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
################################################################################
# This is a test extension. Its primary purpose is to fuel regression tests.
# Since it exercises all the extension points, it's heavily commented so you
# can learn from it.
import mallard.ducktype
# All extensions are a subclass of ParserExtension. When the parser encounters an
# extension declaration like foo/1.0, it imports mallard.ducktype.extensions.foo
# and tries to instantiate every ParserExtension subclass in it. It doesn't matter
# what you name your classes.
class TestExtension(mallard.ducktype.parser.ParserExtension):
def __init__(self, parser, prefix, version):
# Usually you'd use this to specify a version to make sure this code is
# compatible with what the document expects. In this case, though, we're
# using the version to specify which parts of the test extension to use.
if version == 'block':
self.mode = 'block'
elif version == 'blocknode':
self.mode = 'blocknode'
elif version == 'directive':
self.mode = 'directive'
else:
raise mallard.ducktype.parser.SyntaxError(
'Unsupported _test extension version: ' + version,
parser)
# It's important to bear in mind that parser might not always be a
# DuckParser object. Depending on the extension and where it's used,
# parser might be something like a DirectiveIncludeParser or an
# InlineParser.
self.parser = parser
self.prefix = prefix
self.version = version
# Feel free to do things to the parser or the document root here.
self.parser.document.add_namespace('test', 'http://projectmallard.org/test/')
def parse_line_block(self, line):
# This is the function to implement to do things in a block context,
# like adding a shorthand notation for a block element. It gets
# called only in places where a regular block element could occur.
# Headers, comments, and fences have already been taken care of.
# If you want to add a block extension with a syntax that looks
# like a standard block declaration, use take_block_node instead.
# That method will handle a lot more things for you.
if self.mode != 'block':
return False
indent = mallard.ducktype.parser.DuckParser.get_indent(line)
iline = line[indent:]
# Return False to indicate you're not handling this line. For
# this test, we're doing something with lines that start with
# three asterisks and a space.
if not iline.startswith('*** '):
return False
# In most cases when creating block elements, you'll want to start
# by calling push_text and unravel_for_block. push_text makes sure
# any text lines we just encountered get put into a block element.
# unravel_for_block gets you to the correct current element to start
# adding new block elements, based on indentation and the standard
# block nesting rules. There are other unravel functions for special
# nesting rules for tables and lists.
self.parser.push_text()
self.parser.unravel_for_block(indent)
# Here's the meat of what this extension does. It creates a block
# element, adds an attribute to it, adds the element to the current
# element (which unravel_for_block got us to), then sets the new
# element as the current element. Setting the new element as the
# current element lets the parser add content to it. If you want
# to add something that doesn't take content, don't set it as
# current.
qnode = mallard.ducktype.parser.Block('test:TEST', indent, parser=self.parser)
qnode.attributes = mallard.ducktype.parser.Attributes()
qnode.attributes.add_attribute('line', iline[4:].strip())
self.parser.current.add_child(qnode)
self.parser.current = qnode
# This lets the parser know that we've just created a block element
# and it's ready to take on new content. This is important because
# the first child element will set the inner indent of our new block
# element. Don't bother with this if you're adding something that
# doesn't take content (and you didn't set as current).
self.parser.state = mallard.ducktype.parser.DuckParser.STATE_BLOCK_READY
# Return True to indicate you have handled the line. The parser will
# stop trying to do anything else with this line.
return True
def take_block_node(self, node):
# This is the function to implement to do things with extension
# elements that looks like block nodes. It gets called on a Node
# object that has alredy been parsed as if it were a block node,
# but it has not been added to the document. This will only be
# called for nodes with a prefix matching the base name of your
# extension. For example, this extension is _test.py, so it will
# be called for things like:
# [_test:block]
# [_test:frobnicate]
# It will not be called for things like:
# [test:block]
# [_test_frobnicate]
# If you want to add block syntax that doesn't look like a
# standard block declaration, use parse_line_block instead.
if self.mode != 'blocknode':
return False
# Return False to indicate you're not handling this node. If no
# extensions handle the node, the parser will try to treat it
# as a regular block node, requiring a suitable namespace prefix
# binding. If it can't find one, it will raise an error. For this
# test, we're doing something with block declarations that look
# like [_test:block]
if node.name != '_test:block':
return False
# If you read the comments on parse_line_block, you might be tempted
# to call push_text and unravel_for_block here. But you don't have
# to. The parser has already parsed this thing as if it were a block
# declaration, and that includes pushing text and unraveling.
# Here's the meat of what this extension does. Instead of allowing
# the passed-in node to go into the document, it creates a new node.
# It copies over the attributes from the extension block element,
# and even adds its own attribute value. You could do completely
# different things with the attributes. If you want to add something
# that doesn't take content, don't set it as current.
qnode = mallard.ducktype.parser.Block('note', outer=node.outer, parser=self.parser)
qnode.attributes = mallard.ducktype.parser.Attributes()
# It's safe to add a style attribute and then add other attributes
# without checking their names. Attributes objects automatically
# join multiple style and type attributes into space-separated lists.
qnode.attributes.add_attribute('style', 'warning')
if node.attributes is not None:
for attr in node.attributes.get_attributes():
qnode.attributes.add_attribute(attr, node.attributes.get_attribute(attr))
self.parser.current.add_child(qnode)
self.parser.current = qnode
# If you read the comments on parse_line_block, you might be tempted
# to set self.parser.state here. Don't bother, unless you actually
# really need to set it to something other than STATE_BLOCK_READY.
# The parser has already entered that state by the time extensions
# get a crack at block declarations.
# Return True to indicate you have handled the node. The parser will
# stop trying to do anything else with this node.
return True
def take_directive(self, directive):
# This is the function to implement to handle parser directives at
# the top of a file. This will only be called for directives with
# a prefix matching the base name of your extension. For example,
# this extension is _test.py, so it will be called for things like:
# @_test:defines
# @_test:frobnicate
# It will not be called for things like:
# @test:defines
# @_test_frobnicate
if self.mode != 'directive':
return False
if directive.name == '_test:defines':
# This extension recognizes a simple directive like this:
# @_test:defines
# And treats it like it defined something lengthier. Just add
# that definition to the main document, and we're done. For a
# directive parser extension, the calling parser might be a
# DirectiveIncludeParser instead of a DuckParser. But that's
# OK, because DirectiveIncludeParser also has a document
# attribute that points to the right place.
self.parser.document.add_definition('TEST',
'This is a $em(test). ' +
'It is only a $em[.strong](test).')
# Return True to tell the parser we handled this directive.
return True
else:
return False

View File

@ -0,0 +1,73 @@
# Copyright (c) 2019 Shaun McCance <shaunm@gnome.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import mallard.ducktype
# FIXME:
# * Copy over attributes from ext node to table node
# * Except maybe we want some ext attrs:
# * Ext attr to change separator char? (csv:sep=tab)
# * Ext attr to control row and col headers?
# * Ext attr to parse lines inline? Or should that be default?
# * Set inner indent to allow newlines?
class CsvExtension(mallard.ducktype.parser.ParserExtension):
def __init__(self, parser, prefix, version):
if version == 'experimental':
self.version = version
else:
raise mallard.ducktype.parser.SyntaxError(
'Unsupported csv extension version: ' + version,
parser)
self.parser = parser
self.prefix = prefix
self.version = version
self.table = None
def take_block_node(self, node):
if node.name != 'csv:table':
return False
self.table = mallard.ducktype.parser.Block('table')
# Normally table elements are "greedy", meaning they have special
# rules that allow them to consume more stuff at the same indent
# level. These tables, however, are different. Turn off greedy to
# let the parser do its job.
self.table.is_greedy = False
self.parser.current.add_child(self.table)
self.parser.current = self.table
return True
def parse_line_block(self, line):
if self.table is None:
return False
else:
if self.table is not self.parser.current:
self.table = None
return False
tr = mallard.ducktype.parser.Block('tr')
self.parser.current.add_child(tr)
cells = line.split(',')
for cell in cells:
td = mallard.ducktype.parser.Block('td')
tr.add_child(td)
tdp = mallard.ducktype.parser.Block('p')
td.add_child(tdp)
tdp.add_text(cell)
return True

View File

@ -0,0 +1,122 @@
# Copyright (c) 2019 Shaun McCance <shaunm@gnome.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import mallard.ducktype
NSDB = 'http://docbook.org/ns/docbook'
# FIXME: change output file extension
leafs = ('abbrev', 'acronym', 'address', 'arg', 'artpagenums', 'authorinitials',
'bibliocoverage', 'biblioid', 'bibliomisc', 'bibliomixed', 'bibliomset',
'bibliorelation', 'bibliosource', 'bridgehead', 'caption', 'citation',
'classsynopsisinfo', 'command', 'confdates', 'confnum', 'confsponsor',
'conftitle', 'contractnum', 'contractsponsor', 'contrib', 'date',
'edition', 'email', 'exceptionname', 'firstname', 'funcdef', 'funcparams',
'funcsynopsisinfo', 'givenname', 'glosssee', 'glossseealso', 'glossterm',
'holder', 'honorific', 'initializer', 'issuenum', 'jobtitle', 'keyword',
'lhs', 'lineage', 'link', 'literallayout', 'manvolnum', 'member',
'methodname', 'modifier', 'msgaud', 'msglevel', 'msgorig', 'option',
'orgdiv', 'orgname', 'othername', 'pagenums', 'para', 'paramdef',
'parameter', 'personname', 'phrase', 'primary', 'primaryie', 'productname',
'productnumber', 'programlisting', 'pubdate', 'publishername', 'quote',
'refclass', 'refdescriptor', 'refentrytitle', 'refmiscinfo', 'refname',
'refpurpose', 'releaseinfo', 'remark', 'replaceable', 'revnumber',
'revremark', 'rhs', 'screen', 'secondary', 'secondaryie', 'see',
'seealso', 'seealsoie', 'seeie', 'seg', 'segtitle', 'seriesvolnums',
'shortaffil', 'simpara', 'subjectterm', 'subtitle', 'surname',
'synopfragmentref', 'synopsis', 'term', 'tertiary', 'tertiaryie',
'title', 'titleabbrev', 'tocentry', 'type', 'uri', 'varname',
'volumenum', 'year')
class DocBookNodeFactory(mallard.ducktype.parser.NodeFactory):
def __init__(self, parser):
super().__init__(parser)
self.id_attribute = 'xml:id'
def create_block_node(self, name, outer):
node = mallard.ducktype.parser.Block(name, outer=outer, parser=self.parser)
if name in leafs:
node.is_leaf = True
return node
def create_block_paragraph_node(self, outer):
return self.create_block_node('para', outer=outer)
def create_info_node(self, name, outer):
node = mallard.ducktype.parser.Info(name, outer=outer, parser=self.parser)
if name in leafs:
node.is_leaf = True
return node
def create_info_paragraph_node(self, outer):
return self.create_info_node('para', outer=outer)
def handle_division_title(self, depth, inner):
name = 'article' if (depth == 1) else 'section'
page = mallard.ducktype.parser.Division(name, depth=depth, parser=self.parser)
title = mallard.ducktype.parser.Block('title', inner=inner, parser=self.parser)
self.parser.current.add_child(page)
page.add_child(title)
self.parser.current = title
def handle_info_container(self, outer):
info = mallard.ducktype.parser.Block('info', outer=outer, parser=self.parser)
self.parser.current.add_child(info)
self.parser.current.info = info
info.parent = self.parser.current
def handle_block_item_content(self, outer, inner):
# bibliolist
# calloutlist/callout
# glosslist
# FIXME: procedure/step substeps/step
# qandaset
# segmentedlist
# simplelist
# tocentry
# variablelist
if self.parser.current.is_name(('itemizedlist', 'orderedlist')):
item = mallard.ducktype.parser.Block('listitem', outer=outer, inner=inner, parser=self.parser)
self.parser.current.add_child(item)
self.parser.current = item
return item
else:
node = mallard.ducktype.parser.Block('itemizedlist', outer=outer, parser=self.parser)
self.parser.current.add_child(node)
item = mallard.ducktype.parser.Block('listitem', outer=outer, inner=inner, parser=self.parser)
node.add_child(item)
self.parser.current = item
return item
class DocBookExtension(mallard.ducktype.parser.ParserExtension):
def __init__(self, parser, prefix, version):
if version == 'experimental':
self.version = version
else:
raise mallard.ducktype.parser.SyntaxError(
'Unsupported docbook extension version: ' + version,
parser)
self.parser = parser
self.prefix = prefix
self.version = version
self.parser.document.default_namespace = NSDB
parser.factory = DocBookNodeFactory(parser)

View File

@ -0,0 +1,76 @@
# Copyright (c) 2018 Shaun McCance <shaunm@gnome.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import mallard.ducktype
IFURI = 'http://projectmallard.org/if/1.0/'
class IfExtension(mallard.ducktype.parser.ParserExtension):
def __init__(self, parser, prefix, version):
if version == 'experimental':
self.version = version
else:
raise mallard.ducktype.parser.SyntaxError(
'Unsupported if extension version: ' + version,
parser)
self.parser = parser
self.prefix = prefix
self.version = version
self.parser.document.add_namespace('if', IFURI)
def parse_line_block(self, line):
indent = mallard.ducktype.parser.DuckParser.get_indent(line)
iline = line[indent:]
if iline.strip() == '??':
self.parser.push_text()
self.parser.unravel_for_block(indent)
if self.parser.current.is_name('choose', IFURI):
elname = 'if:else'
else:
elname = 'if:choose'
qnode = mallard.ducktype.parser.Block(elname, indent, parser=self.parser)
self.parser.current.add_child(qnode)
self.parser.current = qnode
self.parser.state = mallard.ducktype.parser.DuckParser.STATE_BLOCK_READY
return True
if iline.startswith('? '):
self.parser.push_text()
self.parser.unravel_for_block(indent)
if self.parser.current.is_name('choose', IFURI):
elname = 'if:when'
else:
elname = 'if:if'
qnode = mallard.ducktype.parser.Block(elname, indent, parser=self.parser)
qnode.attributes = mallard.ducktype.parser.Attributes()
qnode.attributes.add_attribute('test', iline[2:].strip())
self.parser.current.add_child(qnode)
self.parser.current = qnode
self.parser.state = mallard.ducktype.parser.DuckParser.STATE_BLOCK_READY
return True
return False

1791
mallard/ducktype/parser.py Normal file

File diff suppressed because it is too large Load Diff

28
setup.py Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python
from setuptools import setup
setup(
name='mallard-ducktype',
version='1.0.2',
description='Parse Ducktype files and convert them to Mallard.',
packages=['mallard', 'mallard.ducktype', 'mallard.ducktype.extensions'],
scripts=['bin/ducktype'],
author='Shaun McCance',
author_email='shaunm@gnome.org',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Customer Service',
'Intended Audience :: Developers',
'Intended Audience :: Other Audience',
'Intended Audience :: System Administrators',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Documentation',
'Topic :: Software Development :: Documentation',
'Topic :: Text Processing :: Markup',
'Topic :: Text Processing :: Markup :: XML',
'License :: OSI Approved :: MIT License',
],
)

4
tests/attr01.duck Normal file
View File

@ -0,0 +1,4 @@
= Attribute Test
[type="topic" style="hint1 hint2"]
This is a test.

5
tests/attr01.page Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" style="hint1 hint2" id="attr01">
<title>Attribute Test</title>
<p>This is a test.</p>
</page>

4
tests/attr02.duck Normal file
View File

@ -0,0 +1,4 @@
= Attribute Test
[.hint1 .hint2]
This is a test.

5
tests/attr02.page Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" style="hint1 hint2" id="attr02">
<title>Attribute Test</title>
<p>This is a test.</p>
</page>

5
tests/attr03.duck Normal file
View File

@ -0,0 +1,5 @@
= Attribute Test
[type="topic"
style="hint1"]
This is a test.

5
tests/attr03.page Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" style="hint1" id="attr03">
<title>Attribute Test</title>
<p>This is a test.</p>
</page>

6
tests/attr04.duck Normal file
View File

@ -0,0 +1,6 @@
= Attribute Test
[type="topic" #page1
style="hint1"
.hint2]
This is a test.

5
tests/attr04.page Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" id="page1" style="hint1 hint2">
<title>Attribute Test</title>
<p>This is a test.</p>
</page>

5
tests/attr05.duck Normal file
View File

@ -0,0 +1,5 @@
= Attribute Test
[type=topic
style=hint1 id=attr05]
This is a test.

5
tests/attr05.page Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" style="hint1" id="attr05">
<title>Attribute Test</title>
<p>This is a test.</p>
</page>

4
tests/attr06.duck Normal file
View File

@ -0,0 +1,4 @@
= Attribute Test
[topic style=hint1]
This is a test.

5
tests/attr06.page Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" style="hint1" id="attr06">
<title>Attribute Test</title>
<p>This is a test.</p>
</page>

4
tests/attr07.duck Normal file
View File

@ -0,0 +1,4 @@
= Attribute Test
[style=hint1 topic]
This is a test.

5
tests/attr07.page Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" style="hint1" type="topic" id="attr07">
<title>Attribute Test</title>
<p>This is a test.</p>
</page>

5
tests/attr08.duck Normal file
View File

@ -0,0 +1,5 @@
= Attribute Test
[style="hint1
hint2" topic]
This is a test.

6
tests/attr08.page Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" style="hint1
hint2" type="topic" id="attr08">
<title>Attribute Test</title>
<p>This is a test.</p>
</page>

4
tests/attr09.duck Normal file
View File

@ -0,0 +1,4 @@
= Attribute Test
Let's test some escapes.
$app[style="$$ $* $= $- $. $@ $[ $] $( $) $" $'"]()

6
tests/attr09.page Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="attr09">
<title>Attribute Test</title>
<p>Let's test some escapes.
<app style="$ * = - . @ [ ] ( ) &quot; '"></app></p>
</page>

4
tests/attr10.duck Normal file
View File

@ -0,0 +1,4 @@
= Attribute Test
[code xml mallard]
<page/>

5
tests/attr10.page Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="attr10">
<title>Attribute Test</title>
<code type="xml mallard">&lt;page/></code>
</page>

4
tests/attr11.duck Normal file
View File

@ -0,0 +1,4 @@
= Attribute Test
[code no:style=xml]
<page/>

1
tests/attr11.error Normal file
View File

@ -0,0 +1 @@
attr11.duck:3: Unrecognized namespace prefix: no

4
tests/attr12.duck Normal file
View File

@ -0,0 +1,4 @@
= Attribute Test
[code no:style="xml"]
<page/>

1
tests/attr12.error Normal file
View File

@ -0,0 +1 @@
attr12.duck:3: Unrecognized namespace prefix: no

4
tests/block01.duck Normal file
View File

@ -0,0 +1,4 @@
= Block Test
[note]
This paragraph is in a note.

7
tests/block01.page Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block01">
<title>Block Test</title>
<note>
<p>This paragraph is in a note.</p>
</note>
</page>

6
tests/block02.duck Normal file
View File

@ -0,0 +1,6 @@
= Block Test
[note]
[note]
[note]
This paragraph is in a note in a note in a note.

11
tests/block02.page Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block02">
<title>Block Test</title>
<note>
<note>
<note>
<p>This paragraph is in a note in a note in a note.</p>
</note>
</note>
</note>
</page>

9
tests/block03.duck Normal file
View File

@ -0,0 +1,9 @@
= Block Test
[note]
[note]
This paragraph is in a note in a note.
This is still paragraph 1.
This is still in the top note.
This is still pargraph 2.

12
tests/block03.page Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block03">
<title>Block Test</title>
<note>
<note>
<p>This paragraph is in a note in a note.
This is still paragraph 1.</p>
</note>
<p>This is still in the top note.
This is still pargraph 2.</p>
</note>
</page>

7
tests/block04.duck Normal file
View File

@ -0,0 +1,7 @@
= Block Test
[note]
[note]
This paragraph is in a note in a note.
This is a new paragraph in a note in a note.

10
tests/block04.page Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block04">
<title>Block Test</title>
<note>
<note>
<p>This paragraph is in a note in a note.</p>
<p>This is a new paragraph in a note in a note.</p>
</note>
</note>
</page>

8
tests/block05.duck Normal file
View File

@ -0,0 +1,8 @@
= Block Test
[note]
This paragraph is in a note.
There is a double line break above and below this line.

8
tests/block05.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block05">
<title>Block Test</title>
<note>
<p>This paragraph is in a note.</p>
<p>There is a double line break above and below this line.</p>
</note>
</page>

7
tests/block06.duck Normal file
View File

@ -0,0 +1,7 @@
= Block Test
[note]
[note]
This paragraph is in two notes.
This paragraph breaks out of both.

10
tests/block06.page Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block06">
<title>Block Test</title>
<note>
<note>
<p>This paragraph is in two notes.</p>
</note>
</note>
<p>This paragraph breaks out of both.</p>
</page>

6
tests/block07.duck Normal file
View File

@ -0,0 +1,6 @@
= Block Test
[note]
This is a paragraph in a note.
[note]
This is a paragraph in a note in a note.

10
tests/block07.page Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block07">
<title>Block Test</title>
<note>
<p>This is a paragraph in a note.</p>
<note>
<p>This is a paragraph in a note in a note.</p>
</note>
</note>
</page>

8
tests/block08.duck Normal file
View File

@ -0,0 +1,8 @@
= Block Test
[figure]
[title]
This is a figure title.
[desc]
This is a figure desc.
This is a paragraph in a figure.

9
tests/block08.page Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block08">
<title>Block Test</title>
<figure>
<title>This is a figure title.</title>
<desc>This is a figure desc.</desc>
<p>This is a paragraph in a figure.</p>
</figure>
</page>

9
tests/block09.duck Normal file
View File

@ -0,0 +1,9 @@
= Block Test
[figure]
[title]
This is a figure title.
[desc]
This is a figure desc.
[note]
This is a paragraph in a note in a figure.

11
tests/block09.page Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block09">
<title>Block Test</title>
<figure>
<title>This is a figure title.</title>
<desc>This is a figure desc.</desc>
<note>
<p>This is a paragraph in a note in a figure.</p>
</note>
</figure>
</page>

9
tests/block10.duck Normal file
View File

@ -0,0 +1,9 @@
= Block Test
[figure]
[title]
This is a figure title.
[desc]
This is a figure desc.
This is a paragraph in a figure.

9
tests/block10.page Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block10">
<title>Block Test</title>
<figure>
<title>This is a figure title.</title>
<desc>This is a figure desc.</desc>
<p>This is a paragraph in a figure.</p>
</figure>
</page>

4
tests/block11.duck Normal file
View File

@ -0,0 +1,4 @@
= Block Test
[note style="tip"]
This is a note

7
tests/block11.page Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block11">
<title>Block Test</title>
<note style="tip">
<p>This is a note</p>
</note>
</page>

6
tests/block12.duck Normal file
View File

@ -0,0 +1,6 @@
= Block Test
[note
.tip
]
This is a note

7
tests/block12.page Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block12">
<title>Block Test</title>
<note style="tip">
<p>This is a note</p>
</note>
</page>

7
tests/block13.duck Normal file
View File

@ -0,0 +1,7 @@
= Block Test
[note]
[note]
This is a note in a note.
[note]
This is a note.

12
tests/block13.page Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block13">
<title>Block Test</title>
<note>
<note>
<p>This is a note in a note.</p>
</note>
</note>
<note>
<p>This is a note.</p>
</note>
</page>

6
tests/block14.duck Normal file
View File

@ -0,0 +1,6 @@
= Block Test
[note]
[p]
This is in a note.
This is not in a note.

8
tests/block14.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block14">
<title>Block Test</title>
<note>
<p>This is in a note.</p>
</note>
<p>This is not in a note.</p>
</page>

5
tests/block15.duck Normal file
View File

@ -0,0 +1,5 @@
= Block Test
[note]
. Note Title
This is a note.

8
tests/block15.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block15">
<title>Block Test</title>
<note>
<title>Note Title</title>
<p>This is a note.</p>
</note>
</page>

11
tests/block16.duck Normal file
View File

@ -0,0 +1,11 @@
= Block Test
[note]
. Note Title
This is a note.
[note]
. Note
Title
This is a note.

13
tests/block16.page Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block16">
<title>Block Test</title>
<note>
<title>Note Title</title>
<p>This is a note.</p>
</note>
<note>
<title>Note
Title</title>
<p>This is a note.</p>
</note>
</page>

5
tests/block17.duck Normal file
View File

@ -0,0 +1,5 @@
= Block Test
[note]
[media src="foo.png"]
This paragraph is out of the note.

8
tests/block17.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block17">
<title>Block Test</title>
<note>
<media src="foo.png"/>
</note>
<p>This paragraph is out of the note.</p>
</page>

5
tests/block18.duck Normal file
View File

@ -0,0 +1,5 @@
= Block Test
[media src="foo.png"]
This paragraph is not in the media element.

6
tests/block18.page Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block18">
<title>Block Test</title>
<media src="foo.png"/>
<p>This paragraph is not in the media element.</p>
</page>

8
tests/block19.duck Normal file
View File

@ -0,0 +1,8 @@
= Block Test
[links section]
[links topic groups="#first"]
. First
[links topic]

9
tests/block19.page Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block19">
<title>Block Test</title>
<links type="section"/>
<links type="topic" groups="#first">
<title>First</title>
</links>
<links type="topic"/>
</page>

12
tests/block20.duck Normal file
View File

@ -0,0 +1,12 @@
@namespace tt http://www.w3.org/ns/ttml
= Block Test
This tests leaf nodes in other namespaces.
[media video src=video.mp4]
[tt:tt]
[tt:body]
[tt:div begin="1s" end="3s"]
[tt:p]
This should not have a Mallard p element added.

14
tests/block20.page Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:tt="http://www.w3.org/ns/ttml" id="block20">
<title>Block Test</title>
<p>This tests leaf nodes in other namespaces.</p>
<media type="video" src="video.mp4">
<tt:tt>
<tt:body>
<tt:div begin="1s" end="3s">
<tt:p>This should not have a Mallard p element added.</tt:p>
</tt:div>
</tt:body>
</tt:tt>
</media>
</page>

8
tests/block21.duck Normal file
View File

@ -0,0 +1,8 @@
@namespace if http://projectmallard.org/if/1.0/
= Block Test
This tests leaf nodes in other namespaces.
[if:if test=target:html]
This should have a Mallard p element added.

8
tests/block21.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:if="http://projectmallard.org/if/1.0/" id="block21">
<title>Block Test</title>
<p>This tests leaf nodes in other namespaces.</p>
<if:if test="target:html">
<p>This should have a Mallard p element added.</p>
</if:if>
</page>

8
tests/block22.duck Normal file
View File

@ -0,0 +1,8 @@
@namespace mal http://projectmallard.org/1.0/
= Block Test
This tests leaf nodes in other namespaces.
[mal:div]
This should have a Mallard p element added.

8
tests/block22.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:mal="http://projectmallard.org/1.0/" id="block22">
<title>Block Test</title>
<p>This tests leaf nodes in other namespaces.</p>
<mal:div>
<p>This should have a Mallard p element added.</p>
</mal:div>
</page>

8
tests/block23.duck Normal file
View File

@ -0,0 +1,8 @@
@namespace mal http://projectmallard.org/1.0/
= Block Test
This tests leaf nodes in other namespaces.
[mal:screen]
This should not have a Mallard p element added.

6
tests/block23.page Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:mal="http://projectmallard.org/1.0/" id="block23">
<title>Block Test</title>
<p>This tests leaf nodes in other namespaces.</p>
<mal:screen>This should not have a Mallard p element added.</mal:screen>
</page>

9
tests/block24.duck Normal file
View File

@ -0,0 +1,9 @@
@namespace if http://projectmallard.org/if/1.0/
= Block Test
This tests leaf nodes in other namespaces.
[if:choose]
[if:when test=target:html]
This should have a Mallard p element added.

10
tests/block24.page Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:if="http://projectmallard.org/if/1.0/" id="block24">
<title>Block Test</title>
<p>This tests leaf nodes in other namespaces.</p>
<if:choose>
<if:when test="target:html">
<p>This should have a Mallard p element added.</p>
</if:when>
</if:choose>
</page>

10
tests/block25.duck Normal file
View File

@ -0,0 +1,10 @@
= Block Test
[div]
[title]
Title
[desc]
Desc
[cite]
Cite
This paragraph is in the div

10
tests/block25.page Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block25">
<title>Block Test</title>
<div>
<title>Title</title>
<desc>Desc</desc>
<cite>Cite</cite>
<p>This paragraph is in the div</p>
</div>
</page>

6
tests/block26.duck Normal file
View File

@ -0,0 +1,6 @@
= Block Test
[example]
@title[ui:expanded] Expanded Title
[code]
code

10
tests/block26.page Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="block26">
<title>Block Test</title>
<example>
<info>
<title type="ui:expanded">Expanded Title</title>
</info>
<code>code</code>
</example>
</page>

6
tests/comment01.duck Normal file
View File

@ -0,0 +1,6 @@
= Comment Test
This is a paragraph.
[--
This is commented out.
--]
This is still the first paragraph.

6
tests/comment01.page Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="comment01">
<title>Comment Test</title>
<p>This is a paragraph.
This is still the first paragraph.</p>
</page>

8
tests/comment02.duck Normal file
View File

@ -0,0 +1,8 @@
= Comment Test
[note]
This is in the note.
[--
This is commented out.
--]
This is still the first paragraph in the note.

8
tests/comment02.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="comment02">
<title>Comment Test</title>
<note>
<p>This is in the note.
This is still the first paragraph in the note.</p>
</note>
</page>

8
tests/comment03.duck Normal file
View File

@ -0,0 +1,8 @@
= Comment Test
[note]
This is in the note.
[--
This is commented out.
--]
This is still the first paragraph in the note.

8
tests/comment03.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="comment03">
<title>Comment Test</title>
<note>
<p>This is in the note.
This is still the first paragraph in the note.</p>
</note>
</page>

9
tests/comment04.duck Normal file
View File

@ -0,0 +1,9 @@
= Comment Test
[note]
This is in the note.
[--
This is commented out.
--]
This is a new paragraph in the note.

8
tests/comment04.page Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" id="comment04">
<title>Comment Test</title>
<note>
<p>This is in the note.</p>
<p>This is a new paragraph in the note.</p>
</note>
</page>

9
tests/comment05.duck Normal file
View File

@ -0,0 +1,9 @@
= Comment Test
[note]
This is in the note.
[-] This is commented out.
This is a new paragraph in the note.
[-] This is commented out.
This is still in that paragraph.

Some files were not shown because too many files have changed in this diff Show More