Fix language tag and improve templates

This commit is contained in:
Andrew71 2024-08-28 14:53:54 +03:00
parent 2b0f9c139a
commit 8ae76cc8e8
12 changed files with 35 additions and 27 deletions

View file

@ -1,6 +1,11 @@
# Changelog # Changelog
This file keeps track of changes in a human-readable fashion This file keeps track of changes in a human-readable fashion
## v1.1.4
* Fixed HTML `lang` tag
* Theme CSS link is now only present if non-default is set
* Improved template consistency (backend)
## v1.1.3 ## v1.1.3
This release mostly consists of backend improvements This release mostly consists of backend improvements
* List items no longer replace hyphens with spaces for consistency * List items no longer replace hyphens with spaces for consistency

View file

@ -51,7 +51,7 @@ port=7101 # What port to run on (probably leave on 7101 if using docker)
timezone=Local # IANA Time zone database identifier ("UTC", Local", "Europe/Moscow" etc.), Defaults to Local if can't parse. timezone=Local # IANA Time zone database identifier ("UTC", Local", "Europe/Moscow" etc.), Defaults to Local if can't parse.
grace_period=0s # Time after a new day begins, but before the switch to next day's file. e.g. 3h26m - files will change at 3:26am grace_period=0s # Time after a new day begins, but before the switch to next day's file. e.g. 3h26m - files will change at 3:26am
language=en # ISO-639 language code (available - en, ru) language=en # ISO-639 language code (available - en, ru)
theme=default # Picked theme (available - default, high-contrast, lavender, gruvbox, sans) theme="" # Picked theme (available - default (if left empty), high-contrast, lavender, gruvbox, sans)
title=🌺 Hibiscus.txt # The text in the header title=🌺 Hibiscus.txt # The text in the header
log_to_file=false # Whether to write logs to a file log_to_file=false # Whether to write logs to a file
log_file=config/log.txt # Where to store the log file if it is enabled log_file=config/log.txt # Where to store the log file if it is enabled

View file

@ -41,7 +41,7 @@ var DefaultConfig = Config{
Timezone: time.Local, Timezone: time.Local,
GraceTime: 0, GraceTime: 0,
Language: "en", Language: "en",
Theme: "default", Theme: "",
Title: "🌺 Hibiscus.txt", Title: "🌺 Hibiscus.txt",
LogToFile: false, LogToFile: false,
LogFile: "config/log.txt", LogFile: "config/log.txt",

View file

@ -1,4 +1,6 @@
{ {
"lang": "en-UK",
"title.today": "Your day so far", "title.today": "Your day so far",
"title.days": "Previous days", "title.days": "Previous days",
"title.notes": "Notes", "title.notes": "Notes",

View file

@ -1,4 +1,6 @@
{ {
"lang": "ru",
"title.today": "Сегодняшний день", "title.today": "Сегодняшний день",
"title.days": "Предыдущие дни", "title.days": "Предыдущие дни",
"title.notes": "Заметки", "title.notes": "Заметки",
@ -11,7 +13,7 @@
"link.info": "системная информация", "link.info": "системная информация",
"time.date": "Сегодня", "time.date": "Сегодня",
"time.grace": "льготный период", "time.grace": "редактируется вчерашний день",
"button.save": "Сохранить", "button.save": "Сохранить",
"button.notes": "Новая заметка", "button.notes": "Новая заметка",
"prompt.notes": "Название заметки", "prompt.notes": "Название заметки",

View file

@ -15,7 +15,7 @@ type AppInfo struct {
// Info contains app information. // Info contains app information.
var Info = AppInfo{ var Info = AppInfo{
Version: "1.1.3", Version: "1.1.4",
SourceLink: "https://git.a71.su/Andrew71/hibiscus", SourceLink: "https://git.a71.su/Andrew71/hibiscus",
} }

View file

@ -5,7 +5,7 @@
</header> </header>
{{ end }} {{ end }}
{{define "base"}} {{- define "base" -}}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ translatableText "lang" }}"> <html lang="{{ translatableText "lang" }}">
<head> <head>
@ -14,16 +14,16 @@
<link rel="manifest" href="/public/manifest.json" /> <link rel="manifest" href="/public/manifest.json" />
<link rel="icon" type="image/x-icon" href="/public/favicon.ico"> <link rel="icon" type="image/x-icon" href="/public/favicon.ico">
<link rel="stylesheet" href="/public/main.css"> <link rel="stylesheet" href="/public/main.css">
<link rel="stylesheet" href="/public/themes/{{ config.Theme }}.css"> {{- if config.Theme -}}<link rel="stylesheet" href="/public/themes/{{ config.Theme }}.css">{{ end }}
<script src="/public/main.js"></script> <script src="/public/main.js"></script>
<title>Hibiscus.txt</title> <title>Hibiscus.txt</title>
</head> </head>
<body> <body>
{{template "header" .}} {{- template "header" . -}}
<main> <main>
{{template "main" .}} {{- template "main" . -}}
</main> </main>
{{template "footer" .}} {{- template "footer" . -}}
<script defer> <script defer>
const langName="{{ config.Language }}"; const langName="{{ config.Language }}";
const timeZone="{{ config.Timezone }}"; const timeZone="{{ config.Timezone }}";

View file

@ -1 +0,0 @@
/* Default theme is defined in main.css */