1
0
mirror of https://github.com/strongdm/comply synced 2025-12-06 14:24:12 +00:00

Add a model for a Control, which ou can use to document control statements, owners, governing policies, etc.

This commit is contained in:
Craine Runton
2020-09-17 10:38:11 -05:00
parent a66764470c
commit e289d6d8f4
13 changed files with 238 additions and 0 deletions

View File

@@ -4,10 +4,13 @@ import (
"fmt"
"sort"
"time"
"html/template"
"github.com/pkg/errors"
"github.com/strongdm/comply/internal/config"
"github.com/strongdm/comply/internal/model"
"github.com/russross/blackfriday/v2"
)
type project struct {
@@ -35,6 +38,7 @@ type renderData struct {
Stats *stats
Narratives []*model.Document
Policies []*model.Document
Controls []*model.Control
Procedures []*model.Procedure
Frameworks []*model.Framework
Tickets []*model.Ticket
@@ -86,6 +90,7 @@ func load() (*model.Data, *renderData, error) {
rd := &renderData{}
rd.Narratives = modelData.Narratives
rd.Policies = modelData.Policies
rd.Controls = modelData.Controls
rd.Procedures = modelData.Procedures
rd.Frameworks = modelData.Frameworks
rd.Tickets = modelData.Tickets
@@ -114,6 +119,12 @@ func loadWithStats() (*model.Data, *renderData, error) {
return nil, nil, err
}
// Convert the markdown body of each control to HTML
for _, n := range modelData.Controls {
b := []byte(n.Body)
n.BodyHTML = template.HTML(blackfriday.Run(b))
}
addStats(modelData, renderData)
return modelData, renderData, nil
}

View File

@@ -16,6 +16,7 @@ func watch(errCh chan error) {
b.Add("./templates/")
b.Add("./narratives/")
b.Add("./policies/")
b.Add("./controls/")
b.Add("./procedures/")
b.Add("./.comply/")