diff options
author | Zhiming Wang <zmwangx@gmail.com> | 2015-05-05 00:19:05 -0700 |
---|---|---|
committer | Zhiming Wang <zmwangx@gmail.com> | 2015-05-05 00:20:57 -0700 |
commit | 015e3b4716a15c674829034bce56b83b323688df (patch) | |
tree | affdc4cc09c5ddd558370911a6e5368412e35116 /tools/convert-from-octopress.awk | |
parent | d14e9ac5b86c911cb255ab30425790488c20fb4d (diff) | |
download | my_new_personal_website-015e3b4716a15c674829034bce56b83b323688df.tar.xz my_new_personal_website-015e3b4716a15c674829034bce56b83b323688df.zip |
convert date metadata field to ISO 8601
Diffstat (limited to 'tools/convert-from-octopress.awk')
-rwxr-xr-x | tools/convert-from-octopress.awk | 13 |
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 |