#SBWG 0.9.11

# This is a SBWG settings file for the SBWG example web site

# The name/title of the website as displayed in the header and used in the browser window title bar/browser tabs.
sitename="ExSite (The Example Web Site)"

# This url is used when external documents that link to the web site are generated, e.g. the RSS feed. It should not contain a trailing slash ('/').
url="https://www.example.com"

# Set default style - Any files in the styles directory name [stylename].css or [stylename]-*.css are used, where [stylename] is the value set below.
style=elth

logfile="${shellbase}sbwg-log"

# Default output directory (where the generated web site is written to) - can be overwritten with option -o
# The 'html' directory inside the source/input directory is the default output directory. Uncomment and change if you want the site to be generated
# into a different directory by default.
#odir="${shellbase}/html"

# Default width/height for image gallery thumbnails in pixels - I say default, but there's currently no option to overwrite this (except with CSS).
thumbsize=200					# Thumbnails used in the view of galleries attached to blog entries
minisize=60					# Square thumbnails used at the top of a gallery page
previewsize=800					# Large images in the gallery view, linked to the original image files
smallsize=600					# Previews used for entry pictures

# Number of entries per page - If a list of entries (tagpage or all.html) contains more than this amount of entries it's split into several pages.
perpage=5

# Maximum file name length in bytes
maxfnl=255
# Other examples of possible maximum filename length definitions:
#maxfnl=8.3	# For old DOS systems
#maxfnl=1024	# Maxmum allwed filename length on common linux filesystems

# This adds a "Home" link at the beginning of the navigation bar.
hook_navbar_before() {
  o echo "<div class=\"navheading\"><h3><a href=\"/index.html\" title=\"Go To The Start Page\">Home</a></h3></div>"
}

# This adds an "About" link at the end of the navigation bar.
hook_navbar_after() {
  o echo "<div class=\"navheading\"><h3><a href=\"/about.html\" title=\"About This Site\">About</a></h3></div>"
  o echo "<div class=\"navheading\"><h3><a href=\"/INSTALL.html\" title=\"Display The Content Of SBWG's INSTALL File\">INSTALL</a></h3></div>"
  o echo "<div class=\"navheading\"><h3><a href=\"/README.html\" title=\"Display The Content Of SBWG's README File\">README</a></h3></div>"
}

# This function is called once after the navbar has been generated.
hook_navbar_end() {
  if [[ ${style} == tensum ]]; then						# If the style set "tensum" is used (the mobile style that comes with the example
										#   site, then navbar.html should be linked to instead of adding the navbar into
										#   every generated HTML file.
    d "Mobile style detected. Replacing navbar with link to navbar.html."
    add_navbar() {								# Overwrite the funtion that is normally used to add the navbar to every generated
										#   HTML file, replace it with a link to the separate navbar file.
      o printf "<section>\n"							# This is just to enable styling.
      o printf "<nav class=\"menu-link\">\n"
      o printf "<a href=\"/navbar.html\" class=\"menu-link\">Menu</a>\n"
      o printf "</nav>\n"    
    }
  fi
}

# This function is called every time an HTML file is generated, right before the site name/title is printed.
hook_sitename_before() {
  o printf '      <img id="logo" width="200" src="/files/logo.svg" />\n'	# Adds the logo from the files directory to the header section.
}

# The following functions are uncommented by default. They are here as examples of what hooks you could add to your web site.
# Simply remove the # at the beginning of the code lines to enable them for this web site.

# This is an example for style sheet injection with hook_head.
# hook_head is executed every time an HTML header is generated.
# Output from hook_head will be included in the HTML header.
# This style sheet will change the colours depending on the date and time at generation.
#hook_head() {						# This is called every time an HTML header is generated.
#  o echo "<style>"
#  o echo "  h1, h2, h3 { color: #$(date +%y%m%d); }"	# date (yy-mm-dd) as colour code
#  o echo "  p { color: #$(date +%H%M%S); }"		# time (hh:mm:ss) as colour code
#  o echo "</style>"
#}

# This is an example of how links/menus/menu items can be added to the sidebar with hook_sidebar.
# hook_sidebar is executed every time the sidebar is generated, which is only once per run.
#hook_navbar_end() {					# This is called after generating the sidebar, before closing it.
#  echo '<div id="promo">'							>> "${tmpdir}/navbar"
#  echo 'Please also check out these interesting projects (no affiliation):'	>> "${tmpdir}/navbar"
#  echo '<li class="link"><a title="AAAAA" href="AAAAA">AAAAA</a></li>'		>> "${tmpdir}/navbar"
#  echo '<li class="link"><a title="BBBBB" href="BBBBB">BBBBB</a></li>'		>> "${tmpdir}/navbar"
#  echo '<li class="link"><a title="CCCCC" href="CCCCC">CCCCC</a></li>'		>> "${tmpdir}/navbar"
#  echo '<li class="link"><a title="DDDDD" href="DDDDD">DDDDD</a></li>'		>> "${tmpdir}/navbar"
#  echo '<li class="link"><a title="EEEEE" href="EEEEE">EEEEE</a></li>'		>> "${tmpdir}/navbar"
#  echo "<p> <center> Look, it's an owl! <br />"				>> "${tmpdir}/navbar"
#  echo '<img src="/files/moose.jpg" alt="picture of a moose" width="150"> </center> </p>'	>> "${tmpdir}/navbar"
#  echo '</div>'								>> "${tmpdir}/navbar"
#}

# This is an example of how HTML can be injected at the end of the categories list in the navigation bar. 
# hook_navbar_item_change is called after the last item of every tag type has been added to the navigation bar.
# By checking what that item is you can output the additional line only at the end of a certain list, categories in this case.
# This only adds the link to the navigation bar. The actual tagpage is generated through the hook_tagpages_entry below.
#hook_navbar_item_change() {
#  [[ ${item} == cat* ]] &&
#    o echo "<li class=\"cat ${oddity}\"><a title=\"Show blog entries that are quite short.\" href=\"/tags/$(pathshortener "cat:short").html\">(Short Entries)</a></li>"
#}
# This adds a tag to all entries whose content is shorter than a certain amount of characters.
# This does not add a link to this possibly previously non-existing tagpage in the navigation bar.
#hook_tagpages_entry() {
#  local content
##  content=$(cat "${shellbase}/entries/${entry}" | tail -n +$(grab_tag "${tags}" taglines))
#  content="$(awk "NR > $(grab_tag "${tags}" taglines) { print }" < "${shellbase}/entries/${entry}")"
#  local size
##  size=$(echo "${content}"|wc -c)
#  size=${#content}										# Determine how many characters this content is long.
#  [[ ${size} -lt 500 ]] && [[ ${tags} != *$'\n'sort:* ]] && {
#    tags="${tags}"$'\n'"cat:short"
#    vv "Added tag 'cat:short' to the entry '${entry}'."
#  }
#}

hook_above_entry_content_before() {
  [[ flags == "*incomplete*" ]] && c '<div class="note">This entry is work in progress, not finished, incomplete, not done and imperfect.</div>'
}
