diff options
| -rw-r--r-- | css/default.css | 2 | ||||
| -rwxr-xr-x | post-process.sh | 19 | ||||
| -rw-r--r-- | publish.el | 55 | 
3 files changed, 41 insertions, 35 deletions
| diff --git a/css/default.css b/css/default.css index fd06f35..96c6a5e 100644 --- a/css/default.css +++ b/css/default.css @@ -33,7 +33,7 @@ nav a {      background-color: #f3f3f3;  } -div#content { +div#content, div#comments {      width: calc(var(--main-width) - 1rem);      margin: auto;      margin-bottom: 2rem; diff --git a/post-process.sh b/post-process.sh index 1056d7d..81a216b 100755 --- a/post-process.sh +++ b/post-process.sh @@ -1,19 +1,20 @@ -# This file is released into the public domain. -  #!/bin/bash +# This file is released into the public domain.  # clean up generated sitemap files.  rm pages/{micro,}blog.org -# fix absolute links mislabelled as file:// links -for post in $(ls site/posts); do -    sed -i 's/src="file:\/\//src="/g' site/posts/$post -    sed -i 's/href="file:\/\//href="/g' site/posts/$post +for post in site/posts/*.html; do +    # fix absolute links mislabelled as file:// links +    sed -i 's/src="file:\/\//src="/g' "$post" +    sed -i 's/href="file:\/\//href="/g' "$post" +    # add comments link +    sed -Ei 's/(<span class="subtitle">)(.*)(<\/span>)/\1\2 | <a href="#isso-thread">Comments<\/a>\3/' "$post"  done -for page in $(ls site); do -    sed -i 's/src="file:\/\//src="/g' site/$page -    sed -i 's/href="file:\/\//href="/g' site/$page +for page in site/*.html; do +    sed -i 's/src="file:\/\//src="/g' "$page" +    sed -i 's/href="file:\/\//href="/g' "$page"  done  # fix email address. @@ -1,4 +1,4 @@ -;; Copyright (C) 2021 Yuchen Pei. +;; Copyright (C) 2021-2022 Yuchen Pei.  ;; This file is part of site generator for Yuchen's personal website (abbreviated to sg4y). @@ -26,10 +26,10 @@  (defun me/html-preamble (plist)    "PLIST: An entry."    (if (org-export-get-date plist this-date-format) -        (plist-put plist -             :subtitle (format "Published on %s" -                               (org-export-get-date plist this-date-format) -			       ))) +      (plist-put plist +                 :subtitle +                 (format "Published on %s" +                         (org-export-get-date plist this-date-format))))    ;; Preamble    (with-temp-buffer      (insert-file-contents "../html-templates/preamble.html") (buffer-string))) @@ -38,6 +38,12 @@    (with-temp-buffer      (insert-file-contents "../html-templates/postamble.html") (buffer-string))) +(defun me/html-postamble-post (plist) +  (concat "<div id=\"comments\"> +  <section id=\"isso-thread\"></section> +</div>" +          (me/html-postamble plist))) +  (defun me/org-posts-sitemap-format-entry (entry style project)    "Format posts with author and published data in the index page. @@ -49,8 +55,7 @@ PROJECT: `posts in this case."                   (format-time-string this-date-format                                       (org-publish-find-date entry project))                   entry -                 (org-publish-find-title entry project) -		 )) +                 (org-publish-find-title entry project)))          ((eq style 'tree) (file-name-nondirectory (directory-file-name entry)))          (t entry))) @@ -60,14 +65,14 @@ The content starts with the first empty line."    (let ((file (org-publish--expand-file-name file project)))      (when (and (file-readable-p file) (not (directory-name-p file)))        (with-temp-buffer -	(insert-file-contents file) -	;; important, otherwise org may truncate the sitemap, probably -	;; due to some problem in converting all things to a list -	(delete-trailing-whitespace)  -	(goto-char (point-min)) -	(let ((beg (+ 1 (re-search-forward "^$")))) -	  (buffer-substring beg (point-max))))))) -     +	      (insert-file-contents file) +	      ;; important, otherwise org may truncate the sitemap, probably +	      ;; due to some problem in converting all things to a list +	      (delete-trailing-whitespace)  +	      (goto-char (point-min)) +	      (let ((beg (+ 1 (re-search-forward "^$")))) +	        (buffer-substring beg (point-max))))))) +  (defun me/org-microposts-sitemap-format-entry (entry style project)    "Format microposts with author and published data in the index page. @@ -75,16 +80,16 @@ ENTRY: file-name  STYLE:  PROJECT: `microposts in this case."    (cond ((not (directory-name-p entry)) -	 (format "*[[%s][%s]]* - %s\n<<%s>>\n\n%s" -		 (file-name-sans-extension entry) -		 (format-time-string this-date-format -				     (org-publish-find-date entry project)) -		 (org-publish-find-title entry project) -		 (file-name-sans-extension entry) -		 (org-publish-find-content entry project) -		 )) -	((eq style 'tree) (file-name-nondirectory (directory-file-name entry))) -	(t entry))) +	       (format "*[[%s][%s]]* - %s\n<<%s>>\n\n%s" +		             (file-name-sans-extension entry) +		             (format-time-string this-date-format +				                             (org-publish-find-date entry project)) +		             (org-publish-find-title entry project) +		             (file-name-sans-extension entry) +		             (org-publish-find-content entry project) +		             )) +	      ((eq style 'tree) (file-name-nondirectory (directory-file-name entry))) +	      (t entry)))  (defun me/org-publish-microblog (plist filename pub-dir)    "Publish RSS with PLIST, only when FILENAME is '../pages/microblog.org'. | 
