[Groonga-commit] ranguba/chupa-text at 356fde1 [master] opendocument-spreadsheet: add support for covered-table-cell

Back to archive index
Kouhei Sutou null+****@clear*****
Fri Mar 1 12:29:20 JST 2019


Kouhei Sutou	2019-03-01 12:29:20 +0900 (Fri, 01 Mar 2019)

  Revision: 356fde1819c4ecc90e37963da1933f300ef2d41b
  https://github.com/ranguba/chupa-text/commit/356fde1819c4ecc90e37963da1933f300ef2d41b

  Message:
    opendocument-spreadsheet: add support for covered-table-cell

  Added files:
    test/fixture/ods/covered-table-cell.ods
  Modified files:
    lib/chupa-text/decomposers/opendocument-spreadsheet.rb
    test/decomposers/test-open-document-spreadsheet.rb

  Modified: lib/chupa-text/decomposers/opendocument-spreadsheet.rb (+5 -1)
===================================================================
--- lib/chupa-text/decomposers/opendocument-spreadsheet.rb    2019-03-01 12:17:04 +0900 (255b166)
+++ lib/chupa-text/decomposers/opendocument-spreadsheet.rb    2019-03-01 12:29:20 +0900 (a5236ce)
@@ -98,8 +98,12 @@ module ChupaText
         end
 
         def end_element(uri, local_name, qname)
-          @in_p = false
           case uri
+          when TEXT_URI
+            case local_name
+            when "p"
+              @in_p = false
+            end
           when TABLE_URI
             case local_name
             when "table"

  Modified: test/decomposers/test-open-document-spreadsheet.rb (+19 -19)
===================================================================
--- test/decomposers/test-open-document-spreadsheet.rb    2019-03-01 12:17:04 +0900 (32039e7)
+++ test/decomposers/test-open-document-spreadsheet.rb    2019-03-01 12:29:20 +0900 (392dd7e)
@@ -87,9 +87,9 @@ class TestDecomposersOpenDocumentSpreadsheet < Test::Unit::TestCase
       end
     end
 
-    sub_test_case("one sheet") do
-      def decompose
-        super(fixture_path("ods", "one-sheet.ods")).collect do |data|
+    sub_test_case("sheets") do
+      def decompose(path)
+        super(path).collect do |data|
           [
             data["index"],
             data["name"],
@@ -98,7 +98,7 @@ class TestDecomposersOpenDocumentSpreadsheet < Test::Unit::TestCase
         end
       end
 
-      def test_body
+      def test_one_sheet
         assert_equal([
                        [nil, nil, ""],
                        [
@@ -108,22 +108,10 @@ class TestDecomposersOpenDocumentSpreadsheet < Test::Unit::TestCase
                          "Sheet1 - A2\tSheet1 - B2\n",
                        ],
                      ],
-                     decompose)
-      end
-    end
-
-    sub_test_case("multi sheets") do
-      def decompose
-        super(fixture_path("ods", "multi-sheets.ods")).collect do |data|
-          [
-            data["index"],
-            data["name"],
-            data.body,
-          ]
-        end
+                     decompose(fixture_path("ods", "one-sheet.ods")))
       end
 
-      def test_body
+      def test_multi_sheets
         assert_equal([
                        [nil, nil, ""],
                        [
@@ -145,7 +133,19 @@ class TestDecomposersOpenDocumentSpreadsheet < Test::Unit::TestCase
                          "Sheet3 - A2\tSheet3 - B2\n",
                        ],
                      ],
-                     decompose)
+                     decompose(fixture_path("ods", "multi-sheets.ods")))
+      end
+
+      def test_covered_table_cell
+        assert_equal([
+                       [nil, nil, ""],
+                       [
+                         0,
+                         "Sheet1",
+                         "Covered-table-cell\t\n",
+                       ],
+                     ],
+                     decompose(fixture_path("ods", "covered-table-cell.ods")))
       end
     end
   end

  Added: test/fixture/ods/covered-table-cell.ods (+30 -0) 100644
===================================================================
--- /dev/null
+++ test/fixture/ods/covered-table-cell.ods    2019-03-01 12:29:20 +0900 (76cff57)
@@ -0,0 +1,30 @@
+MIME-Version: 1.0
+mime-type: application/vnd.oasis.opendocument.spreadsheet
+uri: file:/tmp/Hy19zB_covered-table-cell.ods
+path: /tmp/Hy19zB_covered-table-cell.ods
+size: 7584
+Content-Type: multipart/mixed; boundary=boundary
+
+--boundary
+mime-type: text/plain
+uri: file:/tmp/Hy19zB_covered-table-cell.txt
+path: /tmp/Hy19zB_covered-table-cell.txt
+size: 0
+created_time: 2019-03-01 12:17:45 +0900
+modified_time: 2019-03-01 12:18:30 +0900
+source-mime-types: ["application/vnd.oasis.opendocument.spreadsheet"]
+generator: LibreOffice/6.1.5.2$Linux_X86_64 LibreOffice_project/10$Build-2
+
+
+--boundary
+mime-type: text/plain
+uri: file:/tmp/Hy19zB_covered-table-cell.txt
+path: /tmp/Hy19zB_covered-table-cell.txt
+size: 19
+source-mime-types: ["application/vnd.oasis.opendocument.spreadsheet"]
+index: 0
+name: Sheet1
+
+Covered-table-cell
+
+--boundary--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190301/c0c59799/attachment-0001.html>


More information about the Groonga-commit mailing list
Back to archive index