Welcome to mirror list, hosted at ThFree Co, Russian Federation.

single.html « posts « layouts - github.com/uPagge/uBlogger.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 38fe8fb5f06fd20ab05699ba012ec75462f335b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}

{{- define "content" -}}
    {{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
    {{- $author := .Params.author | default .Site.Author.name -}}
    {{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}

    <article class="warpper">
        <h1 class="post-title animated flipInX">{{ .Title }}</h1>

        <div class="post-meta">
            <div class="post-meta-main">
                <a class="author" href="{{ $author_link }}" rel="author" target="_blank">
                    <i class="fas fa-user-circle fa-fw"></i>{{ $author }}&nbsp;
                </a>
                {{- with .Params.categories -}}
                    <span class="post-category">
                        {{- T "included" -}}&nbsp;
                        {{- range . -}}
                            {{- $name := . -}}
                            {{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
                                <i class="far fa-folder fa-fw"></i><a href="{{ .Permalink }}">{{ $name }}</a>
                            {{- end -}}
                        {{- end -}}
                    </span>
                {{- end -}}
            </div>
            <div class="post-meta-other">
                <i class="far fa-calendar-alt fa-fw"></i><time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp;
                <i class="fas fa-pencil-alt fa-fw"></i>{{ T "wordCount" .WordCount }}&nbsp;
                <i class="far fa-clock fa-fw"></i>{{ T "readingTime" .ReadingTime }}&nbsp;
                {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.valine.enable | and .Site.Params.valine.visitor -}}
                    <span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
                        <i class="far fa-eye fa-fw"></i>{{ T "pageviews" | safeHTML }}
                    </span>&nbsp;
                {{- end -}}
            </div>
        </div>

        {{- with .Params.featured_image -}}
            <div class="post-featured-image">
                {{- $res := resources.Get "svg/loading.svg" | minify -}}
                <img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ . }}" alt="featured image" class="lazyload">
            </div>
        {{- end -}}

        {{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
            <div class="post-toc" id="post-toc">
                <h2 class="post-toc-title">{{ T "toc" }}</h2>
                {{- $globalAutoCollapseToc := .Site.Params.auto_collapse_toc | default true }}
                <div class="post-toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.auto_collapse_toc false)) }} always-active{{ end }}">
                    {{- .TableOfContents -}}
                </div>
            </div>
            <div class="post-toc-mobile" id="post-toc-mobile">
                <details>
                    <summary>
                        <div class="post-toc-title">
                            <span>{{ T "toc" }}</span>
                            <span><i class="details icon fas fa-angle-down"></i></span>
                        </div>
                    </summary>
                    <div class="post-toc-content">
                        {{- $toc := .TableOfContents -}}
                        {{- $toc = replaceRE `id="TableOfContents"` `id="TableOfContentsMobile"` $toc -}}
                        {{- $toc | safeHTML -}}
                    </div>
                </details>
            </div>
        {{- end -}}

        <div class="post-content">
            {{- $content := .Content -}}

            {{- $REin := `:\(([\w- ]+?)\):` -}}
            {{- $REout := `<i class="$1 fa-fw"></i>` -}}
            {{- $content = replaceRE $REin $REout $content -}}

            {{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
            {{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
            {{- $content = replaceRE $REin $REout $content -}}

            {{- $REin = `<sup>\[return\]</sup>` -}}
            {{- $REout = `↩︎` -}}
            {{- $content = replaceRE $REin $REout $content -}}

            {{- $REin = `<(h[23456]) (id=".+?")>` -}}
            {{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
            {{- $content = replaceRE $REin $REout $content -}}

            {{- $REin = `<(.+?) (id="fnref:.+?")>` -}}
            {{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
            {{- $content = replaceRE $REin $REout $content -}}

            {{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
            {{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
            {{- $content = replaceRE $REin $REout $content -}}

            {{- $content | safeHTML -}}
        </div>

        {{- partial "post/footer.html" . -}}

        <div class="post-comment">
            {{- if ( .Params.comment | default true ) -}}
                {{- partial "comments.html" . -}}
            {{- end -}}
        </div>
    </article>
{{- end -}}