klaanon-builder

klaanon builder - html ja epub
git clone https://neny.bioklaani.fi/git/klaanon-builder.git
Log | Files | Refs | README

json_parse.sh (390B)


      1 command1='def time: . | strptime("%Y-%m-%dT%H:%M")|mktime|strflocaltime("%d.%m.%Y"); .posts |  .[] | '
      2 if [ -z "$1" ]
      3 then
      4     condition=""
      5 else
      6     condition="select($1) | "
      7 fi
      8 command2='"<h1><a href=#\(.id) id=\(.id)>\(.creator)</a></h1><div class=\"timestamp\">\(.timestamp|time)</div><p>\(.content)</p>"'
      9 
     10 full_command="$command1$condition$command2"
     11 jq -r "$full_command" klaanon.json