~stormdragon2976/bashtml

a2e7dbca451b1f2db3f57fa85b130845904982c1 — Storm Dragon 1 year, 7 months ago d16bf61
Fixed a bug with plugins getting the wrong file name for index.html. Settings variables should now be available inside plugins.
1 files changed, 5 insertions(+), 4 deletions(-)

M bashtml.sh
M bashtml.sh => bashtml.sh +5 -4
@@ 29,6 29,7 @@ configuration() {
  # Loads or creates configuration file, .bashtmlrc.
  [[ -f ".bashtmlrc" ]] && {
    source ".bashtmlrc";
    export settings
    return;
  }
  # No configuration file was detected, so write it


@@ 388,6 389,8 @@ EOF
}

build_pages() {
  # Set the filename to index.html so that plugins that depend on it will work.
  fileName="index.html"
  # Start the index file
  add_header "index"
  # Remove the postnumber from the index.


@@ 493,10 496,8 @@ new_post() {
    build_pages
    echo "$title published successfully."
    # Plugins called after successful post.
    # $1 title, $2 page name, $3 url for blog
    for i in $(ls bashtml-plugins/*.post 2> /dev/null) ; do
      ./$i "$title" "$pageName" "${settings[blogURL]}"
    done
    # Plugins called after article is posted.
    run_plugins post
  else
    echo "A file named ${pageName}.${settings[pageExtension]} already exists."
    echo "Your file is saved at $htmlFile. Please place it manually."