fix links bugs
This commit is contained in:
parent
c56449b1d5
commit
23b980eff0
3 changed files with 20 additions and 25 deletions
24
Makefile
24
Makefile
|
@ -46,18 +46,7 @@ $(DST_DIR)/%.html: $(SRC_DIR)/%.org $(TEMPLATE)
|
||||||
ALL += $(DST_PANDOC_FILES)
|
ALL += $(DST_PANDOC_FILES)
|
||||||
html: $(DST_PANDOC_FILES)
|
html: $(DST_PANDOC_FILES)
|
||||||
|
|
||||||
|
# INDEXES
|
||||||
# HTML INDEX
|
|
||||||
HTML_INDEX := $(DST_DIR)/index.html
|
|
||||||
MKINDEX := engine/mk-index.sh
|
|
||||||
$(HTML_INDEX): $(DST_PANDOC_FILES) $(MKINDEX) $(TEMPLATE)
|
|
||||||
@mkdir -p $(DST_DIR)
|
|
||||||
$(MKINDEX)
|
|
||||||
ALL += $(HTML_INDEX)
|
|
||||||
|
|
||||||
index: $(HTML_INDEX)
|
|
||||||
|
|
||||||
# RSS
|
|
||||||
SRC_POSTS_DIR ?= $(SRC_DIR)/posts
|
SRC_POSTS_DIR ?= $(SRC_DIR)/posts
|
||||||
DST_POSTS_DIR ?= $(DST_DIR)/posts
|
DST_POSTS_DIR ?= $(DST_DIR)/posts
|
||||||
SRC_POSTS_FILES ?= $(shell find $(SRC_POSTS_DIR) -type f -name "*$(EXT)")
|
SRC_POSTS_FILES ?= $(shell find $(SRC_POSTS_DIR) -type f -name "*$(EXT)")
|
||||||
|
@ -70,6 +59,17 @@ $(RSS_CACHE_DIR)/%.xml: $(DST_POSTS_DIR)/%.html
|
||||||
@mkdir -p "$(dir $@)"
|
@mkdir -p "$(dir $@)"
|
||||||
hxclean "$<" > "$@"
|
hxclean "$<" > "$@"
|
||||||
|
|
||||||
|
# HTML INDEX
|
||||||
|
HTML_INDEX := $(DST_DIR)/index.html
|
||||||
|
MKINDEX := engine/mk-index.sh
|
||||||
|
$(HTML_INDEX): $(DST_XML_FILES) $(MKINDEX) $(TEMPLATE)
|
||||||
|
@mkdir -p $(DST_DIR)
|
||||||
|
$(MKINDEX)
|
||||||
|
ALL += $(HTML_INDEX)
|
||||||
|
|
||||||
|
index: $(HTML_INDEX)
|
||||||
|
|
||||||
|
# RSS
|
||||||
DST_RSS_FILES ?= $(patsubst %.xml,%.rss, $(DST_XML_FILES))
|
DST_RSS_FILES ?= $(patsubst %.xml,%.rss, $(DST_XML_FILES))
|
||||||
ALL += $(DST_RSS_FILES)
|
ALL += $(DST_RSS_FILES)
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ cd "$(git rev-parse --show-toplevel)" || exit 1
|
||||||
webdir="_site"
|
webdir="_site"
|
||||||
postsdir="$webdir/posts"
|
postsdir="$webdir/posts"
|
||||||
indexfile="$webdir/index.html"
|
indexfile="$webdir/index.html"
|
||||||
|
indexdir=".cache/rss"
|
||||||
|
|
||||||
# maximal number of articles to put in the index homepage
|
# maximal number of articles to put in the index homepage
|
||||||
maxarticles=1000
|
maxarticles=1000
|
||||||
|
@ -38,16 +39,10 @@ autoload -U colors && colors
|
||||||
tmpdir=$(mktemp -d)
|
tmpdir=$(mktemp -d)
|
||||||
typeset -a dates
|
typeset -a dates
|
||||||
dates=( )
|
dates=( )
|
||||||
for fic in $postsdir/**/*.html; do
|
for xfic in $indexdir/**/*.xml; do
|
||||||
if echo $fic|egrep -- '-(mk|min|sci|modern).html$'>/dev/null; then
|
postfile="$(echo "$xfic"|sed 's#^'$postsdir'/##')"
|
||||||
continue
|
blogfile="$(echo "$xfic"|sed 's#.xml$#.html#;s#^'$indexdir'/#posts/#')"
|
||||||
fi
|
|
||||||
postfile="$(echo "$fic"|sed 's#^'$postsdir'/##')"
|
|
||||||
blogfile="$(echo "$fic"|sed 's#^'$webdir'/##')"
|
|
||||||
printf "%-30s" $postfile
|
printf "%-30s" $postfile
|
||||||
xfic="$tmpdir/$fic.xml"
|
|
||||||
mkdir -p $(dirname $xfic)
|
|
||||||
hxclean $fic > $xfic
|
|
||||||
d=$(finddate $xfic)
|
d=$(finddate $xfic)
|
||||||
echo -n " [$d]"
|
echo -n " [$d]"
|
||||||
rssdate=$(formatdate $d)
|
rssdate=$(formatdate $d)
|
||||||
|
@ -60,7 +55,7 @@ for fic in $postsdir/**/*.html; do
|
||||||
printf "\\n<span class=\"pubDate\">%s</span>%s" "$d"
|
printf "\\n<span class=\"pubDate\">%s</span>%s" "$d"
|
||||||
printf "<span class=\"tags\">%s</span>" "$categories"
|
printf "<span class=\"tags\">%s</span>" "$categories"
|
||||||
printf "\\n</li>\\n\\n"
|
printf "\\n</li>\\n\\n"
|
||||||
} >> "$tmpdir/${d}-$(basename $fic).index"
|
} >> "$tmpdir/${d}-$(basename $xfic).index"
|
||||||
dates=( $d $dates )
|
dates=( $d $dates )
|
||||||
echo " [${fg[green]}OK${reset_color}]"
|
echo " [${fg[green]}OK${reset_color}]"
|
||||||
done
|
done
|
||||||
|
|
|
@ -42,10 +42,10 @@ mkcategories(){
|
||||||
|
|
||||||
autoload -U colors && colors
|
autoload -U colors && colors
|
||||||
|
|
||||||
postfile="$(echo "$fic"|sed 's#^'$postsdir'/##')"
|
|
||||||
blogfile="$(echo "$fic"|sed 's#^'$webdir'/##')"
|
|
||||||
printf "%-30s" $postfile
|
|
||||||
xfic="$fic"
|
xfic="$fic"
|
||||||
|
postfile="$(echo "$fic"|sed 's#^'$postsdir'/##')"
|
||||||
|
blogfile="$(echo "$fic"|sed 's#.xml$#.html#;s#^'$indexdir'/#posts/#')"
|
||||||
|
printf "%-30s" $postfile
|
||||||
d=$(finddate $xfic)
|
d=$(finddate $xfic)
|
||||||
echo -n " [$d]"
|
echo -n " [$d]"
|
||||||
rssdate=$(formatdate $d)
|
rssdate=$(formatdate $d)
|
||||||
|
|
Loading…
Reference in a new issue