From 015dead0bb2bb5cea06a0fa366fdd651c8e07889 Mon Sep 17 00:00:00 2001 From: hubertp-lshift Date: Sat, 26 Nov 2016 21:45:56 +0100 Subject: [odt] Infer table's caption from the paragraph (#3224) ODT's reader always put empty captions for the parsed tables. This commit 1) checks paragraphs that follow the table definition 2) treats specially a paragraph with a style named 'Table' 3) does some postprocessing of the paragraphs that combines tables followed immediately by captions The ODT writer used 'TableCaption' style name for the caption paragraph. This commit follows the open office approach which allows for appending captions to table but uses a built-in style named 'Table' instead of 'TableCaption'. Any users of odt format (both writer and reader) are therefore required to change the style's name to 'Table', if necessary. --- tests/Tests/Readers/Odt.hs | 1 + tests/odt/native/simpleTableWithCaption.native | 1 + tests/odt/odt/simpleTableWithCaption.odt | Bin 0 -> 10396 bytes tests/tables.opendocument | 10 ++++------ 4 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 tests/odt/native/simpleTableWithCaption.native create mode 100644 tests/odt/odt/simpleTableWithCaption.odt (limited to 'tests') diff --git a/tests/Tests/Readers/Odt.hs b/tests/Tests/Readers/Odt.hs index d6ed48f8d..cd764dd62 100644 --- a/tests/Tests/Readers/Odt.hs +++ b/tests/Tests/Readers/Odt.hs @@ -157,6 +157,7 @@ namesOfTestsComparingToNative = [ "blockquote" , "referenceToListItem" , "referenceToText" , "simpleTable" + , "simpleTableWithCaption" -- , "table" , "unicode" , "unorderedList" diff --git a/tests/odt/native/simpleTableWithCaption.native b/tests/odt/native/simpleTableWithCaption.native new file mode 100644 index 000000000..18d68b772 --- /dev/null +++ b/tests/odt/native/simpleTableWithCaption.native @@ -0,0 +1 @@ +[Table [Str "Table",Space,Str "1:",Space,Str "Some",Space,Str "caption",Space,Str "for",Space,Str "a",Space,Str "table"] [AlignDefault,AlignDefault] [0.0,0.0] [[],[]] [[[Plain [Str "Content"]],[Plain [Str "More",Space,Str "content"]]]],Para []] diff --git a/tests/odt/odt/simpleTableWithCaption.odt b/tests/odt/odt/simpleTableWithCaption.odt new file mode 100644 index 000000000..ec6fac894 Binary files /dev/null and b/tests/odt/odt/simpleTableWithCaption.odt differ diff --git a/tests/tables.opendocument b/tests/tables.opendocument index aa35abc91..0765bb783 100644 --- a/tests/tables.opendocument +++ b/tests/tables.opendocument @@ -63,8 +63,7 @@ -Demonstration of simple table -syntax. +Demonstration of simple table syntax. Simple table without caption: @@ -197,8 +196,7 @@ spaces: -Demonstration of simple table -syntax. +Demonstration of simple table syntax. Multiline table with caption: @@ -253,8 +251,8 @@ caption: -Here's the caption. It may span -multiple lines. +Here's the caption. It may span multiple +lines. Multiline table without caption: -- cgit v1.2.3