xmind

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

package xmind require python3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

func Export(w io.Writer, content XMLContent, filename string) error

Types

type Content

type Content []Sheet

func Parse

func Parse(r io.Reader) (Content, error)

type Sheet

type Sheet struct {
	Topic Topic `json:"topic,omitempty" xml:"topic,omitempty"`
}

type Topic

type Topic struct {
	Title  string  `json:"title,omitempty" xml:"title,omitempty"`
	Topics []Topic `json:"topics,omitempty" xml:"topics,omitempty"`
}

func (Topic) GetFirstSubTopicTitle

func (t Topic) GetFirstSubTopicTitle() string

type XMLContent

type XMLContent struct {
	XMLName xml.Name `xml:"xmap-content,omitempty"`
	Sheet   XMLSheet `xml:"sheet,omitempty"`
}

func ParseXML

func ParseXML(r io.Reader) (XMLContent, error)

type XMLSheet

type XMLSheet struct {
	Topic *XMLTopic `xml:"topic,omitempty"`
}

type XMLTopic

type XMLTopic struct {
	Title    string            `xml:"title,omitempty"`
	Children *XMLTopicChildren `xml:"children,omitempty"`
}

func (*XMLTopic) AddAttachedChildTopic

func (t *XMLTopic) AddAttachedChildTopic(title string, ignoreIfExist ...bool) *XMLTopic

AddAttachedChildTopic

type XMLTopicChildren

type XMLTopicChildren struct {
	// TypedTopics 存在是为了设置 topics 这一层的 type 属性,必填,否则生成的脑图不展示子节点
	// 从数据结构上来说可以直接用 []XMLTopic `xml:"topics>topic"` 替代,但这样无法在 topics 这一层设置 type 属性
	// 另外 topics 和 topic 都有单独属性可填,所以还是需要单独设置结构
	TypedTopics *XMLTypedTopics `xml:"topics,omitempty"`
}

type XMLTopicType

type XMLTopicType string

XMLTopicType topics 类型,必填属性(attr)

var (
	TopicsTypeAttached XMLTopicType = "attached" // topics 必填属性
)

type XMLTypedTopics

type XMLTypedTopics struct {
	Type   XMLTopicType `xml:"type,attr"`
	Topics []*XMLTopic  `xml:"topic"` // 这里为 topic,实际上为数组
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL