<!DOCTYPE html>

<html>

<head>
    {{ partial "head.html" . }}
</head>

<body style="overflow-x: unset;">
    <div class="container-fluid">
        <div class="row d-print-block">
            <div class="col-12 col-md-3 col-lg-2 bd-sidebar d-print-none">
                {{ partial "notes-header" . }}
                {{ partial "notes-sidebar" . }}
            </div>
            <div class="col-12 col-md-9 col-lg-10 d-print-block">
                <div class="row d-print-block">
                    <main class="col-12 col-md-10 col-lg-9 py-md-3 pl-md-5 bd-content d-print-block" role="main">
                        <div id="title" class="my-4 border-bottom">
                            <h2>
                                {{ .Title }}
                            </h2>
                            {{ if not .Parent.IsHome }}
                                <footer>
                                    {{ with .Params.textbook }}
                                    <span>
                                        <i class="iconfont icon-book1 mr-2"></i>
                                        {{ . | markdownify }}
                                    </span> <br />
                                    {{ end }}
                                    {{ with .Params.course }}
                                    <span>
                                        <i class="iconfont icon-chalkboard-teacher mr-2"></i>
                                        {{ . | markdownify }}
                                    </span> <br />
                                    {{ end }}
                                    {{ with .Params.version }}
                                    <span>
                                        <i class="iconfont icon-git mr-2"></i> 修改记录<br />
                                        {{ range . }}
                                        <span style="margin-left: 2rem;">{{.}}</span><br />
                                        {{ end }}
                                    </span>
                                    {{ end }}
                                </footer>
                                <br />
                                {{ .Content }}
                            {{ else }}
                                {{ .Content }}
                            {{ end }}
                        </div>
                        <div id="notes-list" class="list-group">
                            {{ range .Pages.ByWeight }}
                            <a class="list-group-item" href="{{ .RelPermalink }}">
                                {{ .Title }}
                                {{ if eq .Kind "section" }}
                                <span class="float-right">{{ len .Pages }} 篇</span>
                                {{ else }}
                                <span class="float-right">
                                    {{ dateFormat .Site.Params.dateformFull .Lastmod.Local }}
                                </span>
                                {{ end }}
                            </a>
                            {{ end }}
                        </div>
                    </main>
                    <div class="d-none d-lg-block col-lg-3 bd-toc d-print-none">
                        {{ partial "notes-func" . }}
                        {{ .TableOfContents }}
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js"
        integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/axios@0.19.0/dist/axios.min.js" integrity="sha256-S1J4GVHHDMiirir9qsXWc8ZWw74PHHafpsHp5PXtjTs=" crossorigin="anonymous"></script>
    
    <script>
        const loadPage = (div, title, link) => {
            div.append('<h1>' + title + '</h1>');
            return new Promise((resolve, reject) => {
                axios.get(link)
                    .then(res => {
                        const page = $(res.data);
                        div.append(page.find('#content'));
                        resolve();
                    })
                    .catch(err => reject(err));
            });
        }
        const printAllNotes = () => {
            const body = $('body');
            const title = $('#title').clone().find('a').remove().end().text();
            const list = $('#notes-list').children();
            
            body.children().remove();
            body.append('<h1 id="title">Loading notes...</h1><hr/>');
            
            let pageLoaders = [];
            $.each(list, (id, anchor) => {
                console.log(id, anchor);
                const div = $('<div id="page-' + id + '"></div>');
                div.appendTo(body);
                pageLoaders[id] = loadPage(div, anchor.text, anchor.href);
            });

            Promise.all(pageLoaders)
                .then(() => {
                    renderMathInElement(document.body, {
                        delimiters: [{
                            left: "$$",
                            right: "$$",
                            display: true
                        },
                        {
                            left: "\\[",
                            right: "\\]",
                            display: true
                        },
                        {
                            left: "$",
                            right: "$",
                            display: false
                        },
                        {
                            left: "\\(",
                            right: "\\)",
                            display: false
                        }]
                    });
                    $('#title').text(title);
                    window.print();
                    window.location.reload();
                })
                .catch(err => {
                    $('#title').addClass('text-danger');
                    $('#title').text('Loading failed.');
                    console.error(err);
                });
        }
    </script>
</body>

</html>
{'avg_line_length': 44.567567567567565, 'max_line_length': 201, 'alphanum_fraction': 0.34596725288053365, 'licenses': ['MIT'], 'repository_name': 'Sciroccogti/hugo-theme-ztyblog', 'path': 'layouts/notes/list.html', 'size': 6606, 'lang': 'HTML'}