aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2014-07-27 15:11:18 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2014-07-29 13:03:01 -0400
commit840108a9c11850089a27a3b5458f8561ab1b6a2e (patch)
treedb96e841d15bec4173db7257dc58b0ef17bdb960 /tests
parent3eff3782c1cfde8c1cdb4d5461dfb4bf09168e9c (diff)
downloadpandoc-840108a9c11850089a27a3b5458f8561ab1b6a2e.tar.gz
Docx reader: Make metavalues out of styled paragraphs.
This will make paragraphs styled with `Author`, `Title`, `Subtitle`, `Date`, and `Abstract` into pandoc metavalues, rather than text. The implementation only takes those elements from the beginning of the document (ignoring empty paragraphs). Multiple paragraphs in the `Author` style will be made into a metaList, one paragraph per item. Hard linebreaks (shift-return) in the paragraph will be maintained, and can be used for institution, email, etc.
Diffstat (limited to 'tests')
-rw-r--r--tests/Tests/Readers/Docx.hs15
-rw-r--r--tests/docx.metadata.docxbin0 -> 40487 bytes
-rw-r--r--tests/docx.metadata.native2
-rw-r--r--tests/docx.metadata_after_normal.docxbin0 -> 57273 bytes
-rw-r--r--tests/docx.metadata_after_normal.native7
-rw-r--r--tests/docx.metadata_author_linebreak.docxbin0 -> 40481 bytes
-rw-r--r--tests/docx.metadata_author_linebreak.native2
7 files changed, 26 insertions, 0 deletions
diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs
index 7b737f95a..8ad9e08ba 100644
--- a/tests/Tests/Readers/Docx.hs
+++ b/tests/Tests/Readers/Docx.hs
@@ -164,5 +164,20 @@ tests = [ testGroup "inlines"
"docx.track_changes_deletion.docx"
"docx.track_changes_deletion_all.native"
]
+ , testGroup "metadata"
+ [ testCompareWithOpts def{readerStandalone=True}
+ "metadata fields"
+ "docx.metadata.docx"
+ "docx.metadata.native"
+ , testCompareWithOpts def{readerStandalone=True}
+ "linebreak between authors"
+ "docx.metadata_author_linebreak.docx"
+ "docx.metadata_author_linebreak.native"
+ , testCompareWithOpts def{readerStandalone=True}
+ "stop recording metadata with normal text"
+ "docx.metadata_after_normal.docx"
+ "docx.metadata_after_normal.native"
+ ]
+
]
diff --git a/tests/docx.metadata.docx b/tests/docx.metadata.docx
new file mode 100644
index 000000000..34182a87e
--- /dev/null
+++ b/tests/docx.metadata.docx
Binary files differ
diff --git a/tests/docx.metadata.native b/tests/docx.metadata.native
new file mode 100644
index 000000000..ed7ba63cf
--- /dev/null
+++ b/tests/docx.metadata.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("abstract",MetaInlines [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "how",Space,Str "this",Space,Str "all",Space,Str "works.",Space,Str "I\8217ve",Space,Str "skipped",Space,Str "lines",Space,Str "here,",Space,Str "which",Space,Str "pandoc",Space,Str "doesn\8217t",Space,Str "do,",Space,Str "but",Space,Str "which",Space,Str "shouldn\8217t",Space,Str "make",Space,Str "a",Space,Str "difference."]),("author",MetaList [MetaInlines [Str "Mary",Space,Str "Ann",Space,Str "Evans"],MetaInlines [Str "Aurore",Space,Str "Dupin"]]),("date",MetaInlines [Str "July",Space,Str "28,",Space,Str "2014"]),("title",MetaInlines [Str "This",Space,Str "Is",Space,Str "the",Space,Str "Title"])]})
+[Para [Str "And",Space,Str "now",Space,Str "this",Space,Str "is",Space,Str "normal",Space,Str "text."]]
diff --git a/tests/docx.metadata_after_normal.docx b/tests/docx.metadata_after_normal.docx
new file mode 100644
index 000000000..16b8d583c
--- /dev/null
+++ b/tests/docx.metadata_after_normal.docx
Binary files differ
diff --git a/tests/docx.metadata_after_normal.native b/tests/docx.metadata_after_normal.native
new file mode 100644
index 000000000..f0e31f8da
--- /dev/null
+++ b/tests/docx.metadata_after_normal.native
@@ -0,0 +1,7 @@
+Pandoc (Meta {unMeta = fromList [("abstract",MetaInlines [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "how",Space,Str "this",Space,Str "all",Space,Str "works.",Space,Str "I\8217ve",Space,Str "skipped",Space,Str "lines",Space,Str "here,",Space,Str "which",Space,Str "pandoc",Space,Str "doesn\8217t",Space,Str "do,",Space,Str "but",Space,Str "which",Space,Str "shouldn\8217t",Space,Str "make",Space,Str "a",Space,Str "difference."]),("author",MetaList [MetaInlines [Str "Mary",Space,Str "Ann",Space,Str "Evans"],MetaInlines [Str "Aurore",Space,Str "Dupin"]]),("date",MetaInlines [Str "July",Space,Str "28,",Space,Str "2014"]),("title",MetaInlines [Str "This",Space,Str "Is",Space,Str "the",Space,Str "Title"])]})
+[Para [Str "And",Space,Str "now",Space,Str "this",Space,Str "is",Space,Str "normal",Space,Str "text."]
+,Para [Str "This",Space,Str "Is",Space,Str "the",Space,Str "Title"]
+,Para [Str "Mary",Space,Str "Ann",Space,Str "Evans"]
+,Para [Str "Aurore",Space,Str "Dupin"]
+,Para [Str "July",Space,Str "28,",Space,Str "2014"]
+,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "how",Space,Str "this",Space,Str "all",Space,Str "works.",Space,Str "I\8217ve",Space,Str "skipped",Space,Str "lines",Space,Str "here,",Space,Str "which",Space,Str "pandoc",Space,Str "doesn\8217t",Space,Str "do,",Space,Str "but",Space,Str "which",Space,Str "shouldn\8217t",Space,Str "make",Space,Str "a",Space,Str "difference."]]
diff --git a/tests/docx.metadata_author_linebreak.docx b/tests/docx.metadata_author_linebreak.docx
new file mode 100644
index 000000000..94f0e0753
--- /dev/null
+++ b/tests/docx.metadata_author_linebreak.docx
Binary files differ
diff --git a/tests/docx.metadata_author_linebreak.native b/tests/docx.metadata_author_linebreak.native
new file mode 100644
index 000000000..ed7ba63cf
--- /dev/null
+++ b/tests/docx.metadata_author_linebreak.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("abstract",MetaInlines [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "how",Space,Str "this",Space,Str "all",Space,Str "works.",Space,Str "I\8217ve",Space,Str "skipped",Space,Str "lines",Space,Str "here,",Space,Str "which",Space,Str "pandoc",Space,Str "doesn\8217t",Space,Str "do,",Space,Str "but",Space,Str "which",Space,Str "shouldn\8217t",Space,Str "make",Space,Str "a",Space,Str "difference."]),("author",MetaList [MetaInlines [Str "Mary",Space,Str "Ann",Space,Str "Evans"],MetaInlines [Str "Aurore",Space,Str "Dupin"]]),("date",MetaInlines [Str "July",Space,Str "28,",Space,Str "2014"]),("title",MetaInlines [Str "This",Space,Str "Is",Space,Str "the",Space,Str "Title"])]})
+[Para [Str "And",Space,Str "now",Space,Str "this",Space,Str "is",Space,Str "normal",Space,Str "text."]]