git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: test for custom styles.

This just tests whether a custom style with a recognizable style (italic etc, defined in a reference.docx) will roundtrip back to that format (i.e., whether `<span custom-style="Emphasized">` will roundtrip to `Emph`). The custom styles are defined in the `custom-style-reference.docx` included in the docx dir.

commitd416f6241079a8d596fd071ed3dc20c4a60a6069 authorJesse Rosenthal <jrosenthal@jhu.edu> dateMon 15 Aug 2016, 15:33 (10 years ago) parent663f689
4 files changed+18
tests/Tests/Writers/Docx.hs+8 tests/docx/custom-style-reference.docx tests/docx/custom-style-roundtrip-end.native+5 tests/docx/custom-style-roundtrip-start.native+5
tests/Tests/Writers/Docx.hs+8
@@ -137,5 +137,13 @@ tests = [ testGroup "inlines"
137137 "stop recording metadata with normal text"
138138 "docx/metadata_after_normal.native"
139139 ]
140+ , testGroup "customized styles"
141+ [ testCompareWithOpts
142+ ( def{writerReferenceDocx=Just "docx/custom-style-reference.docx"}
143+ , def)
144+ "simple customized blocks and inlines"
145+ "docx/custom-style-roundtrip-start.native"
146+ "docx/custom-style-roundtrip-end.native"
147+ ]
140148
141149 ]
tests/docx/custom-style-reference.docxnew file

Binary file not shown.

tests/docx/custom-style-roundtrip-end.nativenew file+5
@@ -0,0 +1,5 @@
1+[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "custom-styles."]
2+,Para [Str "Here",Space,Str "is",Space,Str "something",Space,Emph [Str "emphasized"],Str ".",Space,Str "And",Space,Str "here",Space,Str "is",Space,Str "something",Space,Strong [Str "strong"],Str "."]
3+,BlockQuote
4+ [Para [Str "One",Space,Str "paragraph",Space,Str "of",Space,Str "text."]
5+ ,Para [Str "And",Space,Str "another",Space,Str "paragraph",Space,Str "of",Space,Emph [Str "really",Space,Str "cool"],Space,Str "text."]]]
tests/docx/custom-style-roundtrip-start.nativenew file+5
@@ -0,0 +1,5 @@
1+[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "custom-styles."]
2+,Para [Str "Here",Space,Str "is",Space,Str "something",Space,Span ("",[],[("custom-style","Emphatic")]) [Str "emphasized"],Str ".",Space,Str "And",SoftBreak,Str "here",Space,Str "is",Space,Str "something",Space,Span ("",[],[("custom-style","Strengthened")]) [Str "strong"],Str "."]
3+,Div ("",[],[("custom-style","My Block Style")])
4+ [Para [Str "One",Space,Str "paragraph",Space,Str "of",Space,Str "text."]
5+ ,Para [Str "And",Space,Str "another",Space,Str "paragraph",Space,Str "of",Space,Span ("",[],[("custom-style","Emphatic")]) [Str "really",SoftBreak,Str "cool"],Space,Str "text."]]]