Skip to content

Commit

Permalink
Changed the logic to check for {% include}
Browse files Browse the repository at this point in the history
Signed-off-by: Aboobaker Siddiq R <aboobakersiddiq63@gmail.com>
  • Loading branch information
aboobakersiddiqr63 committed Oct 21, 2023
1 parent b43c313 commit 997e5eb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mesheryctl/doc/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, manuallyAddedContent map
if len(manuallyAddedContent) > 0 {
for _, content := range manuallyAddedContent {
buf.WriteString("\n")
buf.WriteString("<!-- " + content + " --->" + "\n")
buf.WriteString("{% include " + content + " %}" + "\n")
}
}

Expand Down Expand Up @@ -289,10 +289,10 @@ func getManuallyAddedContentMap(filename string) (map[int]string, error) {

content := string(existingContent)

commentPattern := regexp.MustCompile(`<!---([\s\S]*?)--->`)
matches := commentPattern.FindAllStringSubmatch(content, -1)
for i, match := range matches {
// Store the section content in the map with order as the key
includePattern := regexp.MustCompile(`\{\%\s*include\s+([^%]+)\s+\%\}`)
includeMatches := includePattern.FindAllStringSubmatch(content, -1)
for i, match := range includeMatches {
// Store the include content in the map with order as the key
manuallyAddedContentMap[i] = strings.TrimSpace(match[1])
}
return manuallyAddedContentMap, nil
Expand Down

0 comments on commit 997e5eb

Please sign in to comment.