MCPcopy Create free account
hub / github.com/openclaw/gogcli / ProjectDocument

Function ProjectDocument

internal/docssed/document.go:104–122  ·  view source on GitHub ↗

ProjectDocument builds a stable traversal view from legacy and tab-aware Docs fields.

(document *docs.Document)

Source from the content-addressed store, hash-verified

102
103// ProjectDocument builds a stable traversal view from legacy and tab-aware Docs fields.
104func ProjectDocument(document *docs.Document) DocumentProjection {
105 if document == nil {
106 return DocumentProjection{}
107 }
108
109 projection := DocumentProjection{RevisionID: document.RevisionId}
110 if document.Body != nil || len(document.InlineObjects) > 0 || len(document.PositionedObjects) > 0 {
111 legacy := projectDocumentSegment(
112 "",
113 "",
114 document.Body,
115 document.InlineObjects,
116 document.PositionedObjects,
117 )
118 projection.Legacy = &legacy
119 }
120 projectTabs(document.Tabs, &projection.Tabs)
121 return projection
122}
123
124func projectTabs(tabs []*docs.Tab, projected *[]DocumentSegment) {
125 for _, tab := range tabs {

Calls 2

projectDocumentSegmentFunction · 0.85
projectTabsFunction · 0.85