コード例 #1
0
func (*OpenControlGitBook) buildStandardsSummary(standardKey, controlKey string, standard common.Standard,
	oldFamilyFileName fileName, familySummaryMap map[string]string) (string, fileName, map[string]string) {
	summary := ""
	// format the filename
	controlLink := replaceParentheses(createFileName(standardKey, controlKey).withExt(".md"))

	// get the control.
	control := standard.GetControl(controlKey)

	// get the control family and name
	controlFamily := control.GetFamily()
	controlName := control.GetName()

	// concatenate the standard and control family to create a filename.
	newFamilyFileName := createFileName(standardKey, controlFamily)

	// create control family headings if we are finally on a new heading file.
	if oldFamilyFileName.name != newFamilyFileName.name {
		familySummaryMap[newFamilyFileName.name] = createSubHeading(newFamilyFileName.name)
		summary += exportLink(controlFamily,
			filepath.Join("standards", newFamilyFileName.withExt(".md")))
		oldFamilyFileName = newFamilyFileName
	}

	// Add the control name as a link under the control family header.
	controlFullName := fmt.Sprintf("%s: %s", controlKey, controlName)
	summary += "\t" + exportLink(controlFullName, filepath.Join("standards", controlLink))

	// add the link to the summary page for that particular standard-control combination
	// which will be created later on.
	familySummaryMap[newFamilyFileName.name] += exportLink(controlFullName, controlLink)
	return summary, oldFamilyFileName, familySummaryMap
}
コード例 #2
0
// add adds a standard to the standards mapping
func (s *standardsMap) add(standard common.Standard) {
	s.Lock()
	s.mapping[standard.GetName()] = standard
	s.Unlock()
}