Skip to content

Commit

Permalink
Merge pull request emacsorphanage#106 from postspectacular/master
Browse files Browse the repository at this point in the history
add category ignore list & refactor tag list emission
  • Loading branch information
sillykelvin committed Feb 9, 2015
2 parents 73e4901 + a896f57 commit 9f1c4b8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
13 changes: 11 additions & 2 deletions op-export.el
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ content of the buffer will be converted into html."
"%Y-%m-%d"
(nth 5 (file-attributes filename)))))
:description ,(or (op/read-org-option "DESCRIPTION")
"No Description")))
"No Description")
:thumb ,(op/read-org-option "THUMBNAIL")))
assets-dir post-content
asset-path asset-abs-path pub-abs-path converted-path
component-table tags category cat-config)
Expand All @@ -121,6 +122,7 @@ content of the buffer will be converted into html."
"\\`/" ""
(plist-get attr-plist :uri)))))
(when do-pub
(princ attr-plist)
(setq post-content (op/render-content))
(setq assets-dir (file-name-as-directory
(concat (file-name-as-directory pub-root-dir)
Expand Down Expand Up @@ -210,6 +212,7 @@ its name and its root folder name under `op/repository-directory'."
(when (and (not (equal f "."))
(not (equal f ".."))
(not (equal f ".git"))
(not (member f op/category-ignore-list))
(not (equal f "blog"))
(file-directory-p
(expand-file-name f op/repository-directory)))
Expand Down Expand Up @@ -387,7 +390,13 @@ publication directory."
(ht ("post-uri"
(plist-get plist :uri))
("post-title"
(plist-get plist :title))))
(plist-get plist :title))
("post-desc"
(plist-get plist :description))
("post-date"
(plist-get plist :date))
("post-thumb"
(or (plist-get plist :thumb) ""))))
(cdr cell)))))
sort-alist)))))
("footer"
Expand Down
17 changes: 10 additions & 7 deletions op-template.el
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ similar to `op/render-header'."
(or (op/read-org-option "DATE")
(format-time-string "%Y-%m-%d"))))
(tags (op/read-org-option "TAGS"))
(tags (if tags
(mapcar
#'(lambda (tag-name)
(ht ("link" (op/generate-tag-uri tag-name))
("name" tag-name)))
(delete "" (mapcar 'trim-string (split-string tags "[:,]+" t))))))
(category (funcall (or op/retrieve-category-function
op/get-file-category)
filename))
Expand All @@ -160,16 +166,13 @@ similar to `op/render-header'."
(format-time-string
"%Y-%m-%d"
(nth 5 (file-attributes filename))))))
("tags" tags)
("tag-links" (if (not tags) "N/A"
(mapconcat
#'(lambda (tag-name)
#'(lambda (tag)
(mustache-render
"<a href=\"{{link}}\">{{name}}</a>"
(ht ("link" (op/generate-tag-uri tag-name))
("name" tag-name))))
(delete "" (mapcar
'trim-string
(split-string tags "[:,]+" t))) ", ")))
"<a href=\"{{link}}\">{{name}}</a>" tag))
tags " ")))
("author" (or (op/read-org-option "AUTHOR")
user-full-name
"Unknown Author"))
Expand Down
4 changes: 4 additions & 0 deletions op-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ default value is `op/get-file-category'."
:category-index nil))
"Configurations for different categories, can and should be customized.")

(defvar op/category-ignore-list
'("themes" "assets")
"Ignore these subdirs/categories for navigation")

;;; this variable is deprecated
(defvar op/default-template-parameters
(ht ("blog-uri" "/blog/")
Expand Down

0 comments on commit 9f1c4b8

Please sign in to comment.