57 lines
1.7 KiB
Bash
57 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# file: gsl__do_commons
|
|
# Folder: /var/lib/gsl/scripts
|
|
# By echolib
|
|
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
|
|
|
#=======================================================================
|
|
# Get NEEDED DATAS from HEADERS
|
|
#=======================================================================
|
|
gsl__get_needed_headers() {
|
|
gsl_post_type=`gsl__get_header "$gsl_marker_type" "$gsl_post"`
|
|
gsl_header_title=`gsl__get_header "$gsl_marker_title" "$gsl_post"`
|
|
gsl_header_slug=`gsl__get_header "$gsl_marker_slug" "$gsl_post"`
|
|
gsl_header_author=`gsl__get_header "$gsl_marker_author" "$gsl_post"`
|
|
gsl_header_date=`gsl__get_header "$gsl_marker_date" "$gsl_post"`
|
|
gsl_header_info=`gsl__get_header "$gsl_marker_info" "$gsl_post"`
|
|
gsl_header_tags=`gsl__get_header "$gsl_marker_tags" "$gsl_post"`
|
|
}
|
|
|
|
#======================================================================
|
|
# Check | Make in Loop from header datas $1: process $2:marker $3:file
|
|
#======================================================================
|
|
gsl__do_header() {
|
|
unset ${!gsl_post_hf@}
|
|
|
|
# Stats
|
|
gsl_stat_link=0
|
|
gsl_stat_abbr=0
|
|
gsl_stat_file=0
|
|
gsl_stat_fcode=0
|
|
|
|
while read -r "gsl_header_content_line"
|
|
do
|
|
gsl__get_header_fields "$2"
|
|
|
|
case "$1" in
|
|
check)
|
|
case "$2" in
|
|
"$gsl_marker_link") gsl__check_link ;;
|
|
"$gsl_marker_abbr") gsl__check_abbr ;;
|
|
"$gsl_marker_file") gsl__check_file ;;
|
|
"$gsl_marker_image") gsl__check_image ;;
|
|
"$gsl_marker_code") gsl__check_fcode ;;
|
|
esac
|
|
;;
|
|
|
|
make)
|
|
case "$2" in
|
|
"$gsl_marker_link") gsl__make_link ;;
|
|
"$gsl_marker_abbr") gsl__make_abbr ;;
|
|
esac
|
|
;;
|
|
esac
|
|
|
|
done < <(gsl__get_header "$2" "$3")
|
|
}
|