diff --git a/formatter.go b/formatter.go index 272ed33..ee33160 100644 --- a/formatter.go +++ b/formatter.go @@ -7,6 +7,17 @@ import ( "strings" ) +func (fileContent *FileContent) FormatContent() string { + content := fileContent.Content + badChars := make(map[string]string) + badChars["'"] = "'" + for k, v := range badChars { + content = strings.ReplaceAll(content, k, v) + } + + return content +} + func (file *TreeFile) CategoriesAsUrl() string { escapedCategories := []string{} for _, c := range file.Category { diff --git a/templates/category.gmi b/templates/category.gmi index 21aa483..8a2c2d4 100644 --- a/templates/category.gmi +++ b/templates/category.gmi @@ -1,7 +1,7 @@ {% import "macros.tpl" category_url, tag_url, text_url, logo %} # {{ logo() }} Arna alkierios :: {{ path }} -{% if indexFile %}{{ indexFile.Content }} +{% if indexFile %}{{ indexFile.FormatContent() }} 🌙 {{ indexFile.File.Created}} {{ indexFile.File.Copyright }}{% endif %} diff --git a/templates/page.gmi b/templates/page.gmi index ad8d5f6..7eb04f9 100644 --- a/templates/page.gmi +++ b/templates/page.gmi @@ -1,7 +1,7 @@ {% import "macros.tpl" category_url, tag_url, text_url, logo %} # {{ logo() }} Arna alkierios :: {{ file.File.Description }} -{{ file.Content }} +{{ file.FormatContent() }} 🌙 {{ file.File.Created}} {{ file.File.Copyright }}