From e23f6bf925dab078787b5033b5c30b69c026c9a1 Mon Sep 17 00:00:00 2001 From: liuyib <1656081615@qq.com> Date: Sat, 24 Aug 2019 09:04:16 +0800 Subject: [PATCH] style: Format pug & stylus --- layout/_common/config.pug | 14 +++++++------- layout/_common/footer.pug | 12 ++++++------ layout/_common/head.pug | 2 +- layout/_common/layout.pug | 2 +- layout/_common/main.pug | 6 +++--- layout/_components/analytics/busuanzi.pug | 8 ++++---- layout/_components/pagination.pug | 2 +- layout/_components/recent-posts.pug | 6 +++--- layout/_components/search/algolia.pug | 6 +++--- layout/_mixins/post-header.pug | 16 ++++++++-------- layout/_mixins/posts-sort.pug | 4 ++-- layout/_third-party/analytics/busuanzi.pug | 1 - layout/_third-party/comments/index.pug | 2 +- layout/_third-party/search/localsearch.pug | 3 +-- layout/archive.pug | 2 +- layout/category.pug | 2 +- layout/index.pug | 2 +- layout/page.pug | 8 ++++---- layout/post.pug | 12 ++++++------ layout/tag.pug | 2 +- source/css/_components/external-link.styl | 2 +- source/css/_components/search/common.styl | 2 +- source/css/_components/search/localsearch.styl | 2 +- source/css/_components/tag-plugin/note.styl | 7 ++++++- 24 files changed, 64 insertions(+), 61 deletions(-) diff --git a/layout/_common/config.pug b/layout/_common/config.pug index ad11104..90c85e7 100644 --- a/layout/_common/config.pug +++ b/layout/_common/config.pug @@ -1,5 +1,5 @@ - - var algolia = 'undefined'; + var algolia = "undefined"; var env = process.env; if (theme.algolia_search.enable) { algolia = JSON.stringify({ @@ -15,14 +15,14 @@ }); } - var sidebar = 'undefined'; + var sidebar = "undefined"; if (theme.sidebar.enable) { sidebar = JSON.stringify({ offsetTop: theme.sidebar.offsetTop }); } - var back2top = 'undefined'; + var back2top = "undefined"; if (theme.back2top.enable) { back2top = JSON.stringify({ enable: theme.back2top.enable, @@ -30,22 +30,22 @@ }); } - var gallery_waterfall = 'undefined'; + var gallery_waterfall = "undefined"; if (theme.gallery_waterfall.enable) { gallery_waterfall = JSON.stringify(theme.gallery_waterfall); } - var lazyload = 'undefined'; + var lazyload = "undefined"; if (theme.lazyload.enable) { lazyload = JSON.stringify(theme.lazyload); } - var zoom_image = 'undefined'; + var zoom_image = "undefined"; if (theme.zoom_image.enable) { zoom_image = JSON.stringify(theme.zoom_image); } - var external_link = 'undefined'; + var external_link = "undefined"; if (theme.external_link.icon.enable) { external_link = JSON.stringify({ icon: { diff --git a/layout/_common/footer.pug b/layout/_common/footer.pug index 57f09b9..dca7742 100644 --- a/layout/_common/footer.pug +++ b/layout/_common/footer.pug @@ -18,12 +18,12 @@ footer#footer ).footer-separator else span= " " - + span= footer.copyright.text || config.author + "." if footer.copyright.enable && footer.beian.enable span.footer-separator= "|" - + if footer.beian.enable span!= footer.beian.icp @@ -33,10 +33,10 @@ footer#footer span.footer-powered - var HEXO_URL = "http://hexo.io/"; != _p("footer.powered", link_to(HEXO_URL, "hexo", { external: true })) - + if footer.powered.version span= " v" + hexo_env("version") + "." - + if footer.powered.enable && footer.theme.enable span.footer-separator= "|" @@ -44,10 +44,10 @@ footer#footer span= _p("footer.theme") + " - " - var STUN_URL = "https://github.com/liuyib/hexo-theme-stun/"; != link_to(STUN_URL, "stun", { external: true }) - + if footer.theme.version span= " v" + stun_env("version") + "." - + if theme.busuanzi.enable include ../_components/analytics/busuanzi.pug diff --git a/layout/_common/head.pug b/layout/_common/head.pug index bbefa71..51f094a 100644 --- a/layout/_common/head.pug +++ b/layout/_common/head.pug @@ -32,7 +32,7 @@ meta(name="apple-mobile-web-app-status-bar-style" content="black") if theme.pwa && theme.pwa.enable if theme.pwa.theme_color meta(name="theme-color" content=theme.pwa.theme_color) - + if theme.pwa.manifest link(rel="manifest" href=`${url_for(theme.pwa.manifest)}?v=${stun_env("version")}`) diff --git a/layout/_common/layout.pug b/layout/_common/layout.pug index ad937da..524d4a8 100644 --- a/layout/_common/layout.pug +++ b/layout/_common/layout.pug @@ -10,7 +10,7 @@ html(lang=config.language) if theme.back2top.enable include ../_components/back2top.pug - + include ../_components/search/index.pug include ../_scripts/cdn.pug include ../_scripts/common.pug diff --git a/layout/_common/main.pug b/layout/_common/main.pug index c338498..f11e04d 100644 --- a/layout/_common/main.pug +++ b/layout/_common/main.pug @@ -2,13 +2,13 @@ main#main div.main-inner if theme.sidebar.enable include ./sidebar.pug - + if body div!= body else block content - + if page.comments include ../_components/comments.pug - + div.clearfix diff --git a/layout/_components/analytics/busuanzi.pug b/layout/_components/analytics/busuanzi.pug index 2bb85b1..b85329b 100644 --- a/layout/_components/analytics/busuanzi.pug +++ b/layout/_components/analytics/busuanzi.pug @@ -5,17 +5,17 @@ div.busuanzi if !theme.busuanzi.site.icon_only span= _p("footer.uv") + " " - + span#busuanzi_value_site_uv - + if theme.busuanzi.site.uv.enable && theme.busuanzi.site.pv.enable span.separator= "|" if theme.busuanzi.site.pv.enable span.busuanzi-pv i.fa.fa-eye - + if !theme.busuanzi.site.icon_only span= _p("footer.pv") + " " - + span#busuanzi_value_site_pv diff --git a/layout/_components/pagination.pug b/layout/_components/pagination.pug index e84af96..3d10d7e 100644 --- a/layout/_components/pagination.pug +++ b/layout/_components/pagination.pug @@ -15,7 +15,7 @@ nav#paginator a(href=url_for(page.prev.path)) i.fa.fa-chevron-left span.title= page.prev.title || _p("post.untitled") - + if (page.next) div.article-next.pull-right a(href=url_for(page.next.path)) diff --git a/layout/_components/recent-posts.pug b/layout/_components/recent-posts.pug index bc871f0..933884a 100644 --- a/layout/_components/recent-posts.pug +++ b/layout/_components/recent-posts.pug @@ -5,14 +5,14 @@ section#recent-posts.recent-posts - postLists.each(function (post) { article(class=`${post.link ? 'post-link' : ''}`).post +postHeader(post) - + div.post-body if theme.post_list.cover_image.home && post.top_image img(src=post.top_image) - + if post.photos && post.photos.length +gallery(post) - + if theme.auto_excerpt && theme.auto_excerpt.enable - const content = strip_html(post.content) - var excerpt = content.substring(0, theme.auto_excerpt.length) diff --git a/layout/_components/search/algolia.pug b/layout/_components/search/algolia.pug index c399c6f..7be4b21 100644 --- a/layout/_components/search/algolia.pug +++ b/layout/_components/search/algolia.pug @@ -3,11 +3,11 @@ div.search-mask div.search-popup span.search-close div.search-input - + div.search-results div#algolia-hits - + div#algolia-pagination - + if theme.algolia_search.labels.show_stats div#algolia-stats diff --git a/layout/_mixins/post-header.pug b/layout/_mixins/post-header.pug index 53461a7..6dba143 100644 --- a/layout/_mixins/post-header.pug +++ b/layout/_mixins/post-header.pug @@ -2,7 +2,7 @@ mixin postHeader(post) header.post-header if post.top include ../_components/sticky-top.pug - + if is_post() h1.post-title= post.title || _p("post.untitled") else @@ -14,7 +14,7 @@ mixin postHeader(post) h1.post-title a(href=url_for(post.path) ).post-title-link= post.title || _p("post.untitled") - + if !post.link div.post-meta if theme.post_meta.created.enable @@ -24,7 +24,7 @@ mixin postHeader(post) if !theme.post_meta.icon_only span= _p("post.posted") + " " span= full_date(post.date, "YYYY-MM-DD") - + if theme.post_meta.updated.enable span.post-update i(class=`fa fa-${theme.post_meta.updated.icon}`) @@ -32,7 +32,7 @@ mixin postHeader(post) if !theme.post_meta.icon_only span= _p("post.updated") + " " span= full_date(post.updated, "YYYY-MM-DD") - + if theme.post_meta.word_count.enable span.post-word-count i(class=`fa fa-${theme.post_meta.word_count.icon}`) @@ -40,12 +40,12 @@ mixin postHeader(post) if !theme.post_meta.icon_only span= _p("post.word_count") + " " span= wordcount(post.content) - + if theme.post_meta.reading_time.enable - var postReadingTime = theme.post_meta.reading_time span.post-reading-time i(class=`fa fa-${postReadingTime.icon}`) - + if !theme.post_meta.icon_only span= _p("post.reading_time") + " " - var READING_TIME_UNIT = "m"; @@ -64,8 +64,8 @@ mixin postHeader(post) if theme.busuanzi.enable && theme.busuanzi.post_pv.enable span.post-reading-count i(class=`fa fa-${theme.busuanzi.post_pv.icon}`) - + if !theme.post_meta.icon_only && !theme.busuanzi.post_pv.icon_only span= _p("post.reading_count") + " " - + span#busuanzi_value_page_pv diff --git a/layout/_mixins/posts-sort.pug b/layout/_mixins/posts-sort.pug index a555676..4288675 100644 --- a/layout/_mixins/posts-sort.pug +++ b/layout/_mixins/posts-sort.pug @@ -4,11 +4,11 @@ mixin articleSort(posts) - posts.each(function (post) { if post.date - tmpYear = full_date(post.date, "YYYY") - + if tmpYear !== year - year = tmpYear time.article-sort-item.year= year - + post.article-sort-item if post.date time.article-sort-item__time= full_date(post.date, "MM-DD") diff --git a/layout/_third-party/analytics/busuanzi.pug b/layout/_third-party/analytics/busuanzi.pug index 3465ed7..37e6120 100644 --- a/layout/_third-party/analytics/busuanzi.pug +++ b/layout/_third-party/analytics/busuanzi.pug @@ -1,6 +1,5 @@ - var busuanzi_js = "https://cdn.jsdelivr.net/gh/sukkaw/busuanzi@latest/bsz.pure.mini.js" - if (theme.cdn.busuanzi) busuanzi_js = theme.cdn.busuanzi script(async src=busuanzi_js) diff --git a/layout/_third-party/comments/index.pug b/layout/_third-party/comments/index.pug index 5be2d66..9cd1b9e 100644 --- a/layout/_third-party/comments/index.pug +++ b/layout/_third-party/comments/index.pug @@ -10,4 +10,4 @@ if page.comments else if theme.valine && theme.valine.enable include ./valine.pug else if theme.valine && theme.valine.enable && theme.valine.visitor - include ./valine.pug + include ./valine.pug diff --git a/layout/_third-party/search/localsearch.pug b/layout/_third-party/search/localsearch.pug index aadac49..8e21555 100644 --- a/layout/_third-party/search/localsearch.pug +++ b/layout/_third-party/search/localsearch.pug @@ -122,8 +122,7 @@ if theme.local_search.enable // 索引位置相同的关键词,保留长度较长的 titleHitSlice.forEach(function (hit) { - if (hit.index === index && - hit.word.length < word.length) { + if (hit.index === index && hit.word.length < word.length) { hit.word = word; hasMatch = true; } diff --git a/layout/archive.pug b/layout/archive.pug index 882c8bd..5b74a64 100644 --- a/layout/archive.pug +++ b/layout/archive.pug @@ -15,6 +15,6 @@ block content +articleSort(page.posts) else +articleSort(site.posts) - + if theme.post_list.paginate.archives include ./_components/pagination.pug diff --git a/layout/category.pug b/layout/category.pug index 5e6cf85..14d0e1e 100644 --- a/layout/category.pug +++ b/layout/category.pug @@ -2,7 +2,7 @@ extends ./_common/layout.pug block content include ./_mixins/posts-sort.pug - + div.content div.category-inner div.article-sort-title= _p("page.categories") + " - " + page.category diff --git a/layout/index.pug b/layout/index.pug index cdfe963..2d7ad0d 100644 --- a/layout/index.pug +++ b/layout/index.pug @@ -3,7 +3,7 @@ extends ./_common/layout.pug block content include ./_mixins/posts-sort.pug include ./_mixins/post-header.pug - + div.content.home-content.code-highlight if theme.post_list.paginate.home include ./_components/recent-posts.pug diff --git a/layout/page.pug b/layout/page.pug index a580ce1..782b037 100644 --- a/layout/page.pug +++ b/layout/page.pug @@ -7,7 +7,7 @@ block content div.content.tag-cloud if page.photos && page.photos.length +gallery(page) - + div.tag-cloud-title= _p("page.tags") + " - " span.tag-cloud-num= site.tags.length - var min_font = theme.tag_cloud ? theme.tag_cloud.min_size : 14 @@ -19,7 +19,7 @@ block content div.content.category if page.photos && page.photos.length +gallery(page) - + div.category-title= _p("page.categories") + " - " span.category-num= site.categories.length != list_categories() @@ -27,11 +27,11 @@ block content div.content.headings.code-highlight if page.photos && page.photos.length +gallery(page) - + != page.content else div.content.headings.code-highlight if page.photos && page.photos.length +gallery(page) - + != page.content diff --git a/layout/post.pug b/layout/post.pug index f282c22..db8f8e2 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -3,14 +3,14 @@ extends ./_common/layout.pug block content include ./_mixins/post-header.pug include ./_mixins/gallery.pug - + div.content.headings.code-highlight +postHeader(page) - + div.post-body if page.photos && page.photos.length +gallery(page) - + != page.content footer.post-footer @@ -19,7 +19,7 @@ block content span= "------" span= _p("post.end") span= "------" - + - let themeConfigCC = theme.creative_commons.enable && theme.creative_commons.post if page.copyright === false ? page.copyright : themeConfigCC include ./_components/copyright.pug @@ -30,8 +30,8 @@ block content i.fa.fa-tags.icon each tag in page.tags.data span!= link_to(tag.permalink, tag.name) - + if page.reward === false ? page.reward : (theme.reward && theme.reward.enable) include ./_components/reward.pug - + include ./_components/pagination.pug diff --git a/layout/tag.pug b/layout/tag.pug index 951da81..64452da 100644 --- a/layout/tag.pug +++ b/layout/tag.pug @@ -2,7 +2,7 @@ extends ./_common/layout.pug block content include ./_mixins/posts-sort.pug - + div.content div.tag-inner div.article-sort-title= _p("page.tags") + " - " + page.tag diff --git a/source/css/_components/external-link.styl b/source/css/_components/external-link.styl index e0ac4fc..9187777 100644 --- a/source/css/_components/external-link.styl +++ b/source/css/_components/external-link.styl @@ -5,8 +5,8 @@ .footer-inner .external-link i - color: #fff font-size: .7em + color: #fff .post-title .external-link i diff --git a/source/css/_components/search/common.styl b/source/css/_components/search/common.styl index eaa37ed..c0edfa0 100644 --- a/source/css/_components/search/common.styl +++ b/source/css/_components/search/common.styl @@ -59,7 +59,7 @@ width: 1rem height: .2rem background-color: $black-light - + @extend .anime-close .search-results diff --git a/source/css/_components/search/localsearch.styl b/source/css/_components/search/localsearch.styl index 77c9688..2a9a6d8 100644 --- a/source/css/_components/search/localsearch.styl +++ b/source/css/_components/search/localsearch.styl @@ -32,7 +32,7 @@ &:hover color: $blue-light - + b color: $blue-light diff --git a/source/css/_components/tag-plugin/note.styl b/source/css/_components/tag-plugin/note.styl index 2eb8c41..581e08a 100644 --- a/source/css/_components/tag-plugin/note.styl +++ b/source/css/_components/tag-plugin/note.styl @@ -56,7 +56,12 @@ strong color: #dc3b3b - h1, h2, h3, h4, h5, h6 + h1, + h2, + h3, + h4, + h5, + h6 margin: 0 strong -- GitLab