Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
missing title workaround and move part traversal to separate file (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
anweiss authored Jan 26, 2019
1 parent b513c89 commit 03c89ae
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
1 change: 1 addition & 0 deletions metaschema/types.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type {{toCamel .Name}} struct {
{{- end}}
{{- if eq "profile" .Name}}
ID string `xml:"id,attr,omitempty" json:"id,omitempty"`
Title string `xml:"title,omitempty" json:"title,omitempty"`
{{- end}}
{{- range .Flags}}
{{- $cf := commentFlag .Name $m.DefineFlag}}
Expand Down
24 changes: 1 addition & 23 deletions types/oscal/catalog/catalog.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions types/oscal/catalog/prose.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,26 @@ func formatRawProse(raw string) string {

return strings.Join(value, " ")
}

func traverseParts(part *Part, parameterID, parameterVal string) {
if part == nil {
return
}
if part.Prose == nil {
return
}

part.Prose.ReplaceInsertParams(parameterID, parameterVal)
if len(part.Parts) == 0 {
return
}
for i := range part.Parts {
traverseParts(&part.Parts[i], parameterID, parameterVal)
}
return
}

// ModifyProse modifies prose insert parameter template
func (part *Part) ModifyProse(parameterID, parameterVal string) {
traverseParts(part, parameterID, parameterVal)
}
2 changes: 2 additions & 0 deletions types/oscal/profile/profile.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03c89ae

Please sign in to comment.