diff --git a/experiments/.html-tidy b/experiments/.html-tidy new file mode 100644 index 000000000..58487a897 --- /dev/null +++ b/experiments/.html-tidy @@ -0,0 +1,99 @@ +accessibility-check: 0 (Tidy Classic) +add-meta-charset: no +add-xml-decl: no +add-xml-space: no +alt-text: +anchor-as-name: yes +ascii-chars: no +assume-xml-procins: no +bare: no +break-before-br: no +char-encoding: utf8 +clean: no +coerce-endtags: no +css-prefix: c +custom-tags: no +decorate-inferred-ul: no +doctype: html5 +drop-empty-elements: no +drop-empty-paras: no +drop-proprietary-attributes: no +enclose-block-text: no +enclose-text: no +error-file: +escape-cdata: no +escape-scripts: yes +fix-backslash: yes +fix-bad-comments: auto +fix-style-tags: yes +fix-uri: no +force-output: yes +gdoc: no +gnu-emacs: no +hide-comments: no +indent: auto +indent-attributes: no +indent-cdata: no +indent-spaces: 2 +indent-with-tabs: no +input-encoding: utf8 +input-xml: no +join-classes: no +join-styles: yes +keep-tabs: no +keep-time: no +literal-attributes: no +logical-emphasis: no +lower-literals: yes +markup: yes +merge-divs: auto +merge-emphasis: yes +merge-spans: auto +mute: +mute-id: no +ncr: yes +new-blocklevel-tags: x-odr-s +new-empty-tags: +new-inline-tags: +new-pre-tags: +newline: LF +numeric-entities: no +omit-optional-tags: no +output-bom: auto +output-encoding: utf8 +output-file: +output-html: no +output-xhtml: no +output-xml: no +preserve-entities: yes +priority-attributes: +punctuation-wrap: no +quiet: no +quote-ampersand: yes +quote-marks: no +quote-nbsp: yes +repeated-attributes: keep-last +replace-color: no +show-body-only: no +show-errors: 6 +show-info: yes +show-meta-change: no +show-warnings: yes +skip-nested: yes +sort-attributes: alpha +strict-tags-attributes: no +tab-size: 4 +tidy-mark: no +uppercase-attributes: no +uppercase-tags: no +vertical-space: no +warn-proprietary-attributes: yes +word-2000: no +wrap: 0 +wrap-asp: no +wrap-attributes: no +wrap-jste: no +wrap-php: no +wrap-script-literals: no +wrap-sections: no +write-back: no \ No newline at end of file diff --git a/src/odr/internal/html/document_element.cpp b/src/odr/internal/html/document_element.cpp index 4e7e428c1..34f33aa68 100644 --- a/src/odr/internal/html/document_element.cpp +++ b/src/odr/internal/html/document_element.cpp @@ -250,11 +250,10 @@ void html::translate_line_break(Element element, std::ostream &out, void html::translate_paragraph(Element element, std::ostream &out, const HtmlConfig &config) { auto paragraph = element.paragraph(); - auto text_style_attribute = - optional_style_attribute(translate_text_style(paragraph.text_style())); out << ""; translate_children(paragraph.children(), out, config); if (paragraph.first_child()) { @@ -265,6 +264,8 @@ void html::translate_paragraph(Element element, std::ostream &out, // TODO example `style-missing+image-1.odt` first paragraph has no height } else { + auto text_style_attribute = + optional_style_attribute(translate_text_style(paragraph.text_style())); out << ""; } out << ""; @@ -398,12 +399,10 @@ void html::translate_frame(Element element, std::ostream &out, auto style = frame.style(); out << ""; translate_children(frame.children(), out, config); - out << ""; } diff --git a/src/odr/internal/odf/odf_parser.cpp b/src/odr/internal/odf/odf_parser.cpp index 9a3972137..656606043 100644 --- a/src/odr/internal/odf/odf_parser.cpp +++ b/src/odr/internal/odf/odf_parser.cpp @@ -196,7 +196,7 @@ odf::parse_any_element_tree(Document &document, pugi::xml_node node) { {"draw:circle", parse_element_tree}, {"draw:custom-shape", parse_element_tree}, {"draw:text-box", parse_element_tree}, - {"draw:g", parse_element_tree}, + {"draw:g", parse_element_tree}, {"draw:a", parse_element_tree}, {"style:master-page", parse_element_tree}}; diff --git a/src/odr/internal/odf/odf_spreadsheet.cpp b/src/odr/internal/odf/odf_spreadsheet.cpp index d1e6d024e..f912e3ee6 100644 --- a/src/odr/internal/odf/odf_spreadsheet.cpp +++ b/src/odr/internal/odf/odf_spreadsheet.cpp @@ -253,6 +253,17 @@ void Sheet::init_dimensions_(TableDimensions dimensions) { m_index.dimensions = dimensions; } +void Sheet::append_shape_(Element *shape) { + shape->m_previous_sibling = m_last_shape; + shape->m_parent = this; + if (m_last_shape == nullptr) { + m_first_shape = shape; + } else { + m_last_shape->m_next_sibling = shape; + } + m_last_shape = shape; +} + } // namespace odr::internal::odf namespace odr::internal { @@ -331,7 +342,12 @@ odf::parse_element_tree(Document &document, pugi::xml_node node) { sheet.init_dimensions_(dimensions); - // TODO shapes + for (auto shape_node : node.child("table:shapes").children()) { + auto [shape, _] = parse_any_element_tree(document, shape_node); + if (shape != nullptr) { + sheet.append_shape_(shape); + } + } return std::make_tuple(&sheet, node.next_sibling()); } diff --git a/src/odr/internal/odf/odf_spreadsheet.hpp b/src/odr/internal/odf/odf_spreadsheet.hpp index 243911661..e22377e85 100644 --- a/src/odr/internal/odf/odf_spreadsheet.hpp +++ b/src/odr/internal/odf/odf_spreadsheet.hpp @@ -87,6 +87,7 @@ class Sheet final : public Element, public abstract::Sheet { void init_cell_element_(std::uint32_t column, std::uint32_t row, SheetCell *element); void init_dimensions_(TableDimensions dimensions); + void append_shape_(Element *shape); common::ResolvedStyle cell_style_(const abstract::Document *, std::uint32_t column, @@ -97,6 +98,7 @@ class Sheet final : public Element, public abstract::Sheet { std::unordered_map m_cells; Element *m_first_shape{nullptr}; + Element *m_last_shape{nullptr}; }; template <>