45 lines
972 B
Go
45 lines
972 B
Go
package matrix
|
||
|
||
import (
|
||
"strings"
|
||
|
||
libweb "haixun-backend/internal/library/webpage"
|
||
)
|
||
|
||
func FormatCopyResearchMapBlockWithReferences(
|
||
audience, goal string,
|
||
questions, pillars, exclusions []string,
|
||
knowledgeItems []string,
|
||
researchItemsBlock string,
|
||
referenceMarkdown string,
|
||
) string {
|
||
base := FormatCopyResearchMapBlock(
|
||
audience,
|
||
goal,
|
||
questions,
|
||
pillars,
|
||
exclusions,
|
||
knowledgeItems,
|
||
)
|
||
research := strings.TrimSpace(researchItemsBlock)
|
||
if research != "" {
|
||
if base == "" {
|
||
base = "研究來源(Brave):\n" + research
|
||
} else {
|
||
base += "\n\n研究來源(Brave):\n" + research
|
||
}
|
||
}
|
||
ref := strings.TrimSpace(referenceMarkdown)
|
||
if ref == "" {
|
||
return base
|
||
}
|
||
if base == "" {
|
||
return "參考網頁(Markdown):\n" + ref
|
||
}
|
||
return base + "\n\n參考網頁(Markdown):\n" + ref
|
||
}
|
||
|
||
func BuildReferenceMarkdown(digests []libweb.Digest) string {
|
||
return libweb.FormatMarkdownBlock(digests, libweb.DefaultMaxMarkdown)
|
||
}
|