makeGenerated writes a special index file that the website can import. Adds all param sections except global into a docusaurus import format. Also creates a footer file that can be imported and displayed.
(config *Config, output string)
| 60 | // Adds all param sections except global into a docusaurus import format. |
| 61 | // Also creates a footer file that can be imported and displayed. |
| 62 | func makeGenerated(config *Config, output string) error { |
| 63 | var first, second bytes.Buffer |
| 64 | |
| 65 | for _, section := range config.Order { |
| 66 | if len(config.Sections[section].Params) > 0 && section != "global" { |
| 67 | first.WriteString("import G" + string(section) + " from './" + string(section) + ".md';\n") |
| 68 | second.WriteString("<G" + string(section) + "/>\n") |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | err := writeDocusaurus(output, "index", first.String()+"\n"+second.String()) |
| 73 | if err != nil { |
| 74 | return err |
| 75 | } |
| 76 | |
| 77 | return writeDocusaurus(output, "footer", `<font color="gray" style={{'float': 'right', 'font-style': 'italic'}}>`+ |
| 78 | "This page was [generated automatically](https://github.com/Unpackerr/unpackerr/tree/main/init/config), "+ |
| 79 | strings.ToUpper(time.Now().UTC().Round(time.Second).Format("02 Jan 2006 15:04 UTC"))+"</font>\n") |
| 80 | } |
| 81 | |
| 82 | func (h *Header) makeDocs(prefix string, section section) string { |
| 83 | conf := h.makeSection(section, true, true) // Generate this portion of the config file. |
no test coverage detected