Przeglądaj źródła

Post refactor to hold everything its own (#88)

Khosrow Moossavi 7 lat temu
rodzic
commit
4426c889fd

+ 3 - 0
assets/scss/_content.scss

@@ -19,6 +19,9 @@
         }
       }
     }
+    footer {
+      margin-top: 4.0rem;
+    }
   }
 }
 

+ 2 - 1
layouts/partials/list.html

@@ -3,7 +3,8 @@
   <ul>
     {{ range .Paginator.Pages }}
     <li>
-      <span>{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</span><a href="{{ .URL }}">{{ .Title }}</a>
+      <span>{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</span>
+      <a href="{{ .URL }}">{{ .Title }}</a>
     </li>
     {{ end }}
   </ul>

+ 0 - 42
layouts/partials/post.html

@@ -1,42 +0,0 @@
-<section class="container post">
-  <article>
-    <header>
-      <h1 class="title">{{ .Title }}</h1>
-      <h2 class="date">{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</h2>
-
-      {{ if eq .Params.math "true" }}
-        <script type="text/javascript" async
-          src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full">
-          MathJax.Hub.Config({
-            tex2jax: {
-              inlineMath: [['$','$']],
-              displayMath: [['$$','$$']],
-              processEscapes: true,
-              processEnvironments: true,
-              skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
-              TeX: { extensions: ["AMSmath.js", "AMSsymbols.js"] }
-            }
-          });
-          MathJax.Hub.Queue(function() {
-            // Fix <code> tags after MathJax finishes running. This is a
-            // hack to overcome a shortcoming of Markdown. Discussion at
-            // https://github.com/mojombo/jekyll/issues/199
-            var all = MathJax.Hub.getAllJax(), i;
-            for(i = 0; i < all.length; i += 1) {
-                all[i].SourceElement().parentNode.className += ' has-jax';
-            }
-          });
-          </script>
-      {{ end }}
-    </header>
-
-    {{ .Content }}
-  </article>
-
-  <br/>
-
-  {{ if and (not (eq .Site.DisqusShortname "" )) (eq (.Params.disable_comments | default false) false)}}
-      {{ template "_internal/disqus.html" . }}
-  {{ end }}
-
-</section>

+ 3 - 0
layouts/partials/posts/disqus.html

@@ -0,0 +1,3 @@
+{{- if and (not (eq .Site.DisqusShortname "" )) (eq (.Params.disable_comments | default false) false) -}}
+  {{ template "_internal/disqus.html" . }}
+{{- end -}}

+ 24 - 0
layouts/partials/posts/math.html

@@ -0,0 +1,24 @@
+{{- if eq .Params.math "true" -}}
+  <script type="text/javascript" async
+    src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full">
+    MathJax.Hub.Config({
+      tex2jax: {
+        inlineMath: [['$','$']],
+        displayMath: [['$$','$$']],
+        processEscapes: true,
+        processEnvironments: true,
+        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
+        TeX: { extensions: ["AMSmath.js", "AMSsymbols.js"] }
+      }
+    });
+    MathJax.Hub.Queue(function() {
+      // Fix <code> tags after MathJax finishes running. This is a
+      // hack to overcome a shortcoming of Markdown. Discussion at
+      // https://github.com/mojombo/jekyll/issues/199
+      var all = MathJax.Hub.getAllJax(), i;
+      for(i = 0; i < all.length; i += 1) {
+          all[i].SourceElement().parentNode.className += ' has-jax';
+      }
+    });
+  </script>
+{{- end -}}

+ 4 - 0
layouts/posts/li.html

@@ -0,0 +1,4 @@
+<li>
+  <span>{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</span>
+  <a href="{{ .URL }}">{{ .Title }}</a>
+</li>

+ 16 - 0
layouts/posts/list.html

@@ -0,0 +1,16 @@
+{{ define "title" }}
+  {{ .Title }} · {{ .Site.Title }}
+{{ end }}
+{{ define "content" }}
+  <section class="container list">
+    <h1 class="title">{{ .Title }}</h1>
+
+    <ul>
+      {{- range .Paginator.Pages -}}
+        {{- .Render "li" -}}
+      {{- end -}}
+    </ul>
+
+    {{ partial "pagination.html" . }}
+  </section>
+{{ end }}

+ 18 - 1
layouts/posts/single.html

@@ -2,5 +2,22 @@
   {{ .Title }} · {{ .Site.Title }}
 {{ end }}
 {{ define "content" }}
-  {{ partial "post.html" . }}
+  <section class="container post">
+    <article>
+      <header>
+        <h1 class="title">{{ .Title }}</h1>
+        <h2 class="date">{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</h2>
+      </header>
+
+      <div>
+        {{ .Content }}
+      </div>
+
+      <footer>
+        {{ partial "posts/disqus" . }}
+      </footer>
+    </article>
+
+    {{ partial "posts/math" . }}
+  </section>
 {{ end }}

Plik diff jest za duży
+ 0 - 0
resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.content


+ 1 - 1
resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.json

@@ -1 +1 @@
-{"Target":"css/coder.min.4a8dda2d21e45ad90d61a0816771871321476edace917e4e9973e8efbe852ff6.css","MediaType":"text/css","Data":{"Integrity":"sha256-So3aLSHkWtkNYaCBZ3GHEyFHbtrOkX5OmXPo776FL/Y="}}
+{"Target":"css/coder.min.578f8fce262e4c448c239b69661084c57507b89d51b8d04de15cd1d8f8135600.css","MediaType":"text/css","Data":{"Integrity":"sha256-V4+PziYuTESMI5tpZhCExXUHuJ1RuNBN4VzR2PgTVgA="}}

+ 9 - 1
resources/_gen/assets/scss/scss/coder.scss_fd4b5b3f9a48bc0c7f005d2f7a4cc30f.content

@@ -171,6 +171,12 @@ img {
 .float-left {
   float: left; }
 
+.fab {
+  font-weight: 400; }
+
+.fas {
+  font-weight: 900; }
+
 .content {
   flex: 1;
   margin-top: 1.6rem;
@@ -188,6 +194,8 @@ img {
       @media only screen and (max-device-width: 768px) {
         .content article header h2 {
           font-size: 1.6rem; } }
+  .content article footer {
+    margin-top: 1.0rem; }
 
 .avatar img {
   width: 20rem;
@@ -202,7 +210,7 @@ img {
   list-style: none;
   padding: 0; }
   .list ul li {
-    font-size: 1.6rem; }
+    font-size: 1.8rem; }
     @media only screen and (max-device-width: 768px) {
       .list ul li {
         margin: 1.6rem 0 1.6rem 0; } }

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików