minor compatibility with writedown

This commit is contained in:
Jaromil 2017-03-31 16:37:01 +02:00
parent d4812547da
commit c525d3ffac
1 changed files with 62 additions and 14 deletions

76
init
View File

@ -36,7 +36,19 @@ mkdir -p views/js
mkdir -p views/css
touch views/css/custom.css
{ test -r views/index.html } || {
[[ -r config.zsh ]] && source config.zsh
[[ -r views/abstract.txt ]] && [[ ! -r index.html ]] &&
[[ "$WRITEDOWN_TITLE" != "" ]] && {
cat <<EOF > views/index.html
<h1>$WRITEDOWN_TITLE</h1>
<p>
`cat views/abstract.txt | sed 's/^$/<\/p><p>/'`
</p>
EOF
}
[[ -r views/index.html ]] || {
cat <<EOF > views/index.html
<h1>Hello world</h1>
@ -56,25 +68,62 @@ EOF
}
mkdir -p tmpl
{ test -r tmpl/header.html } || {
cp -v ${SYS}/tmpl/header.html tmpl/ }
[[ -r tmpl/header.html ]] || {
cat <<EOF > tmpl/header.html
<!-- You are inside your <head> here -->
<link rel="shortcut icon" href="/favicon.ico" />
<!-- pad down for the header -->
<style type="text/css">
body { padding-top: 3em;
padding-bottom: .5em; }
.brand { padding: 1em 1em 1em 1em; }
.sidebar-nav { padding: 40px; }
</style>
EOF
}
{ test -r tmpl/footer.html } || {
cp -v ${SYS}/tmpl/footer.html tmpl/ }
[[ -r tmpl/footer.html ]] ||
cp -v ${SYS}/tmpl/footer.html tmpl/
{ test -r tmpl/navbar.html } || {
cp -v ${SYS}/tmpl/navbar.html tmpl/ }
[[ -r tmpl/navbar.html ]] || {
cat <<EOF > tmpl/navbar.html
<!-- navigation bar automatically generated by webnomad -->
<nav>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<a href="index">
<div class="brand">
<!-- customise your brand icon from css -->
<i class="icon-home"></i> &nbsp;&nbsp;&nbsp
</div>
</a>
<ul class="nav">
<li class="divider-vertical"></li>
<!-- customise below with a list of pages -->
</ul>
</div>
</div>
</nav>
EOF
}
{ test -r config.zsh } || {
cat <<EOF > config.zsh
# TODO: make a list of main files in the navbar
# or perhaps implement a sidebar
grep '^# WEBNOMAD CONFIGURATION' config.zsh >/dev/null || {
cat <<EOF >> config.zsh
# WEBNOMAD CONFIGURATION
TITLE="A new website made with WebNomad."
DESCRIPTION="WebNomad, your slick and static website publisher, powered by HTML5, Zsh and Bootstrap"
KEYWORDS="web, design, html"
# representative image, 1200x630 pixels is full column banner, 400 is half
# representative image, 1200x627 pixels is full column banner, 400 is half
# exact size indicated above is important to avoid resizes server-side
IMAGE="https://www.dyne.org/wp-content/uploads/2013/09/carciofo-webnomad.jpg"
# list of types: http://ogp.me/#types
@ -93,8 +142,8 @@ TWITTER="@DyneOrg"
# Anything below is safe to leave untouched
#
# Uncomment to disable Bootstrap
# BOOTSTRAP=0
# Comment to disable Bootstrap
BOOTSTRAP=1
# What file extension to use for html files
EXTENSION=".html"
@ -122,9 +171,8 @@ EOF
}
act
notice "Initialization completed"
act "Look in your new WebNomad project: $B $DIR $r"
act "Customize $B config.zsh $r and then files in the $B tmpl/ $r folder"
act "Create new HTML pages in $B views/ $r"