feat: use latex hugo template
This commit is contained in:
parent
1d12f5614d
commit
9004c27ceb
56 changed files with 1666 additions and 2 deletions
17
layouts/_default/baseof.html
Normal file
17
layouts/_default/baseof.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.LanguageCode }}">
|
||||
{{- partial "head.html" . -}}
|
||||
{{- if site.Params.darkmode -}}
|
||||
<body class="latex-dark">
|
||||
{{- else if site.Params.lightmode -}}
|
||||
<body>
|
||||
{{- else -}}
|
||||
<body class="latex-dark-auto">
|
||||
{{- end -}}
|
||||
{{- partial "header.html" . -}}
|
||||
<div id="content">
|
||||
{{- block "main" . }}{{- end }}
|
||||
</div>
|
||||
{{- partial "footer.html" . -}}
|
||||
</body>
|
||||
</html>
|
29
layouts/_default/list.html
Normal file
29
layouts/_default/list.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
{{ define "main" }}
|
||||
<div class="container" role="main">
|
||||
<div class="posts-list">
|
||||
{{ if .IsHome }}
|
||||
{{ $pag := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }}
|
||||
{{ else }}
|
||||
{{ $pag := .Paginator.Pages }}
|
||||
{{ end }}
|
||||
|
||||
{{ range .Paginator.Pages }}
|
||||
{{ partial "preview.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
|
||||
<ul class="pager">
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<li class="previous">
|
||||
<a href="{{ .Permalink }}page/{{ .Paginator.Prev.PageNumber }}/">← Newer</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if .Paginator.HasNext }}
|
||||
<li class="next">
|
||||
<a href="{{ .Permalink }}page/{{ .Paginator.Next.PageNumber }}/">Older →</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
25
layouts/_default/single.html
Normal file
25
layouts/_default/single.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{ define "main" }}
|
||||
<div class="container" role="main">
|
||||
<article class="article" class="blog-post">
|
||||
<div class="postmeta">
|
||||
{{ partial "postmeta.html" . }}
|
||||
</div>
|
||||
<br>
|
||||
{{ partial "toc.html" . }}
|
||||
|
||||
{{ if .Params.tags }}
|
||||
<div class="blog-tags">
|
||||
{{ range .Params.tags }}
|
||||
<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</article>
|
||||
{{ if and (gt .WordCount 400) (.Param "backtotop") }}
|
||||
{{ partial "backtotop.html" . }}
|
||||
<button onclick="topFunction()" id="backtotopButton">
|
||||
<i class="fa fa-angle-up"></i>
|
||||
</button>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
16
layouts/_default/terms.html
Normal file
16
layouts/_default/terms.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{{ define "main" }}
|
||||
|
||||
<div class="container" role="main">
|
||||
<article class="post-preview">
|
||||
{{ range .Data.Terms.Alphabetical }}
|
||||
<div class="terms">
|
||||
<h4 class="term-name" >
|
||||
<a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a>
|
||||
<span class="badge">{{ .Count }}</span>
|
||||
</h4>
|
||||
</div>
|
||||
{{ end }}
|
||||
</article>
|
||||
</div>
|
||||
|
||||
{{ end }}
|
21
layouts/partials/footer.html
Normal file
21
layouts/partials/footer.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<footer>
|
||||
<div class="container">
|
||||
<p class="credits copyright">
|
||||
<p class="credits theme-by">
|
||||
{{ if .Site.Params.Legal }}
|
||||
<a href="{{ .Site.BaseURL }}legal/">{{ .Site.Params.Legal }}</a>
|
||||
<br>
|
||||
{{ end }}
|
||||
{{ if .Site.Params.PoweredBy }}
|
||||
Powered By <a href="https://gohugo.io">Hugo</a> / Theme <a href="https://github.com/kaisugi/HugoTeX">HugoTeX</a>
|
||||
<br>
|
||||
{{ end }}
|
||||
{{ if .Site.Title }}
|
||||
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>,
|
||||
{{ end }}
|
||||
©
|
||||
{{ .Site.Lastmod.Format "2006" }}
|
||||
<a href="{{ .Site.BaseURL }}about/">{{ .Site.Params.Author.name }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
28
layouts/partials/head.html
Normal file
28
layouts/partials/head.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
{{ if .Title }}
|
||||
<title>{{ .Title }} - {{ .Site.Title }}</title>
|
||||
{{ else }}
|
||||
<title>{{ .Site.Title }}</title>
|
||||
{{ end }}
|
||||
{{ with .Site.Params.description }}
|
||||
<meta name="description" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{- with .Site.Params.Author.Name }}
|
||||
<meta name="author" content="{{ . }}"/>
|
||||
{{- end }}
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
{{ if site.Params.twittercard }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
{{- end }}
|
||||
{{ if site.Params.opengraph }}
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{- end }}
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/latex.css" />
|
||||
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/main.css" />
|
||||
<script id="MathJax-script" async src="{{ .Site.BaseURL }}js/tex-mml-chtml.js"></script>
|
||||
</head>
|
42
layouts/partials/header.html
Normal file
42
layouts/partials/header.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
|
||||
{{ if .IsHome }}
|
||||
{{ if .Site.Params.homeTitle }}
|
||||
{{ $.Scratch.Set "title" .Site.Params.homeTitle }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Set "title" .Site.Title }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Set "title" .Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ $title := $.Scratch.Get "title" }}
|
||||
{{ if $title }}
|
||||
<header>
|
||||
{{ partial "nav.html" . }}
|
||||
<div class="intro-header">
|
||||
<div class="container">
|
||||
<div class="{{ .Type }}-heading">
|
||||
{{ if eq .Type "list" }}
|
||||
<h1>{{ if .Data.Singular }}#{{ end }}{{ .Title }}</h1>
|
||||
{{ else }}
|
||||
<h1>{{ with $title }}{{.}}{{ else }}<br/>{{ end }}</h1>
|
||||
{{ if .IsHome }}
|
||||
<p class="author">{{ with .Site.Params.Author.name }}{{.}}{{ else }}<br/>{{ end }}</p>
|
||||
|
||||
{{ if .Site.Params.Author.abstract }}
|
||||
<div class="abstract">
|
||||
<h5>Abstract</h5>
|
||||
<p>
|
||||
{{ .Site.Params.Author.abstract }}
|
||||
</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{{ else }}
|
||||
<div class="intro-header"></div>
|
||||
{{ end }}
|
22
layouts/partials/nav.html
Normal file
22
layouts/partials/nav.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<nav class="navbar">
|
||||
<div class="nav">
|
||||
{{ if .Site.Params.logo }}
|
||||
<a href="{{ .Site.BaseURL }}" class="nav-logo">
|
||||
<img src="{{ .Site.BaseURL }}images/{{ .Site.Params.logo.url }}"
|
||||
width="{{ .Site.Params.logo.width }}"
|
||||
height="{{ .Site.Params.logo.height }}"
|
||||
alt="{{ .Site.Params.logo.alt }}">
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
<ul class="nav-links">
|
||||
{{ range .Site.Params.nav }}
|
||||
{{ if .icon }}
|
||||
<li><a href="{{ .url | relLangURL }}" name="{{ .name }}"><i class="{{ .icon }}"></i></a></li>
|
||||
{{ else }}
|
||||
<li><a href="{{ .url | relLangURL }}" name="{{ .name }}">{{ .name }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
15
layouts/partials/postmeta.html
Normal file
15
layouts/partials/postmeta.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<span class="meta-post">
|
||||
{{- $lastmod := .Lastmod.Format ( .Site.Params.dateformat | default "Jan 2, 2006") }}
|
||||
{{- $pubdate := .PublishDate.Format ( .Site.Params.dateformat | default "Jan 2, 2006") }}
|
||||
<i class="fa fa-calendar-alt"></i>
|
||||
{{ $pubdate }}
|
||||
{{- if ne $lastmod $pubdate }}
|
||||
({{ $lastmod }})
|
||||
{{- end }}
|
||||
{{ if .Params.categories }}
|
||||
<br><i class="fa fa-folder-open"></i>
|
||||
{{ range .Params.categories }}
|
||||
<a href="{{ $.Site.BaseURL }}/categories/{{ . | urlize }}/">{{ . }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</span>
|
14
layouts/partials/preview.html
Normal file
14
layouts/partials/preview.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<article class="post-preview">
|
||||
<a href="{{ .Permalink }}">
|
||||
<h2 class="post-title">{{ .Title }}</h2>
|
||||
</a>
|
||||
<div class="postmeta">
|
||||
{{ partial "postmeta.html" . }}
|
||||
</div>
|
||||
<div class="post-entry">
|
||||
{{ if .Truncated }}
|
||||
<p>{{ .Summary }}</p>
|
||||
<a href="{{ .Permalink }}" class="post-read-more">Read More</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</article>
|
18
layouts/partials/toc.html
Normal file
18
layouts/partials/toc.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{ if and (gt .WordCount 400) (.Param "toc") }}
|
||||
{{- /* 正規表現でh[1-6]を探す */ -}}
|
||||
{{- $header := (findRE "<h2.*?>(?:.|\n)*?</h2>" .Content) -}}
|
||||
{{- /* 最初に出現するh[1-6]を取得 */ -}}
|
||||
{{- $firstH := index $header 0 -}}
|
||||
|
||||
{{- if ne $firstH nil -}}
|
||||
{{- /* ヘッダーの前にToCを結合した「新しいヘッダー」を作成 */ -}}
|
||||
{{- $newH := printf `%s%s` .TableOfContents $firstH -}}
|
||||
{{- /* 古いヘッダーを新しいヘッダーに置換して出力 */ -}}
|
||||
{{- replace .Content $firstH $newH | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- /* そもそもヘッダーがない時は普通に出力 */ -}}
|
||||
{{- .Content -}}
|
||||
{{- end -}}
|
||||
{{ else }}
|
||||
{{ .Content }}
|
||||
{{ end }}
|
4
layouts/shortcodes/sidenote.html
Normal file
4
layouts/shortcodes/sidenote.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{ $id := md5 .Inner }}
|
||||
<label for="{{ $id }}" class="sidenote-toggle sidenote-number"></label>
|
||||
<input type="checkbox" id="{{ $id }}" class="sidenote-toggle" />
|
||||
<span class="sidenote">{{ .Inner }}</span>
|
9
layouts/shortcodes/table.html
Normal file
9
layouts/shortcodes/table.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{ $htmlTable := .Inner | markdownify }}
|
||||
{{ $old := "<table>" }}
|
||||
{{ $new := "" }}
|
||||
{{ $title := .Get "title" }}
|
||||
{{ if $title }}
|
||||
{{ $new = printf "<table><caption>%s</caption>" ($title | markdownify) }}
|
||||
{{ end }}
|
||||
{{ $htmlTable := replace $htmlTable $old $new }}
|
||||
{{ $htmlTable | safeHTML }}
|
Loading…
Add table
Add a link
Reference in a new issue