MCPcopy
hub / github.com/larksuite/cli / applyFeishuNativeStyles

Function applyFeishuNativeStyles

shortcuts/mail/lint/linter.go:525–551  ·  view source on GitHub ↗
(parent *xhtml.Node, rep *Report, nctx *nativeCtx)

Source from the content-addressed store, hash-verified

523}
524
525func applyFeishuNativeStyles(parent *xhtml.Node, rep *Report, nctx *nativeCtx) {
526 child := parent.FirstChild
527 for child != nil {
528 next := child.NextSibling
529 if child.Type == xhtml.ElementNode {
530 switch strings.ToLower(child.Data) {
531 case "ol", "ul":
532 wrapNonLIListChildren(child, rep)
533 ensureFeishuListStyle(child, rep)
534 case "li":
535 ensureFeishuListItemStyle(child, parent, rep, nctx)
536 case "blockquote":
537 ensureFeishuBlockquoteStyle(child, rep)
538 case "a":
539 ensureFeishuLinkStyle(child, rep)
540 case "p":
541 rewritePToFeishuDiv(child, rep)
542 }
543 }
544 // child may have been mutated (children moved into a wrapper);
545 // recurse only if it's still attached.
546 if child.Parent != nil {
547 applyFeishuNativeStyles(child, rep, nctx)
548 }
549 child = next
550 }
551}
552
553// wrapNonLIListChildren scans the direct children of an <ol>/<ul> and wraps
554// any element that is not <li> in a fresh <li>. HTML spec is explicit that

Callers 1

RunFunction · 0.85

Calls 6

wrapNonLIListChildrenFunction · 0.85
ensureFeishuListStyleFunction · 0.85
ensureFeishuLinkStyleFunction · 0.85
rewritePToFeishuDivFunction · 0.85

Tested by

no test coverage detected