markdown.sh: improve support for OBJDIR

This commit is contained in:
Pierre Pronchery 2021-06-21 00:12:31 +02:00
parent 84ab864c0b
commit 9d02c72b1b

View File

@ -31,7 +31,7 @@ PROGNAME="markdown.sh"
#executables #executables
DEBUG="_debug" DEBUG="_debug"
INSTALL="install -m 0644" INSTALL="install -m 0644"
MD2RST="m2r --overwrite" MD2RST="m2r --dry-run"
MKDIR="mkdir -m 0755 -p" MKDIR="mkdir -m 0755 -p"
RM="rm -f" RM="rm -f"
RST2HTML="rst2html5" RST2HTML="rst2html5"
@ -62,25 +62,29 @@ _markdown()
ext="${ext##.}" ext="${ext##.}"
case "$ext" in case "$ext" in
html) html)
$DEBUG $MD2RST "$source" || return 2 rst="${target%.*}.rst"
$DEBUG $RST2HTML "${target%.*}.rst" > "$target" $DEBUG $MD2RST "$source" > "$rst" || return 2
$DEBUG $RST2HTML "$rst" > "$target"
res=$? res=$?
;; ;;
pdf) pdf)
$DEBUG $MD2RST "$source" || return 2 rst="${target%.*}.rst"
$DEBUG $MD2RST "$source" > "$rst" || return 2
R2P="$RST2PDF" R2P="$RST2PDF"
[ -f "${source%.*}.style" ] && [ -f "${source%.*}.style" ] &&
R2P="$R2P -s ${source%.*}.style" R2P="$R2P -s ${source%.*}.style"
$DEBUG $R2P "${target%.*}.rst" > "$target" $DEBUG $R2P "$rst" > "$target"
res=$? res=$?
;; ;;
rst) rst)
$DEBUG $MD2RST "$source" || return 2 rst="${target%.*}.rst"
$DEBUG $MD2RST "$source" > "$rst" || return 2
res=$? res=$?
;; ;;
1|2|3|4|5|6|7|8|9) 1|2|3|4|5|6|7|8|9)
$DEBUG $MD2RST "$source" || return 2 rst="${target%.*}.rst"
$DEBUG $RST2MAN "${target%.*}.rst" > "$target" $DEBUG $MD2RST "$source" > "$rst" || return 2
$DEBUG $RST2MAN "$rst" > "$target"
res=$? res=$?
;; ;;
*) *)