diff options
| -rwxr-xr-x | bin/journeuf | 4 | ||||
| -rwxr-xr-x | bin/mdtf | 23 |
2 files changed, 25 insertions, 2 deletions
diff --git a/bin/journeuf b/bin/journeuf index 5354dea..3586445 100755 --- a/bin/journeuf +++ b/bin/journeuf @@ -8,8 +8,8 @@ js=$(LC_TIME=fr_FR.UTF-8 date +%A | awk '{print toupper(substr($0,1,1)) substr($ ms=$(LC_TIME=fr_FR.UTF-8 date +%B | awk '{print toupper(substr($0,1,1)) substr($0,2)}') file=$(echo "Journal${ms}$an" | noaccent) if [ -f tags ]; then - tagline="${an}_${mois}_${jour} $file /$js $((0+jour))" + tagline="${an}_${mois}_${jour} $file /$js ${jour#0}" echo "$tagline" >> tags LC_ALL=C sort -o tags -u tags fi -echo "$js $((0+jour))" +echo "$js ${jour#0}" diff --git a/bin/mdtf b/bin/mdtf new file mode 100755 index 0000000..be5beaa --- /dev/null +++ b/bin/mdtf @@ -0,0 +1,23 @@ +#!/bin/sh + +# mdtf - markdown table formater + +awk -F '|' ' +NR == 1 { n = NF-2 } +{ for (j = 1; j < n+2; j++) cell[NR,j] = $(j+1) } +END { + for (j = 1; j < n+2; j++) { + max = 1 + for (i = 1; i <= NR; i++) { + l = length(cell[i,j]) + max = l > max ? l : max + } + for (i = 1; i <= NR; i++) { + p = substr(cell[i,j], 1, 1) + line[i] = line[i] FS cell[i,j] fill(max-length(cell[i,j]), p) + } + } + for (i = 1; i <= NR; i++) print line[i] +} +func fill(n, p, i, s) { for (i = 0; i < n; i++) s = s p; return s } +' |
