Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <i@ryanc.cc>
  • Loading branch information
ruibaby committed Sep 22, 2023
1 parent eb3c1b0 commit dbd8ee9
Show file tree
Hide file tree
Showing 19 changed files with 1,040 additions and 715 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.gradle
build
dist
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scripts": {
"prettier": "prettier --write './templates/**/*.html'"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"prettier": "^3.0.3"
}
}
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 68 additions & 68 deletions templates/archives.html
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org"
th:replace="~{layout :: html(title = |归档 - ${site.title}|, content = ~{::content})}">
<th:block th:fragment="content">


<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{layout :: html(title = |归档 - ${site.title}|, content = ~{::content})}"
>
<th:block th:fragment="content">
<header class="site-header outer">
<div class="inner">
<th:block th:replace="~{partials/site-nav}"></th:block>
</div>
<div class="inner">
<th:block th:replace="~{partials/site-nav}"></th:block>
</div>
</header>
<main id="site-main" class="site-main outer">
<div class="inner">
<article class="post-full post page ">
<header class="post-full-header">
<h1 class="post-full-title">文章归档</h1>
</header>
<th:block th:if="${theme.config.general.archives_cover}">
<figure class="post-full-image"
th:style="|background-image: url(${theme.config.general.archives_cover})|">
</figure>
</th:block>
<section class="post-full-content">
<div class="post-content">
<h1>分类</h1>
<ul th:with="categories = ${categoryFinder.listAll()}">

<li th:each="category : ${categories}">
<a th:href="@{${category.status.permalink}}" th:text="${category.spec.displayName}"></a>
</li>
</ul>

<h1>标签</h1>
<ul th:with="tags = ${tagFinder.listAll()}">

<li th:each="tag : ${tags}">
<a th:href="@{${tag.status.permalink}}" th:text="${tag.spec.displayName}"></a>
</li>

</ul>

<h1>归档</h1>

<th:block th:each="archive : ${archives.items}">
<h2 th:text="|${archive.year}年|"></h2>
<ul class="listing">
<th:block th:each="month : ${archive.months}">
<li th:each="post : ${month.posts}">
<a th:href="@{${post.status.permalink}}" th:text="${post.spec.title}">
</a>
</li>
</th:block>
</ul>
</th:block>


</div>
</section>

</article>

</div>
<div class="inner">
<article class="post-full post page">
<header class="post-full-header">
<h1 class="post-full-title">文章归档</h1>
</header>
<th:block th:if="${theme.config.general.archives_cover}">
<figure
class="post-full-image"
th:style="|background-image: url(${theme.config.general.archives_cover})|"
></figure>
</th:block>
<section class="post-full-content">
<div class="post-content">
<h1>分类</h1>
<ul th:with="categories = ${categoryFinder.listAll()}">
<li th:each="category : ${categories}">
<a
th:href="@{${category.status.permalink}}"
th:text="${category.spec.displayName}"
></a>
</li>
</ul>

<h1>标签</h1>
<ul th:with="tags = ${tagFinder.listAll()}">
<li th:each="tag : ${tags}">
<a
th:href="@{${tag.status.permalink}}"
th:text="${tag.spec.displayName}"
></a>
</li>
</ul>

<h1>归档</h1>

<th:block th:each="archive : ${archives.items}">
<h2 th:text="|${archive.year}年|"></h2>
<ul class="listing">
<th:block th:each="month : ${archive.months}">
<li th:each="post : ${month.posts}">
<a
th:href="@{${post.status.permalink}}"
th:text="${post.spec.title}"
>
</a>
</li>
</th:block>
</ul>
</th:block>
</div>
</section>
</article>
</div>
</main>

<script>
$(function () {
var $postContent = $(".post-full-content");
$postContent.fitVids();
});
$(function () {
var $postContent = $(".post-full-content");
$postContent.fitVids();
});
</script>


</th:block>

</html>
</th:block>
</html>
79 changes: 44 additions & 35 deletions templates/category.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org"
th:replace="~{layout :: html(title = |分类 - ${site.title}|, content = ~{::content})}">
<th:block th:fragment="content">
<header class="site-header outer" th:style="|background-image: url(${theme.config.general.cover})|">
<div class="inner">
<th:block th:replace="~{partials/site-nav}"></th:block>
<div class="site-header-content">
<h1 class="site-title">分类:<th:blcok th:text="${category.spec.displayName}"></th:blcok>
</h1>
<h2 class="site-description">
<th:block th:text="${category.spec.description}" th:if="${category.spec.description != ''}">
</th:block>
<th:block th:text="|共有${category.postCount}文章|"></th:block>
</h2>
</div>

<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{layout :: html(title = |分类 - ${site.title}|, content = ~{::content})}"
>
<th:block th:fragment="content">
<header
class="site-header outer"
th:style="|background-image: url(${theme.config.general.cover})|"
>
<div class="inner">
<th:block th:replace="~{partials/site-nav}"></th:block>
<div class="site-header-content">
<h1 class="site-title">
分类:<th:blcok th:text="${category.spec.displayName}"></th:blcok>
</h1>
<h2 class="site-description">
<th:block
th:text="${category.spec.description}"
th:if="${category.spec.description != ''}"
>
</th:block>
<th:block th:text="|共有${category.postCount}文章|"></th:block>
</h2>
</div>
</div>
</header>
<main id="site-main" class="site-main outer">
<div class="inner">
<div class="post-feed">

<th:block th:each="post : ${posts.items}">
<th:block th:replace="~{partials/post-card :: post-card(${post})}" />
</th:block>
</div>
<div class="inner">
<div class="post-feed">
<th:block th:each="post : ${posts.items}">
<th:block
th:replace="~{partials/post-card :: post-card(${post})}"
/>
</th:block>
</div>
</div>
</main>
<th:block th:if="${posts.total gt 0}">
<script>
// maxPages is a global variable that is needed to determine
// if we need to load more pages for the infinitescroll, or if
// we reached the last page already.
var maxPages = parseInt(document.querySelector(".total").getAttribute("data-total"));
</script>
<script th:src="@{/assets/built/infinitescroll.js}"></script>
<script>
// maxPages is a global variable that is needed to determine
// if we need to load more pages for the infinitescroll, or if
// we reached the last page already.
var maxPages = parseInt(
document.querySelector(".total").getAttribute("data-total"),
);
</script>
<script th:src="@{/assets/built/infinitescroll.js}"></script>
</th:block>

</th:block>

</html>
</th:block>
</html>
Loading

0 comments on commit dbd8ee9

Please sign in to comment.