diff --git a/init b/init index b5322bf..3cabc3d 100755 --- a/init +++ b/init @@ -39,52 +39,16 @@ EOF mkdir -p tmpl { test -r tmpl/header.html } || { - cat < tmpl/header.html - - - + cp -v jaroweb/tmpl/header.html tmpl } - - - - - - - - - - - - - - - -
-EOF -} - -{ test -r tmpl/footer.html } || { cp -v jaroweb/tmpl/footer.html tmpl/footer.html } +{ test -r tmpl/footer.html } || { + cp -v jaroweb/tmpl/footer.html tmpl } { test -r tmpl/navbar.html } || { - cat < tmpl/navbar.html - -
  • -
  • artworks
  • -
  • writings
  • -
  • media
  • -
  • -
  • contact
  • -EOF -} + cp -v jaroweb/tmpl/navbar.html tmpl } + +{ test -r views/js/html5.js } || { + cp -v jaroweb/js/html5.js views/js } { test -r views/css/bootstrap.css } || { notice "Downloading and installing Bootstrap" @@ -113,7 +77,6 @@ TITLE="A new website made with Jaro Web." BRAND="Jaro Web" DESCRIPTION="Jaro Web, your slick and static website publisher, powered by HTML5, Zsh and Bootstrap" KEYWORDS="web, design, html" -NAVCLASS="navbar-fixed-top" EOF } diff --git a/render b/render index 9546934..0ec4def 100755 --- a/render +++ b/render @@ -2,7 +2,7 @@ # # Jaro Web, your slick and static website publisher # -# Copyleft (C) 2012 Denis Roio +# Copyleft (C) 2012-2013 Denis Roio # # This source code is free software; you can redistribute it and/or # modify it under the terms of the GNU Public License as published by @@ -32,6 +32,8 @@ source config.zsh notice "Rendering $BRAND website" act "Title: $TITLE" +typeset -a includejs + mkdir -p pub cat << EOF > pub/.htaccess DirectoryIndex index index.html index.php @@ -44,13 +46,58 @@ render_header() { $TITLE - - + + + + + + + + + + + + + + + EOF + + { test "$1" = "" } || { echo "${@}"; echo } + cat tmpl/header.html - echo "" + + cat < + + +
    +EOF + + cat tmpl/navbar.html + +} + +render_footer() { + cat tmpl/footer.html + + cat < +EOF + + { test "$1" = "" } || { echo "${@}"; echo } + + for i in $includejs; do + echo "" + done + +cat < + +EOF } render_html() { @@ -81,7 +128,9 @@ render_html() { grep -v '^#' ${src} >> $dst echo "" >> $dst - cat tmpl/footer.html >> $dst + includejs+=(js/bootstrap.min.js) + render_footer >> $dst + print "done." } @@ -113,7 +162,9 @@ render_markdown() { cat ${src} | markdown >> $dst echo "" >> $dst - cat tmpl/footer.html >> $dst + includejs+=(js/bootstrap.min.js) + render_footer >> $dst + print "done." @@ -131,19 +182,7 @@ render_gallery() { act -n "rendering gallery: $dst... " - cat < $dst - - - - $TITLE - - - -EOF - cat tmpl/header.html >> $dst - echo "" >> $dst + render_header "" > $dst cat <> $dst @@ -152,16 +191,31 @@ cat <> $dst

    - + ×
      - - - +EOF - EOF - cat tmpl/footer.html >> $dst + +# includejs+=(js/blueimp-helper.js) + includejs+=(js/jquery.min.js) + includejs+=(js/bootstrap.min.js) + includejs+=(js/blueimp-gallery.min.js) +# includejs+=(js/jquery.blueimp-gallery.min.js) + # includejs+=(js/blueimp-gallery-fullscreen.js) + includejs+=($dst_js) + render_footer >> $dst + print "done." } @@ -200,140 +283,35 @@ read_meta() { /title/ { printf "title=\""; for(i=3;i<=NF;i++) printf "%s ", $i; printf "\";" } /description/ { printf "description=\""; for(i=3;i<=NF;i++) printf "%s ", $i; printf "\";" } /keywords/ { printf "keywords=\""; for(i=3;i<=NF;i++) printf "%s ", $i; printf "\";" } - /link/ { printf "link=\""; for(i=3;i<=NF;i++) printf "%s ", $i; printf "\";" } - /icon/ { printf "icon=\""; for(i=3;i<=NF;i++) printf "%s ", $i; printf "\";" } - /image/ { printf "image=\""; for(i=3;i<=NF;i++) printf "%s ", $i; printf "\";" } + /gallery/ { printf "gallery=\""; for(i=3;i<=NF;i++) printf "%s ", $i; printf "\";" } ' ${1}` eval "$tmp" } -render_section() { - sname=${1} - spath=views/${sname} - - - { test -d ${spath} } && { - # the section is a directory containing files - # so we generate its html - - pages=`find ${spath} -type f` - { test ${#pages} = 0 } && { - print "${sname} section is an empty directory" - return 1 } - - print "${sname} section" - print "

      ${sname//_/ }

      " > ${spath}.html - - for p in ${(f)pages}; do - pp=`basename $p` - case ${pp[(ws:.:)2]} in - - html) - read_meta $p - # fill in entry into section page - cat <> ${spath}.html -

      $title

      -

      $description

      -EOF - # print "Title: $title" - # print "Description: $description" - # print "Keywords: $keywords" - render_html ${pp[(ws:.:)1]} - ;; - - link) - print -n "rendering $pp... " - read_meta $p - cat <> ${spath}.html -

      $title

      -

      $description

      -EOF - print "done." - ;; - *) - print "${p}: page type unknown" - ;; - - esac - - done # pages - - } - - { test -r ${spath}.html } || { - print "${sname} section not found in views" - return 1 } - - # render section's overview - render_html ${sname} - # at this point the section is an actual html file - -} - -render_navbar() { - active="$1" - - cat < - - -EOF -} - # Main -render_html index + + # render all HTML views htmls=(`find views -type f -name '*.html'`) for h in $htmls; do + read_meta ${h} render_html `basename ${h%.*}` done # render all markdown views mds=(`find views -type f -name '*.md'`) for m in $mds; do + read_meta ${m} render_markdown `basename ${m%.*}` done # render all image galleries gals=(`find views -type f -name '*.gal'`) for g in $gals; do + read_meta ${g} render_gallery `basename ${g%.*}` done diff --git a/tmpl/footer.html b/tmpl/footer.html index c14f605..7e24238 100644 --- a/tmpl/footer.html +++ b/tmpl/footer.html @@ -27,10 +27,3 @@ Center footer link to twitter or so..
      - - - - - - -