~stormdragon2976/bashtml

84ea5ce7cfaa8bd7ea5d2837b39910850aaa6d0c — Storm Dragon 10 months ago e62b42f
Added plugin calls for top of index page and top of article pages.
1 files changed, 11 insertions(+), 4 deletions(-)

M bashtml.sh
M bashtml.sh => bashtml.sh +11 -4
@@ 458,6 458,12 @@ create_html_page() {
        echo '</div></div></div>' # title, header, headerholder
        echo '<div id="divbody"><div class="content">'

        # Article_top and index_top plugins
        if [[ $index == no ]]; then
            call_plugins article_top
        else
            call_plugins index_top
        fi
        file_url=${filename#./}
        file_url=${file_url%.rebuilt} # Get the correct URL when rebuilding
        # one blog entry


@@ 555,7 561,7 @@ parse_file() {

    # Create the actual html page
    create_html_page "$content" "$filename" no "$title" "$2" "$global_author"
    rm "$content"
    [[ -f "$content" ]] && rm "$content"
}

# Manages the creation of the text file and the parsing to html file


@@ 1231,9 1237,10 @@ do_main() {
call_plugins() {
    local functionName="$1"
    shift
    for i in "${plugins[@]}" ; do
        if [[ "$i" =~ ^plugin_${functionName} ]]; then
            ${i} "$@"
    # Use p as a strange loop variable explicitly. Using i as a variable caused weird issues where this function was called from a loop also using i, and so the variable outside the function got foobarred.
    for p in "${plugins[@]}" ; do
        if [[ "$p" =~ ^plugin_${functionName} ]]; then
            ${p} "$@"
        fi
    done
}