aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorZhiming Wang <zmwangx@gmail.com>2015-05-05 00:19:05 -0700
committerZhiming Wang <zmwangx@gmail.com>2015-05-05 00:20:57 -0700
commit015e3b4716a15c674829034bce56b83b323688df (patch)
treeaffdc4cc09c5ddd558370911a6e5368412e35116 /tools
parentd14e9ac5b86c911cb255ab30425790488c20fb4d (diff)
downloadmy_new_personal_website-015e3b4716a15c674829034bce56b83b323688df.tar.xz
my_new_personal_website-015e3b4716a15c674829034bce56b83b323688df.zip
convert date metadata field to ISO 8601
Diffstat (limited to 'tools')
-rwxr-xr-xtools/convert-from-octopress.awk13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/convert-from-octopress.awk b/tools/convert-from-octopress.awk
index 20556044..43978df3 100755
--- a/tools/convert-from-octopress.awk
+++ b/tools/convert-from-octopress.awk
@@ -26,9 +26,18 @@
} else if ($1 == "layout:" || $1 == "comments:" || $1 == "categories:") {
next
} else if ($1 == "date:") {
- print
+ # Convert
+ #
+ # date: 2015-05-03 17:15:49 -0700
+ #
+ # to
+ #
+ # date: 2015-05-03T17:15:49-0700
+ # date-display: May 3, 2015
+ #
+ # Requires date from coreutils; BSD date doesn't work.
+ printf "date: %sT%s%s\n", $2, $3, $4
printf "date-display: "
- # requires date from coreutils; BSD date doesn't work
system("date -d "$2" +'%B %_d, %Y'")
} else {
print