improvement of the code, to create better readability and error correction. moving to v1.1.0
This commit is contained in:
BIN
Binary file not shown.
@@ -10,7 +10,8 @@ import (
|
|||||||
|
|
||||||
var data_articles_index string = ""
|
var data_articles_index string = ""
|
||||||
var top string = "<!doctype html><html lang='en'><head><meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>Haufenet</title><link rel='stylesheet' href='/index.css' /><link rel='icon' type='image/png' href='/favicon-96x96.png' sizes='96x96'/><link rel='icon' type='image/svg+xml' href='/favicon.svg'/><link rel='shortcut icon' href='/favicon.ico' /><link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' /><link rel='manifest' href='/site.webmanifest' /><link rel='preconnect' href='https://fonts.googleapis.com'><link rel='preconnect' href='https://fonts.gstatic.com' crossorigin><link href='https://fonts.googleapis.com/css2?family=BBH+Bogle&display=swap' rel='stylesheet'></head><body><header><a href='/' ><b>Haufenet</b></a></header>"
|
var top string = "<!doctype html><html lang='en'><head><meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>Haufenet</title><link rel='stylesheet' href='/index.css' /><link rel='icon' type='image/png' href='/favicon-96x96.png' sizes='96x96'/><link rel='icon' type='image/svg+xml' href='/favicon.svg'/><link rel='shortcut icon' href='/favicon.ico' /><link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' /><link rel='manifest' href='/site.webmanifest' /><link rel='preconnect' href='https://fonts.googleapis.com'><link rel='preconnect' href='https://fonts.gstatic.com' crossorigin><link href='https://fonts.googleapis.com/css2?family=BBH+Bogle&display=swap' rel='stylesheet'></head><body><header><a href='/' ><b>Haufenet</b></a></header>"
|
||||||
var bottom string = "<footer><p>© Lennard Haufe<p><p>No usage of AI</p><a href='/imprint_privacy/'>Imprint and Privacy</a></footer></body><script src='/index.js'></script></html>"
|
var bottom string = "<footer><p>© Lennard Haufe<p><p>Running on net/http GO</p><p>No usage of AI</p><a href='/imprint_privacy/'>Imprint and Privacy</a></footer></body><script src='/index.js'></script></html>"
|
||||||
|
var tag_collection string = ""
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
entries, err := os.ReadDir("./articles")
|
entries, err := os.ReadDir("./articles")
|
||||||
@@ -18,14 +19,14 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
for _, e := range entries {
|
for _, e := range entries {
|
||||||
|
AnalayzeFiles(e.Name())
|
||||||
ReadFileArticles(e.Name())
|
|
||||||
SetupDataIndexArticles(e.Name())
|
|
||||||
}
|
}
|
||||||
|
log.Println(tag_collection)
|
||||||
log.Print("Server running on port 8090")
|
log.Print("Server running on port 8090")
|
||||||
EditArticlesPage()
|
EditArticlesPage()
|
||||||
ReadFileOthers("imprint_privacy.md")
|
ReadFileOthers("imprint_privacy.md")
|
||||||
fileserver := http.FileServer(http.Dir("./website"))
|
fileserver := http.FileServer(http.Dir("./website"))
|
||||||
|
|
||||||
http.Handle("/", fileserver)
|
http.Handle("/", fileserver)
|
||||||
|
|
||||||
if err := http.ListenAndServe(":8090", nil); err != nil {
|
if err := http.ListenAndServe(":8090", nil); err != nil {
|
||||||
@@ -40,103 +41,72 @@ func EditArticlesPage() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func SetupDataIndexArticles(filename string) {
|
func AnalayzeFiles(filename string) {
|
||||||
|
|
||||||
file, err := os.Open("./articles/" + filename)
|
file, err := os.Open("./articles/" + filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("not opening")
|
log.Fatalf("not opening")
|
||||||
}
|
}
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
scanner := bufio.NewScanner(file)
|
|
||||||
var title string = ""
|
|
||||||
var description string = ""
|
|
||||||
var tags string = ""
|
|
||||||
var image string = ""
|
|
||||||
for scanner.Scan() {
|
|
||||||
content := scanner.Text()
|
|
||||||
if strings.Contains(content, "###") {
|
|
||||||
continue
|
|
||||||
} else if strings.Contains(content, "##") {
|
|
||||||
continue
|
|
||||||
} else if strings.Contains(content, "#") {
|
|
||||||
part := strings.Split(content, `#`)
|
|
||||||
title = "<h1>" + part[1] + "</h1>"
|
|
||||||
} else if strings.Contains(content, "DESCRIPTION:") {
|
|
||||||
part := strings.Split(content, `DESCRIPTION:`)
|
|
||||||
description = "<p>" + part[1] + "</p>"
|
|
||||||
} else if strings.Contains(content, "HEADIMAGE:") {
|
|
||||||
part := strings.Split(content, `HEADIMAGE:`)
|
|
||||||
image = "<img src='/pictures/" + part[1] + "'>"
|
|
||||||
} else if strings.Contains(content, "TAGS:") {
|
|
||||||
part := strings.Split(content, `TAGS:`)
|
|
||||||
part_2 := strings.Split(part[1], ",")
|
|
||||||
part_tags := "<articles-tags>"
|
|
||||||
for i := 0; i < len(part_2); i++ {
|
|
||||||
part_tags += "<a href='/tags/" + part_2[i] + "'>" + part_2[i] + "</a>"
|
|
||||||
}
|
|
||||||
part_tags += "</articles-tags>"
|
|
||||||
tags = part_tags
|
|
||||||
} else {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filename_new := strings.Split(filename, ".md")
|
filename_new := strings.Split(filename, ".md")
|
||||||
data_articles_index += "<article-display><a href='/articles/" + filename_new[0] + ".html'>" + title + image + description + "</a>" + tags + "</article-display>"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func ReadFileArticles(filename string) {
|
|
||||||
file, err := os.Open("./articles/" + filename)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("not opening")
|
|
||||||
}
|
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
scanner := bufio.NewScanner(file)
|
scanner := bufio.NewScanner(file)
|
||||||
var new_text string = ""
|
var end_text_page_article string = ""
|
||||||
var tags string = ""
|
var tags_page_article string = ""
|
||||||
|
var title_overview_articles string = ""
|
||||||
|
var description_overview_articles string = ""
|
||||||
|
var image_overview_articles string = ""
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
content := scanner.Text()
|
content := scanner.Text()
|
||||||
var end_type string = ""
|
|
||||||
|
|
||||||
if strings.Contains(content, "###") {
|
if strings.Contains(content, "###") {
|
||||||
part := strings.Split(content, `###`)
|
part := strings.Split(content, `###`)
|
||||||
end_type = "<h3>" + part[1] + "</h3>"
|
end_text_page_article += "<h3>" + part[1] + "</h3>"
|
||||||
} else if strings.Contains(content, "##") {
|
} else if strings.Contains(content, "##") {
|
||||||
part := strings.Split(content, `##`)
|
part := strings.Split(content, `##`)
|
||||||
end_type = "<h2>" + part[1] + "</h2>"
|
end_text_page_article += "<h2>" + part[1] + "</h2>"
|
||||||
} else if strings.Contains(content, "#") {
|
} else if strings.Contains(content, "#") {
|
||||||
part := strings.Split(content, `#`)
|
part := strings.Split(content, `#`)
|
||||||
end_type = "<h1>" + part[1] + "</h1>"
|
end_text_page_article += "<h1>" + part[1] + "</h1>"
|
||||||
|
title_overview_articles = "<h1>" + part[1] + "</h1>"
|
||||||
} else if strings.Contains(content, "HEADIMAGE:") {
|
} else if strings.Contains(content, "HEADIMAGE:") {
|
||||||
part := strings.Split(content, `HEADIMAGE:`)
|
part := strings.Split(content, `HEADIMAGE:`)
|
||||||
end_type = "<img src='/pictures/" + part[1] + "'>"
|
end_text_page_article += "<img src='/pictures/" + part[1] + "'>"
|
||||||
|
image_overview_articles = "<img src='/pictures/" + part[1] + "'>"
|
||||||
|
} else if strings.Contains(content, "DESCRIPTION:") {
|
||||||
|
part := strings.Split(content, `DESCRIPTION:`)
|
||||||
|
description_overview_articles = "<p>" + part[1] + "</p>"
|
||||||
} else if strings.Contains(content, "[img]:") {
|
} else if strings.Contains(content, "[img]:") {
|
||||||
part := strings.Split(content, `[img]:`)
|
part := strings.Split(content, `[img]:`)
|
||||||
end_type = "<img src='/pictures/" + part[1] + "'>"
|
end_text_page_article += "<img src='/pictures/" + part[1] + "'>"
|
||||||
} else if strings.Contains(content, "DESCRIPTION:") {
|
} else if strings.Contains(content, "DESCRIPTION:") {
|
||||||
end_type = ""
|
|
||||||
|
end_text_page_article = ""
|
||||||
} else if strings.Contains(content, "TAGS:") {
|
} else if strings.Contains(content, "TAGS:") {
|
||||||
part := strings.Split(content, `TAGS:`)
|
part := strings.Split(content, `TAGS:`)
|
||||||
part_2 := strings.Split(part[1], ",")
|
part_2 := strings.Split(part[1], ",")
|
||||||
part_tags := "<articles-tags>"
|
part_tags := "<articles-tags>"
|
||||||
for i := 0; i < len(part_2); i++ {
|
for i := 0; i < len(part_2); i++ {
|
||||||
part_tags += "<a href='/tags/" + part_2[i] + "'>" + part_2[i] + "</a>"
|
part_tags += "<a href='/tags/" + part_2[i] + "'>" + part_2[i] + "</a>"
|
||||||
|
tag_collection += "#" + part_2[i] + ":" + filename_new[0] + ":" + title_overview_articles + ":" + description_overview_articles + ":" + image_overview_articles
|
||||||
}
|
}
|
||||||
part_tags += "</articles-tags>"
|
part_tags += "</articles-tags>"
|
||||||
tags = part_tags
|
tags_page_article = part_tags
|
||||||
} else if content == "" {
|
} else if content == "" {
|
||||||
end_type = "<br>"
|
end_text_page_article += "<br>"
|
||||||
} else {
|
} else {
|
||||||
end_type = "<p>" + content + "</p>"
|
end_text_page_article += "<p>" + content + "</p>"
|
||||||
}
|
}
|
||||||
new_text += end_type
|
|
||||||
|
|
||||||
}
|
}
|
||||||
filename_new := strings.Split(filename, ".md")
|
|
||||||
err = os.WriteFile("./website/articles/"+filename_new[0]+".html", []byte(top+"<articles-detail><articles-detail-down>"+new_text+"<h4>Tags</h4>"+tags+"<br></articles-detail-down></articles-detail>"+bottom), 0755)
|
Page_Article(filename_new[0], end_text_page_article, tags_page_article)
|
||||||
|
Page_Collection_Overview_Articles(filename_new[0], title_overview_articles, image_overview_articles, description_overview_articles, tags_page_article)
|
||||||
|
|
||||||
|
}
|
||||||
|
func Page_Collection_Overview_Articles(filename string, title string, image string, description string, tags string) {
|
||||||
|
data_articles_index += "<article-display><a href='/articles/" + filename + ".html'>" + title + image + description + "</a>" + tags + "</article-display>"
|
||||||
|
}
|
||||||
|
func Page_Article(filename string, text string, tags string) {
|
||||||
|
err := os.WriteFile("./website/articles/"+filename+".html", []byte(top+"<articles-detail><articles-detail-down>"+text+"<h4>Tags</h4>"+tags+"<br></articles-detail-down></articles-detail>"+bottom), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<!doctype html><html lang='en'><head><meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>Haufenet</title><link rel='stylesheet' href='/index.css' /><link rel='icon' type='image/png' href='/favicon-96x96.png' sizes='96x96'/><link rel='icon' type='image/svg+xml' href='/favicon.svg'/><link rel='shortcut icon' href='/favicon.ico' /><link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' /><link rel='manifest' href='/site.webmanifest' /><link rel='preconnect' href='https://fonts.googleapis.com'><link rel='preconnect' href='https://fonts.gstatic.com' crossorigin><link href='https://fonts.googleapis.com/css2?family=BBH+Bogle&display=swap' rel='stylesheet'></head><body><header><a href='/' ><b>Haufenet</b></a></header><list-articles><h1 id='top-article-list'>Articles</h1><div><article-display><a href='/articles/this_website.html'><h1> This Website</h1><img src='/pictures/another.png'><p>This Website had a lot of diffrent version, featuring diffrent styles...</p></a><articles-tags><a href='/tags/projects'>projects</a><a href='/tags/css'>css</a><a href='/tags/html'>html</a><a href='/tags/coding'>coding</a></articles-tags></article-display></div></list-articles><footer><p>© Lennard Haufe<p><p>No usage of AI</p><a href='/imprint_privacy/'>Imprint and Privacy</a></footer></body><script src='/index.js'></script></html>
|
<!doctype html><html lang='en'><head><meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>Haufenet</title><link rel='stylesheet' href='/index.css' /><link rel='icon' type='image/png' href='/favicon-96x96.png' sizes='96x96'/><link rel='icon' type='image/svg+xml' href='/favicon.svg'/><link rel='shortcut icon' href='/favicon.ico' /><link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' /><link rel='manifest' href='/site.webmanifest' /><link rel='preconnect' href='https://fonts.googleapis.com'><link rel='preconnect' href='https://fonts.gstatic.com' crossorigin><link href='https://fonts.googleapis.com/css2?family=BBH+Bogle&display=swap' rel='stylesheet'></head><body><header><a href='/' ><b>Haufenet</b></a></header><list-articles><h1 id='top-article-list'>Articles</h1><div><article-display><a href='/articles/this_website.html'><h1> This Website</h1><img src='/pictures/another.png'><p>This Website had a lot of diffrent version, featuring diffrent styles...</p></a><articles-tags><a href='/tags/projects'>projects</a><a href='/tags/css'>css</a><a href='/tags/html'>html</a><a href='/tags/coding'>coding</a></articles-tags></article-display></div></list-articles><footer><p>© Lennard Haufe<p><p>Running on net/http GO</p><p>No usage of AI</p><a href='/imprint_privacy/'>Imprint and Privacy</a></footer></body><script src='/index.js'></script></html>
|
||||||
@@ -1 +1 @@
|
|||||||
<!doctype html><html lang='en'><head><meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>Haufenet</title><link rel='stylesheet' href='/index.css' /><link rel='icon' type='image/png' href='/favicon-96x96.png' sizes='96x96'/><link rel='icon' type='image/svg+xml' href='/favicon.svg'/><link rel='shortcut icon' href='/favicon.ico' /><link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' /><link rel='manifest' href='/site.webmanifest' /><link rel='preconnect' href='https://fonts.googleapis.com'><link rel='preconnect' href='https://fonts.gstatic.com' crossorigin><link href='https://fonts.googleapis.com/css2?family=BBH+Bogle&display=swap' rel='stylesheet'></head><body><header><a href='/' ><b>Haufenet</b></a></header><articles-detail><articles-detail-down><h1> This Website</h1><img src='/pictures/another.png'><p>This Website had a lot of diffrent version, featuring diffrent styles. Everytime I recreate it, I say "this will be the version I will continue on", but then I make a change to it or am unhappy with it. So I create a new Version, mostly from scratch. If I would be honest I could call this version of the Website v20 at least, but I will call it v1.</p><h2> The "Technology" behind it</h2><p>I use golang to run the http server and to compile my md files to a static website. I use md over html, becaus first one always needs to add "<>" and at the end "</>" of every text element, this makes it a long and fustrating process to write it. Additionaly one needs to add the head, the header and the footer to every file seperatly.This makes changing a style outside the universal css file more complicated. This means that one thinks of a new header structure, every header in every file needs to be changed. Which can be done of course with a IDE and its "occurences-tool", but this process does not ensure correct result. Leading to error this makes the progess even longer, then with the compalation method.</p><h2> Usage of the Website</h2><p>This website is being populated with diffent informations such as projects, documentations and comments on diffrent technical standpoints. I will use it to improve my english level. So if you are an born english speaker, please be so kind and report any erros to me.</p><h4>Tags</h4><articles-tags><a href='/tags/projects'>projects</a><a href='/tags/css'>css</a><a href='/tags/html'>html</a><a href='/tags/coding'>coding</a></articles-tags><br></articles-detail-down></articles-detail><footer><p>© Lennard Haufe<p><p>No usage of AI</p><a href='/imprint_privacy/'>Imprint and Privacy</a></footer></body><script src='/index.js'></script></html>
|
<!doctype html><html lang='en'><head><meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>Haufenet</title><link rel='stylesheet' href='/index.css' /><link rel='icon' type='image/png' href='/favicon-96x96.png' sizes='96x96'/><link rel='icon' type='image/svg+xml' href='/favicon.svg'/><link rel='shortcut icon' href='/favicon.ico' /><link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' /><link rel='manifest' href='/site.webmanifest' /><link rel='preconnect' href='https://fonts.googleapis.com'><link rel='preconnect' href='https://fonts.gstatic.com' crossorigin><link href='https://fonts.googleapis.com/css2?family=BBH+Bogle&display=swap' rel='stylesheet'></head><body><header><a href='/' ><b>Haufenet</b></a></header><articles-detail><articles-detail-down><h1> This Website</h1><img src='/pictures/another.png'><p>This Website had a lot of diffrent version, featuring diffrent styles. Everytime I recreate it, I say "this will be the version I will continue on", but then I make a change to it or am unhappy with it. So I create a new Version, mostly from scratch. If I would be honest I could call this version of the Website v20 at least, but I will call it v1.</p><h2> The "Technology" behind it</h2><p>I use golang to run the http server and to compile my md files to a static website. I use md over html, becaus first one always needs to add "<>" and at the end "</>" of every text element, this makes it a long and fustrating process to write it. Additionaly one needs to add the head, the header and the footer to every file seperatly.This makes changing a style outside the universal css file more complicated. This means that one thinks of a new header structure, every header in every file needs to be changed. Which can be done of course with a IDE and its "occurences-tool", but this process does not ensure correct result. Leading to error this makes the progess even longer, then with the compalation method.</p><h2> Usage of the Website</h2><p>This website is being populated with diffent informations such as projects, documentations and comments on diffrent technical standpoints. I will use it to improve my english level. So if you are an born english speaker, please be so kind and report any erros to me.</p><h4>Tags</h4><articles-tags><a href='/tags/projects'>projects</a><a href='/tags/css'>css</a><a href='/tags/html'>html</a><a href='/tags/coding'>coding</a></articles-tags><br></articles-detail-down></articles-detail><footer><p>© Lennard Haufe<p><p>Running on net/http GO</p><p>No usage of AI</p><a href='/imprint_privacy/'>Imprint and Privacy</a></footer></body><script src='/index.js'></script></html>
|
||||||
@@ -1 +1 @@
|
|||||||
<!doctype html><html lang='en'><head><meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>Haufenet</title><link rel='stylesheet' href='/index.css' /><link rel='icon' type='image/png' href='/favicon-96x96.png' sizes='96x96'/><link rel='icon' type='image/svg+xml' href='/favicon.svg'/><link rel='shortcut icon' href='/favicon.ico' /><link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' /><link rel='manifest' href='/site.webmanifest' /><link rel='preconnect' href='https://fonts.googleapis.com'><link rel='preconnect' href='https://fonts.gstatic.com' crossorigin><link href='https://fonts.googleapis.com/css2?family=BBH+Bogle&display=swap' rel='stylesheet'></head><body><header><a href='/' ><b>Haufenet</b></a></header><articles-detail><div><h1> Impressum</h1><p>Lennard Haufe</p><p>Obere Ziegeli 11</p><p>71522 Backnang</p><h1> Kontakt</h1><p>Telefon: 004917650320223</p><p>E-Mail: info.lennard.haufe@haufenet.com</p><h1> Inhaltlich verantwortlich i.S.v. § 18 Abs. 2 MStV</h1><p>Lennard Haufe</p><p>Obere Ziegelei 11</p><p>71522 Backnang</p><h1> Dieses Impressum gilt auch für folgende Social-Media-Profile</h1><p>Instagram: https://www.instagram.com/haufe_net_com/</p><h1> Quellenangaben für verwendete Bilder und Grafiken</h1><p>D. Stroh – byd-film.de</p></div></articles-detail><footer><p>© Lennard Haufe<p><p>No usage of AI</p><a href='/imprint_privacy/'>Imprint and Privacy</a></footer></body><script src='/index.js'></script></html>
|
<!doctype html><html lang='en'><head><meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>Haufenet</title><link rel='stylesheet' href='/index.css' /><link rel='icon' type='image/png' href='/favicon-96x96.png' sizes='96x96'/><link rel='icon' type='image/svg+xml' href='/favicon.svg'/><link rel='shortcut icon' href='/favicon.ico' /><link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' /><link rel='manifest' href='/site.webmanifest' /><link rel='preconnect' href='https://fonts.googleapis.com'><link rel='preconnect' href='https://fonts.gstatic.com' crossorigin><link href='https://fonts.googleapis.com/css2?family=BBH+Bogle&display=swap' rel='stylesheet'></head><body><header><a href='/' ><b>Haufenet</b></a></header><articles-detail><div><h1> Impressum</h1><p>Lennard Haufe</p><p>Obere Ziegeli 11</p><p>71522 Backnang</p><h1> Kontakt</h1><p>Telefon: 004917650320223</p><p>E-Mail: info.lennard.haufe@haufenet.com</p><h1> Inhaltlich verantwortlich i.S.v. § 18 Abs. 2 MStV</h1><p>Lennard Haufe</p><p>Obere Ziegelei 11</p><p>71522 Backnang</p><h1> Dieses Impressum gilt auch für folgende Social-Media-Profile</h1><p>Instagram: https://www.instagram.com/haufe_net_com/</p><h1> Quellenangaben für verwendete Bilder und Grafiken</h1><p>D. Stroh – byd-film.de</p></div></articles-detail><footer><p>© Lennard Haufe<p><p>Running on net/http GO</p><p>No usage of AI</p><a href='/imprint_privacy/'>Imprint and Privacy</a></footer></body><script src='/index.js'></script></html>
|
||||||
Reference in New Issue
Block a user