From 35f12b5095799e41b563f47a7923a1d01015c71c Mon Sep 17 00:00:00 2001 From: Frerich Raabe Date: Wed, 23 Sep 2015 22:53:50 +0200 Subject: Added proper support for DocBook 'xref' elements 'xref' is used to create cross references to other parts of the document. It is an empty element - the cross reference text depends on various attributes. Quoting 'DocBook: The Definitive Guide': 1. If the endterm attribute is specified on xref, the content of the element pointed to by endterm will be used as the text of the cross-reference. 2. Otherwise, if the object pointed to has a specified XRefLabel, the content of that attribute will be used as the cross-reference text. --- tests/Tests/Old.hs | 2 ++ tests/docbook-xref.docbook | 70 ++++++++++++++++++++++++++++++++++++++++++++++ tests/docbook-xref.native | 29 +++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 tests/docbook-xref.docbook create mode 100644 tests/docbook-xref.native (limited to 'tests') diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs index 047ad0481..5cfee9f76 100644 --- a/tests/Tests/Old.hs +++ b/tests/Tests/Old.hs @@ -105,6 +105,8 @@ tests = [ testGroup "markdown" [ testGroup "writer" $ writerTests "docbook" , test "reader" ["-r", "docbook", "-w", "native", "-s"] "docbook-reader.docbook" "docbook-reader.native" + , test "reader" ["-r", "docbook", "-w", "native", "-s"] + "docbook-xref.docbook" "docbook-xref.native" ] , testGroup "native" [ testGroup "writer" $ writerTests "native" diff --git a/tests/docbook-xref.docbook b/tests/docbook-xref.docbook new file mode 100644 index 000000000..ebcd94d00 --- /dev/null +++ b/tests/docbook-xref.docbook @@ -0,0 +1,70 @@ + +An Example Book +XRef Samples + +This paragraph demonstrates several features of +XRef. + + +A straight link generates the +cross-reference text: . + +A link to an element with an +XRefLabel: +. + +A link with an +EndTerm: +. + +A link to an +cmdsynopsis element: . + +A link to an +funcsynopsis element: . + + + + + + The Second Chapter + Some content here + + + + The Third Chapter + Some content here + + + + The Fourth Chapter + Chapter 4 + Some content here + + + chgrp + -R + + -H + -L + -P + + + -f + group + file + + + + + +int max +int int1 +int int2 + + + + + + diff --git a/tests/docbook-xref.native b/tests/docbook-xref.native new file mode 100644 index 000000000..70027b2c5 --- /dev/null +++ b/tests/docbook-xref.native @@ -0,0 +1,29 @@ +Pandoc (Meta {unMeta = fromList []}) +[Header 1 ("ch01",[],[]) [Str "XRef",Space,Str "Samples"] +,Para [Str "This",Space,Str "paragraph",Space,Str "demonstrates",Space,Str "several",Space,Str "features",Space,Str "of",Space,Str "XRef."] +,BulletList + [[Para [Str "A",Space,Str "straight",Space,Str "link",Space,Str "generates",Space,Str "the",Space,Str "cross-reference",Space,Str "text:",Space,Link [Str "???"] ("#ch02",""),Str "."]] + ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "element",Space,Str "with",Space,Str "an",Space,Str "XRefLabel:",Space,Link [Str "Chapter the Third"] ("#ch03",""),Str "."]] + ,[Para [Str "A",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "EndTerm:",Space,Link [Str "Chapter 4"] ("#ch04",""),Str "."]] + ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "cmdsynopsis",Space,Str "element:",Space,Link [Str "???"] ("#cmd01",""),Str "."]] + ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "funcsynopsis",Space,Str "element:",Space,Link [Str "???"] ("#func01",""),Str "."]]] +,Header 1 ("ch02",[],[]) [Str "The",Space,Str "Second",Space,Str "Chapter"] +,Para [Str "Some",Space,Str "content",Space,Str "here"] +,Header 1 ("ch03",[],[]) [Str "The",Space,Str "Third",Space,Str "Chapter"] +,Para [Str "Some",Space,Str "content",Space,Str "here"] +,Header 1 ("ch04",[],[]) [Str "The",Space,Str "Fourth",Space,Str "Chapter"] +,Para [Str "Some",Space,Str "content",Space,Str "here"] +,Plain [Str "chgrp"] +,Plain [Str "-R"] +,Plain [Str "-H"] +,Plain [Str "-L"] +,Plain [Str "-P"] +,Plain [Str "-f"] +,Plain [Str "group"] +,Plain [Str "file"] +,Plain [Str "int"] +,Plain [Str "max"] +,Plain [Str "int"] +,Plain [Str "int1"] +,Plain [Str "int"] +,Plain [Str "int2"]] -- cgit v1.2.3