mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
a6f3e635d4
* feat(docs): add local authoring and resource workflows Add docs +script workflows for isolated draft initialization and tolerant XML/Markdown profiling. Support local and remote document resources across create and update flows with safe, bounded-concurrency uploads, binding verification, and cleanup. Synchronize shared credential-source selection during concurrent uploads, refresh lark-doc guidance, and expand unit, dry-run, and live E2E coverage. * docs(lark-doc): clarify genre reference paths * fix(docs): address PR validation feedback * docs(lark-doc): clarify remote image handling * feat: streamline docs draft workflow * fix(docs): clarify script input and resource cleanup * fix(docs): align script dry-run test with auth flow * fix(docs): authenticate local script e2e test * fix(docs): refine script diagnostics and image preflight * fix(docs): align draft workspace cleanup with VFS * fix(docs): route workspace cleanup through FileIO * docs(lark-doc): simplify profile check guidance
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Package docxparse parses LarkOpenCLI DocxXML into a small DOM for the docs
|
|
// +script shortcut.
|
|
package docxparse
|
|
|
|
// Format is an accepted source document format.
|
|
type Format string
|
|
|
|
const (
|
|
FormatXML Format = "xml"
|
|
)
|
|
|
|
// ParseResult is the complete result returned by Parse.
|
|
type ParseResult struct {
|
|
Format Format `json:"format"`
|
|
XML string `json:"xml"`
|
|
Profile Profile `json:"profile"`
|
|
}
|
|
|
|
type nodeType uint8
|
|
|
|
const (
|
|
nodeText nodeType = iota
|
|
nodeElement
|
|
)
|
|
|
|
// Node is the internal DocxXML DOM representation.
|
|
type Node struct {
|
|
typ nodeType
|
|
tag string
|
|
attrs map[string]string
|
|
children []*Node
|
|
text string
|
|
parent *Node
|
|
}
|
|
|
|
func newText(text string) *Node {
|
|
return &Node{typ: nodeText, text: text}
|
|
}
|
|
|
|
func newElement(tag string, attrs map[string]string) *Node {
|
|
return &Node{typ: nodeElement, tag: tag, attrs: attrs}
|
|
}
|
|
|
|
func (n *Node) addChild(child *Node) {
|
|
if n == nil || child == nil {
|
|
return
|
|
}
|
|
child.parent = n
|
|
n.children = append(n.children, child)
|
|
}
|