Enhance CSS link styles and refactor variable names in site.hs for clarity

This commit is contained in:
2026-04-09 00:23:01 +08:00
parent f592483e69
commit e4689268f2
2 changed files with 45 additions and 33 deletions

View File

@@ -4,6 +4,8 @@
--color-tag2: darkolivegreen;
--color-bg: white;
--color-notice: #fb4f4f;
--color-link: #0645ad;
--color-link-visited: #551a8b;
}
html {
@@ -25,9 +27,18 @@ body {
}
body a {
color: var(--color-link);
text-decoration: none;
}
body a:visited {
color: var(--color-link-visited);
}
body a[href^="#"]:visited {
color: var(--color-link);
}
body a:hover {
text-decoration: underline;
}
@@ -321,18 +332,18 @@ code {
margin-bottom: 0.5em;
padding-left: 1em;
line-height: 1.2;
list-style-type: decimal;
margin-left: 0
}
div#contents-big ul ul {
list-style-type: none;
margin-left: 0
}
div#contents-big li+li {
margin-top: 0.5em
}
div#contents-big .toc-section-number {
margin-right: 0.2em;
}
div#contents-big {
font-size: 80%;
padding-top: 0;

View File

@@ -9,29 +9,29 @@ import Hakyll
import System.FilePath
import Text.Pandoc
notesPattern :: Pattern
notesPattern = "main.md"
mdfiles :: Pattern
mdfiles = "main.md"
imagesPattern :: Pattern
imagesPattern = "images/**"
images :: Pattern
images = "images/**"
mathMacrosPath :: FilePath
mathMacrosPath = "assets/math-macros.tex"
mathMacro :: FilePath
mathMacro = "assets/math-macros.tex"
bibStylePath :: FilePath
bibStylePath = "assets/bib_style.csl"
cslfile :: FilePath
cslfile = "assets/bib_style.csl"
bibliographyPath :: FilePath
bibliographyPath = "ref.bib"
reference :: FilePath
reference = "ref.bib"
fontsPattern :: Pattern
fontsPattern = "assets/fonts/*"
fonts :: Pattern
fonts = "assets/fonts/*"
faviconPath :: FilePath
faviconPath = "assets/favicon.ico"
favicon :: FilePath
favicon = "assets/favicon.ico"
cssPattern :: Pattern
cssPattern = "assets/css/*"
css :: Pattern
css = "assets/css/*"
templatesPattern :: Pattern
templatesPattern = "assets/templates/*"
@@ -45,9 +45,9 @@ templatePostlist = fromFilePath "assets/templates/post-list.html"
chaoDocFiles :: ChaoDocFiles
chaoDocFiles =
ChaoDocFiles
{ chaoDocCslFile = bibStylePath,
chaoDocBibFile = bibliographyPath,
chaoDocMacroFile = mathMacrosPath
{ chaoDocCslFile = cslfile,
chaoDocBibFile = reference,
chaoDocMacroFile = mathMacro
}
config :: Configuration
@@ -60,29 +60,29 @@ config =
main :: IO ()
main = hakyllWith config $ do
match imagesPattern $ do
match images $ do
route idRoute
compile copyFileCompiler
match (fromGlob mathMacrosPath) $ compile getResourceBody
match (fromGlob mathMacro) $ compile getResourceBody
match (fromGlob bibStylePath) $ compile cslCompiler
match (fromGlob cslfile) $ compile cslCompiler
match (fromGlob bibliographyPath) $ compile biblioCompiler
match (fromGlob reference) $ compile biblioCompiler
match fontsPattern $ do
match fonts $ do
route $ gsubRoute "assets/fonts/" (const "fonts/")
compile copyFileCompiler
match (fromGlob faviconPath) $ do
match (fromGlob favicon) $ do
route $ constRoute "favicon.ico"
compile copyFileCompiler
match cssPattern $ do
match css $ do
route $ gsubRoute "assets/css/" (const "css/")
compile compressCssCompiler
match notesPattern $ do
match mdfiles $ do
route $ setExtension "html"
compile $ do
tocCtx <- getTocCtx defaultContext
@@ -93,7 +93,7 @@ main = hakyllWith config $ do
create ["index.html"] $ do
route idRoute
compile $ do
posts <- loadAll notesPattern
posts <- loadAll mdfiles
let indexCtx =
constField "title" ""
`mappend` constField "toc" ""
@@ -131,6 +131,7 @@ getTocCtx ctx = do
pure $
writerOpts
{ writerTableOfContents = True,
writerNumberSections = True,
writerTOCDepth = 2,
writerTemplate = tmpl,
writerHTMLMathMethod = MathML