mosaic-headless 1.33.0 → 1.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SKILL.md CHANGED
@@ -5,7 +5,7 @@ description: |
5
5
  license: "MIT"
6
6
  metadata:
7
7
  author: "moksa (https://moksaweb.com)"
8
- version: "1.33.0"
8
+ version: "1.33.1"
9
9
  homepage: "https://github.com/Moksa1123/mosaic-headless"
10
10
  ---
11
11
 
@@ -825,6 +825,15 @@ post — `build_all.py` resets first for that reason.
825
825
  default - it is a `<span>`, a label rather than a control. Measured all three.
826
826
  `menu-link` and `wysiwyg-link` still render `<span>` without a `url`.
827
827
  - **`text` renders as `<div>` by default** — set `tagName` for `<h1>`, `<p>` and so on.
828
+ - **A `wysiwyg-text` run prints no markup since 1.0.11.** Its `<` and `>` are escaped
829
+ on output, so `A<strong>B</strong>C<br>D` reaches the page as those literal
830
+ characters (measured: `A&lt;strong&gt;B&lt;/strong&gt;C&lt;br&gt;D`). Inline
831
+ formatting is a node: `wysiwyg-span` → `<span class="m-span">` (style it),
832
+ `wysiwyg-linebreak` → `<br>`, `wysiwyg-link` with `url` →
833
+ `<a class="m-inline-link">`, each holding its own `wysiwyg-text` child. Entities
834
+ still print as their character (`&lt;dialog&gt;` → `<dialog>`, `&amp;` → `&`).
835
+ Through 1.0.10 the run was raw HTML instead, where a tag name in prose swallowed
836
+ the rest of the paragraph; `build_page.py` refuses any tag in a run either way.
828
837
  - **`menu-link` is `width: fit-content` by default** (`.m-menu-link{display:flex;gap:4px;
829
838
  padding:4px 8px;width:fit-content;…}`). Used as a cell of a button row or a grid -
830
839
  a phone contact bar on `2fr 1fr 1fr` - its background hugs the text and the cell
@@ -875,6 +884,7 @@ post — `build_all.py` resets first for that reason.
875
884
  | `verify_loop.py` | a decoration that runs forever: does it loop (paused-timeline scrub), does it bury text or controls anywhere a reader can rest, does it open by pointer and by keyboard, is it still under reduced motion? |
876
885
  | `probe_accordion.py` | the accordion family nested as its factory requires, plus the guard's refusal of the bare node - the probe that corrected two rows of this skill's own tables |
877
886
  | `from_elementor.py` | an Elementor `_elementor_data` tree -> a Mosaic page spec, with every element it cannot convert reported by name and reason (`--strict` to refuse a lossy spec) |
887
+ | `inline_html.py` | an HTML fragment -> `text` / `list` nodes with `wysiwyg-span` / `-link` / `-linebreak` inside, for content that arrives as HTML (a 1.0.11 text run prints tags literally); `from_elementor.py` uses it |
878
888
  | `verify_conversion.py` | did the conversion carry the page? every source string, image, link and heading level looked for on the delivered Mosaic page |
879
889
  | `sweep_node_types.py` | commit every node type one per document and assert the delivered HTML |
880
890
  | `sweep_style_properties.py` | write every style property and check the compiled CSS |
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 98 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.33.0"
23
+ "version": "1.33.1"
24
24
  },
25
25
  "loaderBehaviour": "Upload via Settings -> Skills -> Upload. Claude.ai parses SKILL.md frontmatter and surfaces the skill in your library. The extraction tool (extract-block-schema.php) needs a live WP-CLI connection and won't run in the sandbox; use it from a local terminal against your own site instead.",
26
26
  "uploadSteps": [
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 98 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.33.0"
23
+ "version": "1.33.1"
24
24
  },
25
25
  "loaderBehaviour": "Auto-loads on session start when SKILL.md frontmatter parses successfully.",
26
26
  "verified": true,
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 98 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.33.0"
23
+ "version": "1.33.1"
24
24
  },
25
25
  "loaderBehaviour": "Confirmed (2026-07-11): Codex CLI natively supports the SKILL.md spec. Place SKILL.md under .codex/skills/<name>/ (project) or ~/.codex/skills/<name>/ (personal) and Codex loads the name+description at session start, then the full body on demand. A parallel, broader convention .agents/skills/ (searched from cwd up to repo root, then ~/.agents/skills/) also exists across multiple tools - if your Codex CLI version prioritizes that path instead, mirror the same SKILL.md there.",
26
26
  "verified": true,
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 98 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.33.0"
23
+ "version": "1.33.1"
24
24
  },
25
25
  "loaderBehaviour": "CHANGED as of 2026-07-11: GitHub Copilot added a proper '.github/skills/' Agent Skills directory (December 2025), alongside the older single-file .github/copilot-instructions.md convention. This config targets the new skills-directory form. If your Copilot version predates this (pre Dec 2025), use the instructions-append fallback instead (see fallback below).",
26
26
  "fallback": {
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 98 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.33.0"
23
+ "version": "1.33.1"
24
24
  },
25
25
  "loaderBehaviour": "CHANGED as of 2026-07-11: Gemini CLI now natively supports the same SKILL.md standard as Claude Code and Codex CLI - the same directory-based skill works unmodified. Gemini CLI discovers skills in this precedence order: built-in, extension skills, ~/.gemini/skills/ (personal), .gemini/skills/ (project, shared via version control). At session start Gemini injects each discovered skill's name+description into the system prompt and calls activate_skill when a task matches.",
26
26
  "verified": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mosaic-headless",
3
- "version": "1.33.0",
3
+ "version": "1.33.1",
4
4
  "description": "AI-agent skill: build Mosaic Pro (Nextend) WordPress sites by writing the underlying data model directly - 23 custom tables, no visual editor, no DOM. Every node type, style property and node property swept against a live install and asserted on the delivered HTML and compiled CSS. Installs into Claude Code, Cursor, Codex CLI, Gemini CLI, Copilot, Continue, Windsurf and Claude.ai.",
5
5
  "keywords": [
6
6
  "wordpress",
@@ -276,6 +276,24 @@ offset units), the `kit` form action and its `kit_fields` endpoint, a
276
276
  Mailchimp / MailerLite endpoints moved under `Endpoints\Pro`. Node properties
277
277
  are the same 196 (the rows moved edition with their types).
278
278
 
279
+ **Text runs stopped printing HTML.** `WysiwygTextNodeMResource` now escapes `<` and
280
+ `>` in a `wysiwyg-text` run on output (`getEscapedText()`, NEXT-5875; `&` is left
281
+ alone so entities still work). A run carrying `<strong>` or `<br>` - a natural thing
282
+ for a conversion script to emit - prints the tags as text. Measured on the demo site:
283
+ `A<strong>B</strong>C<br>D` delivered as `A&lt;strong&gt;B&lt;/strong&gt;C&lt;br&gt;D`,
284
+ while sibling `wysiwyg-span`, `wysiwyg-linebreak` and `wysiwyg-link` nodes delivered
285
+ `<span class="m-span">`, `<br>` and `<a class="m-inline-link" href>`. None of the
286
+ demo pages used inline tags, so every verifier above still matched; it was a client
287
+ migration from Elementor that hit it, and fixed it by emitting the inline nodes.
288
+ `build_page.py` used to let `b|i|em|strong|br|span|a|code|sup|sub` through; it now
289
+ refuses every tag in a run. `from_elementor.py` was the worst case: it put a text-editor
290
+ widget's whole HTML into one run, so every converted paragraph came out as
291
+ `&lt;p&gt;…&lt;/p&gt;` on 1.0.11 - the demo site's old conversions show 57 to 88 literal
292
+ tags per page. It now parses the HTML with `tools/inline_html.py` into `text` / `list`
293
+ nodes with span, link and line-break nodes inside; pages converted before the fix
294
+ have to be converted again. `wysiwyg-link`'s `url` also gained `ValidatorURLAllowed`
295
+ and is printed through `Filter::escURL`.
296
+
279
297
  **SEO plugins read the render.** `Compatibility/WordPress/Integrations/Seo/`. On
280
298
  the post edit screen, the template body's HTML is handed to Yoast's and Rank Math's
281
299
  analysis (`rank_math_content`), with the Content element's slot replaced by a live
@@ -66,11 +66,11 @@ def load_csv(name):
66
66
  return list(csv.DictReader(fh))
67
67
 
68
68
 
69
- # Tags that may legitimately appear inside wysiwyg-text, which is raw HTML and is
70
- # where this skill's own pages put their inline emphasis. Everything else in prose
71
- # is almost certainly a tag NAME being discussed rather than markup intended to run.
72
- PROSE_TAG = re.compile(r"</?(?!(?:b|i|em|strong|br|span|a|code|sup|sub)\b)"
73
- r"[a-zA-Z][a-zA-Z0-9-]*\s*[^>]*>")
69
+ # Any tag inside wysiwyg-text. Since 1.0.11 the run's `<` and `>` are escaped on
70
+ # output (WysiwygTextNodeMResource::getEscapedText, NEXT-5875), so `<strong>` or
71
+ # `<br>` prints as those characters on the page. Inline formatting is written as
72
+ # nodes instead: wysiwyg-span, wysiwyg-linebreak, wysiwyg-link.
73
+ PROSE_TAG = re.compile(r"</?[a-zA-Z][a-zA-Z0-9-]*\s*[^>]*>")
74
74
  AT_RULE_GLUED = re.compile(
75
75
  r"@(media|supports|container|layer|scope|import|page|starting-style|"
76
76
  r"font-feature-values|counter-style|property|document)\(")
@@ -109,20 +109,21 @@ class Surface:
109
109
  # Measured both ways on the demo site (`@media (` renders, `@media(`
110
110
  # does not). Refused here for the same reason an unsafe type is: the
111
111
  # failure is silent at the only point this tool can still stop it.
112
- # `wysiwyg-text` is RAW HTML, not escaped text, so a tag NAME written in
113
- # prose opens an element and swallows the rest of the paragraph. "Mosaic's
114
- # modal is a real <dialog>" delivered the words up to "real" and nothing
115
- # after it. The commit succeeds and the page renders - it is just missing
116
- # most of its sentence, which is why this is worth refusing rather than
117
- # leaving to proofreading. Inline formatting tags are let through; anything
118
- # else has to be written as an entity.
112
+ # A tag in `wysiwyg-text` is wrong on every version, in opposite ways.
113
+ # Through 1.0.10 the run was raw HTML: "a real <dialog>" opened an element
114
+ # and the rest of the paragraph vanished. Since 1.0.11 `<` and `>` are
115
+ # escaped on output, so `<strong>` and `<br>` print literally (measured on
116
+ # the demo site). Either way the commit succeeds and only the page is wrong.
117
+ # An entity (`&lt;dialog&gt;`, `&amp;`) prints as its character on both;
118
+ # emphasis, breaks and links are their own nodes.
119
119
  if t == "wysiwyg-text" and not force:
120
120
  text = (node.get("data") or {}).get("text") or ""
121
121
  hit = PROSE_TAG.search(text)
122
122
  if hit:
123
- problems.append("wysiwyg-text contains `%s` - the text is raw HTML, so "
124
- "this opens an element and the rest of the paragraph "
125
- "disappears; write it as &lt;%s&gt;"
123
+ problems.append("wysiwyg-text contains `%s` - since 1.0.11 a tag in a text "
124
+ "run prints as literal characters. Use a wysiwyg-span / "
125
+ "wysiwyg-linebreak / wysiwyg-link node for formatting, or "
126
+ "write a literal tag name as &lt;%s&gt;"
126
127
  % (hit.group(0), hit.group(0).strip("<>/")))
127
128
  if t == "code" and not force:
128
129
  content = (node.get("data") or {}).get("content") or ""
@@ -68,6 +68,8 @@ import os
68
68
  import re
69
69
  import sys
70
70
 
71
+ from inline_html import blocks_from_html, inline_children
72
+
71
73
  # Elementor's responsive suffix -> Mosaic's breakpoint key. Elementor also has
72
74
  # `_widescreen`/`_laptop` etc. on some installs; anything not in this map is
73
75
  # reported rather than folded into the desktop value.
@@ -248,7 +250,7 @@ def as_heading(el, ctx):
248
250
  if tag not in ("h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "span"):
249
251
  tag = "h2"
250
252
  node = {"type": "text", "data": {"tagName": tag, "attrID": ctx.attr(el)},
251
- "text": s.get("title") or ""}
253
+ "children": inline_children(s.get("title") or "")}
252
254
  node = styled(node, s)
253
255
  return ctx.maybe_link(node, s.get("link"), el)
254
256
 
@@ -256,11 +258,16 @@ def as_heading(el, ctx):
256
258
  @handler("text-editor", "e-paragraph")
257
259
  def as_text(el, ctx):
258
260
  s = el.get("settings") or {}
259
- # Elementor's editor content is HTML. It goes into the wysiwyg child, which
260
- # is what that child is for - the same path every text node on the worked
261
- # example uses.
262
- node = {"type": "text", "data": {"tagName": "div", "attrID": ctx.attr(el)},
263
- "text": s.get("editor") or ""}
261
+ # Elementor's editor content is HTML. Through 1.0.10 it could go into one
262
+ # wysiwyg-text run as-is; since 1.0.11 a run escapes `<` and `>`, so the
263
+ # paragraphs, bold, links and breaks arrive as literal tags. It is parsed
264
+ # into text / list nodes with wysiwyg-span / -link / -linebreak inside.
265
+ blocks = blocks_from_html(s.get("editor") or "")
266
+ if len(blocks) == 1 and blocks[0]["type"] == "text":
267
+ node = blocks[0]
268
+ node["data"]["attrID"] = ctx.attr(el)
269
+ else:
270
+ node = {"type": "div", "data": {"attrID": ctx.attr(el)}, "children": blocks}
264
271
  return styled(node, s)
265
272
 
266
273
 
@@ -279,7 +286,7 @@ def as_button(el, ctx):
279
286
  if link.get("nofollow"):
280
287
  data["rel"] = "nofollow"
281
288
  node = {"type": "button", "data": data,
282
- "text": s.get("text") or s.get("button_text") or ""}
289
+ "children": inline_children(s.get("text") or s.get("button_text") or "")}
283
290
  extra = {}
284
291
  if colour(s.get("button_text_color")):
285
292
  extra["color"] = s["button_text_color"]
@@ -366,7 +373,7 @@ def as_icon_list(el, ctx):
366
373
  {"type": "text",
367
374
  "data": {"tagName": "span",
368
375
  "attrID": "%s-i%dt" % (ctx.attr(el, bump=False), i)},
369
- "text": it.get("text") or ""}, it.get("link"), el)]}
376
+ "children": inline_children(it.get("text") or "")}, it.get("link"), el)]}
370
377
  rows.append(row)
371
378
  # The icon itself is an Elementor icon-library reference (`selected_icon`
372
379
  # -> {value: "fas fa-check", library: "fa-solid"}). Mosaic's `icon` type
@@ -0,0 +1,161 @@
1
+ #!/usr/bin/env python3
2
+ """Turn an HTML fragment into Mosaic text nodes - for content that arrives as HTML.
3
+
4
+ Since 1.0.11 a `wysiwyg-text` run escapes `<` and `>` on output
5
+ (WysiwygTextNodeMResource::getEscapedText), so `<strong>` or `<br>` inside a run
6
+ prints as literal characters. Formatting has to be nodes:
7
+
8
+ <strong>/<b> wysiwyg-span, fontWeight 700
9
+ <em>/<i> wysiwyg-span, fontStyle italic
10
+ <u> wysiwyg-span, textDecorationLine underline
11
+ <s>/<del> wysiwyg-span, textDecorationLine line-through
12
+ <a href> wysiwyg-link with url (+ target, rel)
13
+ <br> wysiwyg-linebreak
14
+ other inline their children, unwrapped
15
+ <p>, <h1>-<h6>, <div>, <blockquote>
16
+ one `text` node per block, tagName kept
17
+ <ul>/<ol> list > list-item ; <ol> gets listType "1"
18
+
19
+ Text is stored the way a run is meant to hold it - HTML with `&`, `<` and `>`
20
+ escaped - so an entity in the source prints as its character on every version.
21
+
22
+ blocks_from_html(html) -> list of nodes (text / list), for a block container
23
+ inline_children(html) -> list of inline nodes, for one text-holding node
24
+ """
25
+ import html as _html
26
+ from html.parser import HTMLParser
27
+
28
+ BLOCK = {"p", "div", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "section",
29
+ "article", "header", "footer", "figure", "figcaption", "pre"}
30
+ LIST = {"ul", "ol"}
31
+ VOID = {"br", "img", "hr", "wbr", "input", "meta", "link", "source"}
32
+ SPAN_STYLE = {
33
+ "strong": {"fontWeight": "700"}, "b": {"fontWeight": "700"},
34
+ "em": {"fontStyle": "italic"}, "i": {"fontStyle": "italic"},
35
+ "u": {"textDecorationLine": "underline"},
36
+ "s": {"textDecorationLine": "line-through"}, "del": {"textDecorationLine": "line-through"},
37
+ "strike": {"textDecorationLine": "line-through"},
38
+ }
39
+ TEXT_TAGS = {"p", "div", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote"}
40
+
41
+
42
+ class _Tree(HTMLParser):
43
+ """A minimal DOM: [tag, attrs, children] lists and plain strings."""
44
+
45
+ def __init__(self):
46
+ super().__init__(convert_charrefs=True)
47
+ self.root = ["#root", {}, []]
48
+ self.stack = [self.root]
49
+
50
+ def handle_starttag(self, tag, attrs):
51
+ el = [tag, dict(attrs), []]
52
+ self.stack[-1][2].append(el)
53
+ if tag not in VOID:
54
+ self.stack.append(el)
55
+
56
+ def handle_startendtag(self, tag, attrs):
57
+ self.stack[-1][2].append([tag, dict(attrs), []])
58
+
59
+ def handle_endtag(self, tag):
60
+ for i in range(len(self.stack) - 1, 0, -1):
61
+ if self.stack[i][0] == tag:
62
+ del self.stack[i:]
63
+ return
64
+
65
+ def handle_data(self, data):
66
+ self.stack[-1][2].append(data)
67
+
68
+
69
+ def _parse(fragment):
70
+ t = _Tree()
71
+ t.feed(fragment or "")
72
+ t.close()
73
+ return t.root[2]
74
+
75
+
76
+ def _run(text):
77
+ return {"type": "wysiwyg-text", "data": {"text": _html.escape(text, quote=False)}}
78
+
79
+
80
+ def _inline(nodes):
81
+ out = []
82
+ for n in nodes:
83
+ if isinstance(n, str):
84
+ if n:
85
+ if out and out[-1]["type"] == "wysiwyg-text":
86
+ out[-1]["data"]["text"] += _html.escape(n, quote=False)
87
+ else:
88
+ out.append(_run(n))
89
+ continue
90
+ tag, attrs, kids = n
91
+ if tag == "br":
92
+ out.append({"type": "wysiwyg-linebreak", "data": {}})
93
+ elif tag == "a" and attrs.get("href"):
94
+ data = {"url": attrs["href"]}
95
+ if attrs.get("target") in ("_self", "_blank", "_parent", "_top"):
96
+ data["target"] = attrs["target"]
97
+ if attrs.get("rel"):
98
+ data["rel"] = attrs["rel"]
99
+ out.append({"type": "wysiwyg-link", "data": data, "children": _inline(kids)})
100
+ elif tag in SPAN_STYLE:
101
+ out.append({"type": "wysiwyg-span", "data": {},
102
+ "style": {"&": {"_": dict(SPAN_STYLE[tag])}},
103
+ "children": _inline(kids)})
104
+ elif tag in VOID:
105
+ continue
106
+ else:
107
+ out.extend(_inline(kids))
108
+ # trim the whitespace HTML source formatting leaves at the edges
109
+ if out and out[0]["type"] == "wysiwyg-text":
110
+ out[0]["data"]["text"] = out[0]["data"]["text"].lstrip()
111
+ if out and out[-1]["type"] == "wysiwyg-text":
112
+ out[-1]["data"]["text"] = out[-1]["data"]["text"].rstrip()
113
+ return [o for o in out if not (o["type"] == "wysiwyg-text" and not o["data"]["text"])]
114
+
115
+
116
+ def inline_children(fragment):
117
+ return _inline(_parse(fragment))
118
+
119
+
120
+ def _blocks(nodes):
121
+ out, pending = [], []
122
+
123
+ def flush():
124
+ kids = _inline(pending)
125
+ if kids:
126
+ out.append({"type": "text", "data": {"tagName": "p"}, "children": kids})
127
+ pending.clear()
128
+
129
+ for n in nodes:
130
+ if isinstance(n, str) or (n[0] not in BLOCK and n[0] not in LIST):
131
+ pending.append(n)
132
+ continue
133
+ flush()
134
+ tag, attrs, kids = n
135
+ if tag in LIST:
136
+ items = []
137
+ for li in kids:
138
+ if isinstance(li, list) and li[0] == "li":
139
+ items.append({"type": "list-item", "data": {}, "children": _inline(li[2])})
140
+ if items:
141
+ data = {"listType": "1"} if tag == "ol" else {}
142
+ out.append({"type": "list", "data": data, "children": items})
143
+ elif any(isinstance(k, list) and (k[0] in BLOCK or k[0] in LIST) for k in kids):
144
+ out.extend(_blocks(kids)) # a div of paragraphs: flatten
145
+ else:
146
+ ch = _inline(kids)
147
+ if ch:
148
+ out.append({"type": "text", "data": {"tagName": tag if tag in TEXT_TAGS else "p"},
149
+ "children": ch})
150
+ flush()
151
+ return out
152
+
153
+
154
+ def blocks_from_html(fragment):
155
+ return _blocks(_parse(fragment))
156
+
157
+
158
+ if __name__ == "__main__":
159
+ import json
160
+ import sys
161
+ print(json.dumps(blocks_from_html(sys.stdin.read()), ensure_ascii=False, indent=1))