Commit b1af84e1 authored by jan.koester's avatar jan.koester
Browse files

test

parent 4cb2d399
Loading
Loading
Loading
Loading
+26 −0
Changes for editor/src/htmlimport.cpp: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1449,10 +1449,36 @@ void blogi::htmlimport::htmlElementToWidgetXml(
                        std::transform(liTag.begin(), liTag.end(), liTag.begin(),
                            [](unsigned char c) { return std::tolower(c); });
                        if (liTag == "li") {
                            bool liHasChildElements = false;
                            libhtmlpp::Element *liChild = li->firstChild();
                            while (liChild) {
                                if (liChild->getType() == libhtmlpp::HtmlEl) {
                                    liHasChildElements = true;
                                    break;
                                }
                                liChild = liChild->nextElement();
                            }

                            if (!liHasChildElements) {
                                tinyxml2::XMLElement *itemEl = doc.NewElement("Item");
                                std::string itemHtml = serializeInnerHtml(li);
                                itemEl->SetText(itemHtml.c_str());
                                w->InsertEndChild(itemEl);
                            } else {
                                // Rich <li> content (nested elements, e.g. a
                                // process-slider step's <figure>+caption, or
                                // a feature-list card) doesn't fit the plain-
                                // text Item model -- push the <li> itself to
                                // be decomposed as a real child widget
                                // instead (handled exactly like a <div> in
                                // the main dispatch above). List already
                                // supports arbitrary child widgets alongside
                                // Items, each implicitly wrapped in its own
                                // <li> at render time -- see list.cpp's
                                // Render(), which renders `items` text
                                // entries and child widgets independently.
                                childFrames.push_back({liEl, w, nullptr, elementEnv});
                            }
                        }
                    }
                    liEl = liEl->nextElement();