summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2022-11-01 00:42:20 -0300
committerYaco <franco@reevo.org>2022-11-01 00:42:20 -0300
commitb9816bc1c44b57d3e737f241253f74491385a768 (patch)
tree99a245fb0fb3cd1c10495b8ad3f7e7e23b6a94b3
parentf6ada400510ba77a2840d1944cb0a184269c4849 (diff)
fixes to process articles
-rwxr-xr-xplatform/bin/doku2md.sh32
1 files changed, 20 insertions, 12 deletions
diff --git a/platform/bin/doku2md.sh b/platform/bin/doku2md.sh
index 635effb..d7ca5db 100755
--- a/platform/bin/doku2md.sh
+++ b/platform/bin/doku2md.sh
@@ -24,23 +24,29 @@ IFS=$'\n'
n=`grep -n -m 1 ':]' $1 |sed 's/\([0-9]*\).*/\1/'`
- csplit -s $1 $n -f $1.tmp.
+ if [ -z "$n" ]; then
+ cat $1 > $name.body.tmp
+ else
+ csplit -s $1 $n -f $1.tmp.
+
+ ## Agrega saltos de linea y elimina corchete final
+
+ grep ':]' $1.tmp.01 | perl -p -e 's/\n/\n\n/' > $1.footer.tmp
- ## Agrega saltos de linea y elimina corchete final
+ sed -i 's/]$//g' $1.footer.tmp
- grep ':]' $1.tmp.01 | perl -p -e 's/\n/\n\n/' > $1.footer.tmp
+ ## Unifica todo y corrige corchete de apertura
- sed -i 's/]$//g' $1.footer.tmp
+ cat $1.tmp.00 > $1.tmp
- ## Unifica todo y corrige corchete de apertura
+ cat $1.footer.tmp >> $1.tmp
- cat $1.tmp.00 > $1.tmp
+ sed 's/:]/]:/g' $1.tmp > $name.body.tmp
- cat $1.footer.tmp >> $1.tmp
+ cat $name.body.tmp
- sed 's/:]/]:/g' $1.tmp > $name.body.tmp
+ fi
- cat $name.body.tmp
read
@@ -64,6 +70,10 @@ if test -f "$dir/index"; then
yaml_date=`grep 'LANG_publicationdate' "$dir/index" | cut -d ':' -f2 | sed 's/** //'`
+ if [[ $yaml_date == "*YEAR*" ]]; then
+ # If the Year is not defined, we try to take it from the path
+ yaml_date=`echo $1 | cut -d "-" -f 1 | rev | cut -d '/' -f1 | rev`
+ fi
yaml_author=`grep 'LANG_author' "$dir/index" | cut -d ':' -f2 | sed 's/ //'`
if [ -z "$yaml_author" ]
then
@@ -144,6 +154,4 @@ cat $name.body.tmp >> $name.md
-rm $dir/*.tmp
-
-rm $dir/*.tmp.*
+rm $dir/*tmp*