~npisanti/npisantidotcomssg

e9337371f62c1b63086e93fdaa41e75273e2abdb — Nicola Pisanti a month ago 88cdde9
finished porting to fish
16 files changed, 416 insertions(+), 1065 deletions(-)

M browse_local.sh
M build.sh
D build_fish.sh
D input/base/channelheader.html
D input/base/channels.html
D input/base/contact.html
D input/base/feedheader.html
D input/base/more.html
D input/base/moreheader.html
D input/base/postpagefooter.html
D input/base/sectionheader.html
D input/base/singlepageheader.html
R input/base/{tcatnoc.html => le/pages/tcatnoc.html}
M remove_target_blank.sh
M upload_data.sh
M upload_html.sh
M browse_local.sh => browse_local.sh +1 -1
@@ 1,3 1,3 @@
#!/bin/bash
#!/usr/bin/fish
x-www-browser /home/$USER/htdocs/npisantidotcomssg/html_output/index.html
exit

M build.sh => build.sh +369 -517
@@ 1,522 1,374 @@
#!/bin/bash

# --------------------------------------------------------------------
# ---------------- FUNCTIONS -----------------------------------------
# --------------------------------------------------------------------
build_navigation_footer(){
    # generate navigation pages 
    navfold="$1"
    numpage="$2"
    archive_enable="$3"

    #echo "generating navigation bars..."
    for ((i=1;i<=numpage;i++)); do
        navigation=""
        
        if [ ! -z "$archive_enable" ]; then 
            navigation="$navigation<a href=\"archive.html\">all</a> "        
        fi

        for ((k=1;k<=numpage;k++)); do
            if (("$k" == "$i")); then 
                navigation="$navigation<a href=\"page$k.html\">[$k]</a> "
            else
                navigation="$navigation<a href=\"page$k.html\">$k</a> "
            fi
        done

        navigation="$navigation\&nbsp;\&nbsp;"
        
        if [ "$i" -ne "1" ]; then 
            prev=$(( $i - 1 ))
            navigation="$navigation<a href=\"page$prev.html\">prev</a> "
        fi
        if [ "$i" -ne "$numpage" ]; then 
            next=$(( $i + 1 ))
            navigation="$navigation<a href=\"page$next.html\">next</a> "
        fi
        
        sed -i -e "s|NAVIGATION_PLACEHOLDER_TOKEN|$navigation|g" "$navfold/page$i.html"
    done
    #echo "...done"    
}

add_og_image(){
    
    filesource="$1"
    filedestination="$2"
    
    POST_OG_THUMB=`cat $filesource | grep og_thumb=`
    
    if [ ! -z "$POST_OG_THUMB" -a "$POST_OG_THUMB" != " " ]; then 
        OG_THUMBFILE=$(echo $POST_OG_THUMB | cut -d '=' -f2)
        echo "    <meta property=\"og:image\" content=\"http://npisanti.com/data/$OG_THUMBFILE\" />" >> "$filedestination"            
#!/usr/bin/fish

set SCRIPTFOLDER "$HOME/htdocs/npisantidotcomssg"
set OUTFOLDER "$SCRIPTFOLDER/html_output"
set MAXPOSTSPERPAGE 6
set CATEGORIES "ink" "installations" "music" "visuals"

#--------------------------------------------------------------------------------
set GENERAL_THUMB "avatars/avatar_og.png"

function og_image_path
    set filesource "$argv[1]"
   	set og_thumbfile "$GENERAL_THUMB"
   	
	if test -n $filesource
		set post_og_thumb ( cat $filesource | ag "og_thumb=" )
		if test -z $post_og_thumb
			set og_thumbfile (echo $post_og_thumb | cut -d '=' -f2)
		end
	end

	echo "<meta property=\"og:image\" content=\"http://npisanti.com/data/$og_thumbfile\" />"
end

function date_and_category 
	set -l post_path $argv[1]
    if test -z  $argv[2]; or test $argv[2] -eq "1"
        set pagelink "index"
    else
        echo "    <meta property=\"og:image\" content=\"http://npisanti.com/data/$GENERAL_THUMB\" />" >> "$filedestination"
    fi
}


# --------------------------------------------------------------------
# ---------------- SCRIPT --------------------------------------------
# --------------------------------------------------------------------

GENERAL_THUMB="avatars/avatar_og.png"
MASTERINDEX_THUMB="avatars/avatar_og.png"
HTMLDEST=/home/$USER/htdocs/npisantidotcomssg/html_output

THUMBSIZE=80
POSTPERPAGE=6
RSSMAXPOSTS=6

cd ~/htdocs/npisantidotcomssg
mkdir -p $HTMLDEST 
rm -rf $HTMLDEST/journal
rm -rf $HTMLDEST/main
rm -rf $HTMLDEST/posts

echo "cleaning folders..."
for d in input/journal/*/ ; do
    dirname=$(echo $d | cut -d '/' -f3)
    rm -rf "$HTMLDEST/$dirname"
done

rm $HTMLDEST/*

mkdir -p $HTMLDEST/main
mkdir -p $HTMLDEST/posts

for d in input/journal/*/ ; do
    dirname=$(echo $d | cut -d '/' -f3)
    mkdir -p "$HTMLDEST/$dirname"
done

cp input/base/style.css $HTMLDEST/style.css


# makes the pages page -----------------------------------------------
echo "<!DOCTYPE html>" >> $HTMLDEST/more.html
echo "<html>" >> $HTMLDEST/more.html
echo "<head>" >> $HTMLDEST/more.html
echo "<meta charset=\"utf-8\"/>" >> $HTMLDEST/more.html
echo "<title>npisanti.com</title>" >> $HTMLDEST/more.html
cat input/base/head.html >> $HTMLDEST/more.html
echo "<meta property=\"og:image\" content=\"http://npisanti.com/data/$GENERAL_THUMB\" />" >> $HTMLDEST/index.html
echo "<meta property=\"og:image:height\" content=\"230\" />" >> $HTMLDEST/more.html
echo "<meta property=\"og:image:width\" content=\"230\" />" >> $HTMLDEST/more.html
echo "</head>" >> $HTMLDEST/more.html
echo "<body>" >> $HTMLDEST/more.html
cat input/base/moreheader.html >> $HTMLDEST/more.html
cat input/base/more.html >> $HTMLDEST/more.html
echo "</body>" >> $HTMLDEST/more.html
echo "</html>" >> $HTMLDEST/more.html

# generate contact 
echo "processing contact file..."
echo "<!DOCTYPE html>" >> $HTMLDEST/contact.html
echo "<html>" >> $HTMLDEST/contact.html
echo "<head>" >> $HTMLDEST/contact.html
echo "<meta charset=\"utf-8\"/>" >> $HTMLDEST/contact.html
echo "<title>npisanti.com</title>" >> $HTMLDEST/contact.html
cat input/base/head.html >> $HTMLDEST/contact.html
echo "<meta property=\"og:image\" content=\"http://npisanti.com/data/$GENERAL_THUMB\" />" >> $HTMLDEST/contact.html
echo "</head>" >> $HTMLDEST/contact.html
echo "<body>" >> $HTMLDEST/contact.html
cat input/base/contact.html >> $HTMLDEST/contact.html
echo "</body></html>" >> $HTMLDEST/contact.html

# generate tcatnoc 
echo "processing tcatnoc file..."
echo "<!DOCTYPE html>" >> $HTMLDEST/tcatnoc.html
echo "<html>" >> $HTMLDEST/tcatnoc.html
echo "<head>" >> $HTMLDEST/tcatnoc.html
echo "<meta charset=\"utf-8\"/>" >> $HTMLDEST/tcatnoc.html
echo "<title>npisanti.com</title>" >> $HTMLDEST/tcatnoc.html
cat input/base/head.html >> $HTMLDEST/tcatnoc.html
# no og...
echo "</head>" >> $HTMLDEST/tcatnoc.html
echo "<body>" >> $HTMLDEST/tcatnoc.html
cat input/base/tcatnoc.html >> $HTMLDEST/tcatnoc.html
echo "</body></html>" >> $HTMLDEST/tcatnoc.html

echo "---- generating pages ----"
#generate pages

for f in input/pages/*.html; 
do
    filename=${f:12}
    title=${filename%".html"}

    #echo "processing $filename file..."
    echo "<!DOCTYPE html>" >> "$HTMLDEST/$filename"
    echo "<html>" >> "$HTMLDEST/$filename"
    
    echo "<head>" >> "$HTMLDEST/$filename"
    echo "<meta charset=\"utf-8\"/>" >> "$HTMLDEST/$filename"
    echo "<title>[ $title ]</title>" >> "$HTMLDEST/$filename"
    cat input/base/head.html >> "$HTMLDEST/$filename"
    
    add_og_image "input/pages/$filename" "$HTMLDEST/$filename"

    echo "</head>" >> "$HTMLDEST/$filename"
    
    echo "<body>" >> "$HTMLDEST/$filename"
    cat input/base/singlepageheader.html >> "$HTMLDEST/$filename"
    echo "<section>" >> "$HTMLDEST/$filename"
    cat input/pages/$filename >> "$HTMLDEST/$filename"
    echo "</section>" >> "$HTMLDEST/$filename"
    echo "</body></html>" >> "$HTMLDEST/$filename"
    
    sed -i -e "s|SITEROOTPATH/||g" "$HTMLDEST/$filename"
done

# --------------------------------------------------------------------
# ---------------- MAKES THE FEED ------------------------------------
# --------------------------------------------------------------------
echo "---- generating main feed ----"

post=0
page=0
monthcursor=13
yearcursor=1999
lastyear=2014
lastbuild="never"

#generate pages
inputlist=input/journal/feed.list
while read line
do
    if [ ! -z "$line" -a "$line" != " " ]; then 
    
        postpath="input/journal/$line"  
        filename=$(echo $line | cut -d '/' -f2)
        dirname=$(echo $line | cut -d '/' -f1)
        
        #filename=${f##*/}
        year=${filename:0:4}
        month=${filename:5:2}
        day=${filename:8:2}
        
        title=${filename:12}
        title=${title%".html"}
        title=${title//_/ }
        
        pagelink="posts/$filename"

        pagefolder="$HTMLDEST/main/"
        mkdir -p $pagefolder
        pagepath="$pagefolder/page$page.html"
        
        #generate corresponding page
        if (("$post" == 0)); then 
            page=$(( $page +1 ))
            echo "   - generating page $page"
            pagepath="$pagefolder/page$page.html"
            
            # generate head of page
            echo "<!DOCTYPE html>" >> "$pagepath"
            echo "<html>" >> "$pagepath"
            echo "<head>" >> "$pagepath"
            echo "<meta charset=\"utf-8\"/>" >> "$pagepath"
            echo "<title>npisanti.com</title>" >> "$pagepath"
            cat input/base/head.html >> "$pagepath"
            echo "<meta property=\"og:image\" content=\"http://npisanti.com/data/$GENERAL_THUMB\" />" >> "$pagepath"
            echo "</head>" >> "$pagepath"
            echo "<body>" >> "$pagepath"
            cat input/base/feedheader.html >> "$pagepath"
        fi 

        #echo "processing $postpath | post $post | page $page"
        
        # ------------ adds post to page ----------
        echo "<section>" >> "$pagepath"
        cat $postpath >> "$pagepath"

        echo "<br><br><div style=\"text-align:right\"><a href=\"../$pagelink\">$year/$month/$day</a> | posted in <a href=\"../$dirname/index.html\">$dirname</a></div>" >> "$pagepath"
        
        echo "</section>" >> "$pagepath"
        # -----------------------------------------

        post=$(( $post +1 ))
        if (("$post" == "$POSTPERPAGE")); then 
            post=0
            # generate tail of page 
            cat input/base/postpagefooter.html >> "$pagepath"
            echo "</body></html>" >> "$pagepath" 
        fi
    fi
done < "$inputlist"

# generate tail of page for last blog page
if (("$post" != 0)); then 
    cat input/base/postpagefooter.html >> "$pagepath"
    echo "</body></html>" >> "$pagepath" 
    sed -i -e "s|DATAPATH|$datapath|g" "$pagepath" 
fi

#echo "--- finished building main feed ---"

build_navigation_footer "$HTMLDEST/main" $page

#echo "copying and editing first page"
cp "$HTMLDEST/main/page1.html" "$HTMLDEST/main/index.html" 

echo "tweaking site index..."

cp "$HTMLDEST/main/page1.html" "$HTMLDEST/index.html" 
sed -i -e "s|href=\"../index.html\"|href=\"index.html\"|g" "$HTMLDEST/index.html" 
sed -i -e "s|../more|more|g" "$HTMLDEST/index.html" 
sed -i -e "s|../contact|contact|g" "$HTMLDEST/index.html" 
sed -i -e "s|../rss|rss|g" "$HTMLDEST/index.html" 
sed -i -e "s|href=\"page|href=\"main/page|g" "$HTMLDEST/index.html" 
sed -i -e "s|style=\"text-align:right\"><a href=\"../|style=\"text-align:right\"><a href=\"|g" "$HTMLDEST/index.html" 
sed -i -e "s|in <a href=\"|in <a href=\"main/|g" "$HTMLDEST/index.html" 

# -------------- generates individual journals ---------------

for d in input/journal/*/ ; do

    dirname=$(echo $d | cut -d '/' -f3)
    echo "---- generating $dirname's feed ----"

    post=0
    page=0
    monthcursor=13
    yearcursor=1999
    lastyear=2014
    lastbuild="never"
    
    for f in $(ls -1 "$d" | sort -r)
    do
        postpath="$f"  
        filename=${f##*/}
        year=${filename:0:4}
        month=${filename:5:2}
        day=${filename:8:2}
        
        title=${filename:12}
        title=${title%".html"}
        title=${title//_/ }    
        
        pagelink="posts/$filename"
        
        pagefolder="$HTMLDEST/$dirname/"
        mkdir -p $pagefolder
        pagepath="$pagefolder/page$page.html"
        
        #generate corresponding page
        if (("$post" == 0)); then 
            page=$(( $page +1 ))
            #echo "- generating page $page"
            pagepath="$pagefolder/page$page.html"
            
            # generate head of page
            echo "<!DOCTYPE html>" >> "$pagepath"
            echo "<html>" >> "$pagepath"
            echo "<head>" >> "$pagepath"
            echo "<meta charset=\"utf-8\"/>" >> "$pagepath"
            echo "<title>[ $dirname ]</title>" >> "$pagepath"
            cat input/base/head.html >> "$pagepath"
            echo "<meta property=\"og:image\" content=\"http://npisanti.com/data/$GENERAL_THUMB\" />" >> "$pagepath"
            echo "</head>" >> "$pagepath"
            echo "<body>" >> "$pagepath"
            cat input/base/channelheader.html >> "$pagepath"
        fi 

        #echo "processing $postpath | post $post | page $page"
        
        # ------------ adds post to page ----------
        echo "<section>" >> "$pagepath"
        cat "input/journal/$dirname/$postpath" >> "$pagepath"

        echo "<br><br><div style="text-align:right"><a href="../$pagelink">$year/$month/$day</a> | posted in <a href="../$dirname/index.html">$dirname</a></div>" >> "$pagepath"
        
        echo "</section>" >> "$pagepath"
        # -----------------------------------------

        post=$(( $post +1 ))
        if (("$post" == "$POSTPERPAGE")); then 
            post=0
            # generate tail of page 
            cat input/base/postpagefooter.html >> "$pagepath"
            echo "</body></html>" >> "$pagepath" 
        fi
    done 

    # generate tail of page for last blog page
    if (("$post" != 0)); then 
        cat input/base/postpagefooter.html >> "$pagepath"
        echo "</body></html>" >> "$pagepath" 
    fi

    build_navigation_footer "$HTMLDEST/$dirname" $page yes
        set pagelink "page$argv[2]"
	end
	
	set -l post_split (string split / $argv[1])
	# channel in [1], name in [2]
	set -l post_dir $post_split[1]
	set -l post_name $post_split[2]
	
	set -l date_str (string sub -s 1 -l 10 $post_name | string replace -a _ / )

	echo "<br><br><div style=\"text-align:right\"><a href=\"../posts/$post_name\">$date_str</a> | posted in <a href=\"../$post_dir/$pagelink.html\">$post_dir</a></div>"
end

function find_dir_page 
    # arg 1 is dir/postname.html 
	set -l post_split (string split / $argv[1])
	set post_dir $post_split[1]
	set post_name $post_split[2]
	set postnum "1" 
	set pagenum "1"
   
	for p in (ls -1 "$SCRIPTFOLDER/input/journal/$post_dir" | sort -r)
        if test "$p" = "$post_name"    
            set pagenum (math -s0 "(($postnum-1)/$MAXPOSTSPERPAGE)+1" )
        end
        set postnum (math "$postnum+1")
	end

	echo $pagenum
end

function open_page #-------------------------------------------------------------
	# arg 1 should be page path to get thumb
    # arg 2 should be the title
	set    text '<!DOCTYPE html>'
	set -a text '\n<html>'
	set -a text '\n<head>'
	set -a text '\n<meta charset="utf-8" />'

	if test -n $argv[2] 
	    set -a text "\n<title>[ $argv[2] ]</title>"
	else
    	set -a text "\n<title>[ npisanti.com]</title>"
	end 

    set -a text "\n"(cat input/base/head.html) 

	set -a text (og_image_path "$argv[1]") 
	
	set -a text '\n<meta property="og:image:height" content="230" />'
	set -a text '\n<meta property="og:image:width" content="230" />'

	set -a text "\n</head>"
	set -a text "\n<body>"

	echo $text
end

function close_page
	echo "</body></html>"
end

function navigation_header #-----------------------------------------------------
	# argument 1 is the tab to highlight
	set -l tabs "feed" "more" "contact" "webring"
	set text "<header>"

	for x in $tabs
		if test "$x" = "$argv[1]"
			set pretab "[ "
			set posttab " ]"
		else
			set pretab ""
			set posttab ""
		end
		
		switch $x 
		case feed main
			set -a text "$pretab<a href=\"../main/index.html\">feed</a>$posttab&nbsp;"
		case more
			set -a text "$pretab<a href=\"../pages/more.html\">more</a>$posttab&nbsp;"
		case contact 
			set -a text "$pretab<a href=\"../pages/contact.html\">contact</a>$posttab&nbsp;"
		case webring
			set -a text "$pretab<a href=\"https://webring.xxiivv.com/\">webring</a>$posttab&nbsp;"
		end
	end

	set -a text "</header>"
	echo $text
end 

function navigation_footer #-----------------------------------------------------
    set numpage "$argv[1]"
    set maxpage "$argv[2]"
    set archive_enable "$argv[3]"
	set footer "<footer>"

	if test -n "$archive_enable" 
		set -a footer "<a href=\"archive.html\">all</a>"        
	end

	if test "$numpage" -ne "1"
		set -l prev (math "$numpage-1")
		set -a footer "<a href=\"page$prev.html\">prev</a>"
	end

	for i in (seq $maxpage)
		if test "$i" -eq "$numpage"
			set -a footer "<a href=\"page$i.html\">[$i]</a>"
		else
			set -a footer "<a href=\"page$i.html\">$i</a>"
		end
	end
	
	if test "$numpage" -ne "$maxpage"
		set -l next (math "$numpage+1")
		set -a footer "<a href=\"page$next.html\">next</a>"
	end

	set -a footer "</footer>"

	echo $footer
end

function build_pages #-----------------------------------------------------------
	printf "building pages"
	mkdir -p "$OUTFOLDER/pages"
	
	for x in input/pages/*.html
		set name (basename $x .html)
		set outname (basename $x)

		set    text (open_page "$x" "$name")
		set -a text "\n"(navigation_header $name)
		set -a text "\n"(cat "$x")
		set -a text "\n"(close_page)
		set text (echo $text | sed -e "s|SITEROOTPATH|..|g") 		

		echo -e "$text" > "$OUTFOLDER/pages/$outname"
		printf "."
	end
	
	cp "$OUTFOLDER/pages/more.html" "$OUTFOLDER/pages/index.html" 

	printf "\n"
end

function build_feed #------------------------------------------------------------
    set channel_name "$argv[1]"
    printf "building $channel_name"
    set header_tag "$channel_name"
    set title "$channel_name"

    mkdir -p "$OUTFOLDER/$channel_name"
    
    cp "$HTMLDEST/$dirname/page1.html" "$HTMLDEST/$dirname/index.html" 
done


# -------------- generates archives ---------------
for d in input/journal/*/ ; do
    dirname=$(echo $d | cut -d '/' -f3)
    echo "---- generating $dirname's archive and posts ----"

    post=0
    page=1
    monthcursor=13
    yearcursor=1999
    lastyear=2014
    lastbuild="never"
    
    # archive head ----------
    echo "<!DOCTYPE html>" >> "$HTMLDEST/$dirname/archive.html"
    echo "<html>" >> "$HTMLDEST/$dirname/archive.html"
    echo "<head>" >> "$HTMLDEST/$dirname/archive.html"
    echo "<meta charset=\"utf-8\"/>" >> "$HTMLDEST/$dirname/archive.html"
    echo "<title>npisanti.com</title>" >> "$HTMLDEST/$dirname/archive.html"
    cat input/base/head.html >> "$HTMLDEST/$dirname/archive.html"
    echo "<meta property=\"og:image\" content=\"http://npisanti.com/data/$GENERAL_THUMB\" />" >> "$HTMLDEST/$dirname/archive.html"
    echo "</head>" >> "$HTMLDEST/$dirname/archive.html"
    echo "<body>" >> "$HTMLDEST/$dirname/archive.html"
    cat input/base/channelheader.html >> "$HTMLDEST/$dirname/archive.html"
    echo "<section><br>" >> "$HTMLDEST/$dirname/archive.html"
    
    echo "$dirname's archive<br><br>" >> "$HTMLDEST/$dirname/archive.html"
    
    # --------------------------

    for f in $(ls -1 "$d" | sort -r)
    do
        postpath="$f"  
        filename=${f##*/}
        year=${filename:0:4}
        month=${filename:5:2}
        day=${filename:8:2}
        
        title=${filename:12}
        title=${title%".html"}
        title=${title//_/ }    
        
        postlink="posts/$filename"
    if test "$channel_name" = "main"
        set list (cat input/journal/feed.list)
        set header_tag "feed"
        set title "npisanti.com"
    else
        set list "$argv[1]/"(ls -1 "$SCRIPTFOLDER/input/journal/$argv[1]" | sort -r)    
    end
 
	set posts_len (count $list)
	set max_pages (math "floor($posts_len / $MAXPOSTSPERPAGE)")

    # adds the last page if needed 
    if test (math -s0 "$posts_len % $MAXPOSTSPERPAGE") -ne "0"
        set max_pages (math "$max_pages+1")
    end
    
        pagefolder="$HTMLDEST/$dirname/"
        
        echo "$year/$month/$day  <a href="../$postlink">$title</a><br>" >> "$HTMLDEST/$dirname/archive.html" 

        # ----------- generate individual page ----------------------
        echo "<!DOCTYPE html>" >> "$HTMLDEST/$postlink"
        echo "<html>" >> "$HTMLDEST/$postlink"
        echo "<head>" >> "$HTMLDEST/$postlink"
        echo "<meta charset=\"utf-8\"/>" >> "$HTMLDEST/$postlink"
        echo "<title>[ $title ]</title>" >> "$HTMLDEST/$postlink"
        cat input/base/head.html >> "$HTMLDEST/$postlink"
        
        add_og_image "input/journal/$dirname/$postpath" "$HTMLDEST/$postlink"
        echo "</head>" >> "$HTMLDEST/$postlink"
        echo "<body>" >> "$HTMLDEST/$postlink"
        cat input/base/channelheader.html >> "$HTMLDEST/$postlink"
        echo "<section>" >> "$HTMLDEST/$postlink"
        cat input/journal/$dirname/$postpath >> "$HTMLDEST/$postlink"

		echo "<br><br><div style="text-align:right"><a href="../$pagelink">$year/$month/$day</a> | posted in <a href="../$dirname/page$page.html">$dirname</a></div>" >> "$HTMLDEST/$postlink"

        echo "</section>" >> "$HTMLDEST/$postlink"
        echo "</body></html>" >> "$HTMLDEST/$postlink" 
        
        post=$(( $post +1 ))
        if (("$post" == "$POSTPERPAGE")); then 
            post=0
            page=$(( $page +1 ))
        fi
    done 
	for i in ( seq "$max_pages" )
		set start (math "(($i-1)*$MAXPOSTSPERPAGE)+1" ) 
		set stop (math "(($i)*$MAXPOSTSPERPAGE)" ) 
		# often the last page has less posts
		if test "$stop" -gt "$posts_len" 
			set stop $posts_len
		end

		set    text (open_page "" "$title")
		set -a text "\n"(navigation_header "$header_tag" )

		for p in $list[$start..$stop]
			set -a text "\n<section>"
			set -a text "\n"(cat "input/journal/$p")
			if test "$channel_name" = "main"
                # this will search for the correct category page
			    set -l dirpage (find_dir_page "$p")
			    set -a text "\n"(date_and_category $p $dirpage )
			else
			    set -a text "\n"(date_and_category $p $i)
			end
			set -a text "\n</section>"
		end

		set -a text "\n"(navigation_footer $i $max_pages "active") 
		set -a text "\n"(close_page)
		set    text (echo $text | sed -e "s|SITEROOTPATH|..|g") 		

		echo -e "$text" > "$OUTFOLDER/$channel_name/page$i.html"
		printf "."
	end
	cp "$OUTFOLDER/$channel_name/page1.html" "$OUTFOLDER/$channel_name/index.html"
    printf "\n"
end

function build_posts #-----------------------------------------------------------
    printf "building posts"
    mkdir -p "$OUTFOLDER/posts"

    for dir in $CATEGORIES
        set postnum "1"
        set list (ls -1 "$SCRIPTFOLDER/input/journal/$dir" | sort -r)    

		for p in $list
		    if test -n $p
                set -l pagenum (math -s0 "(($postnum-1)/$MAXPOSTSPERPAGE)+1" )
                set -l title ( basename "$p" .html | string sub -s 13 | string replace -a _ " " )
        		set    text (open_page "" "$title")
        		set -a text "\n"(navigation_header "post" )
    			set -a text "\n<section>"
    			set -a text "\n"(cat "input/journal/$dir/$p" )
    			set -a text "\n"(date_and_category "$dir/$p" "$pagenum" )
    			set -a text "\n</section>"
                set -a text "\n"(close_page)
                set    text (echo $text | sed -e "s|SITEROOTPATH|..|g") 		
                echo -e "$text" > "$OUTFOLDER/posts/$p"

                set postnum (math "$postnum + 1")
                printf "."
            end
		end
    end
    
    # archive tail 
    echo "<br><br></section>" >> "$HTMLDEST/$dirname/archive.html"
    echo "</body></html>" >> "$HTMLDEST/$dirname/archive.html"
done

echo "---- building RSS ----"

cat input/base/rssbase.xml >> $HTMLDEST/rss.xml

inputlist=input/journal/rss.list
while read line
do
    if [ ! -z "$line" -a "$line" != " " ]; then 
    printf "\n"
end

function build_archives #--------------------------------------------------------
    printf "building archives"
    set last_year "1995"

    for dir in $CATEGORIES
        set list (ls -1 "$SCRIPTFOLDER/input/journal/$dir")    

		set    text (open_page "" "$dir archives")
		set -a text "\n"(navigation_header "$dir archives" )
        set -a text "\n<section>"

		for p in $list
			set -l post_date (string sub -s 1 -l 10 $p | string replace -a _ / )
			set -l post_year (string sub -s 1 -l 4 $p )
			if test "$last_year" != "$post_year"
                set last_year "$post_year"
                set -a text "\n<br/>"
			end

			set -l post_name ( basename "$p" .html | string sub -s 12 | string replace -a _ " " )
		    set -a text "\n$post_date <a href=\"../posts/$p\">$post_name</a><br/>"
		end

        set -a text "\n</section>"
        set -a text "\n"(close_page)
        set    text (echo $text | sed -e "s|SITEROOTPATH|..|g") 
        echo -e "$text" > "$OUTFOLDER/$dir/archive.html"
        printf "."
    end
    
        postpath="input/journal/$line"  
        filename=$(echo $line | cut -d '/' -f2)
        dirname=$(echo $line | cut -d '/' -f1)
        
        #filename=${f##*/}
        year=${filename:0:4}
        month=${filename:5:2}
        day=${filename:8:2}
        
        title=${filename:12}
        title=${title%".html"}
        title=${title//_/ }
        
        pagelink="posts/$filename"
        
        RFC822TIME=$(date --date=$month/$day/$year -R)

        echo -e "\t\t<item>" >> $HTMLDEST/rss.xml
        echo -e "\t\t\t<title>$title</title>" >> $HTMLDEST/rss.xml
        echo -e "\t\t\t<description><![CDATA[" >> $HTMLDEST/rss.xml
        cat $postpath >> $HTMLDEST/rss.xml
        echo -e "\t\t\t]]></description>" >> $HTMLDEST/rss.xml
        echo -e "\t\t\t<pubDate>$RFC822TIME</pubDate>" >> $HTMLDEST/rss.xml
        echo -e "\t\t\t<guid>http://npisanti.com/$pagelink</guid>" >> $HTMLDEST/rss.xml
        echo -e "\t\t</item>" >> $HTMLDEST/rss.xml

    fi
done < "$inputlist"

# rss tail 
echo -e "\t</channel>" >> $HTMLDEST/rss.xml
echo "</rss>" >> $HTMLDEST/rss.xml
sed -i -e "s|LASTYEARPLACEHOLDER|$lastyear|g" "$HTMLDEST/rss.xml"  
sed -i -e "s|LASTBUILDPLACEHOLDER|$lastbuild|g" "$HTMLDEST/rss.xml"  

echo "   - finished building RSS"

# --------------------------------------------------------------------
# ---------------- DATAPATHS -----------------------------------------
# --------------------------------------------------------------------

#sed -i -e "s|DATAPATH|$datapath|g" "$pagepath" 
for d in input/journal/*/ ; do
    dirname=$(echo $d | cut -d '/' -f3)
    for f in $(ls -1 "$HTMLDEST/$dirname" | sort -r)
    do
        #echo "operating on $HTMLDEST/$dirname/$f"
        sed -i -e "s|SITEROOTPATH|..|g" "$HTMLDEST/$dirname/$f" 
    done
done

for f in $(ls -1 "$HTMLDEST/main" | sort -r)
do
    sed -i -e "s|SITEROOTPATH|..|g" "$HTMLDEST/main/$f" 
done

for f in $(ls -1 "$HTMLDEST/posts" | sort -r)
do
    sed -i -e "s|SITEROOTPATH|..|g" "$HTMLDEST/posts/$f" 
done

sed -i -e "s|SITEROOTPATH/||g" "$HTMLDEST/index.html" 
sed -i -e "s|SITEROOTPATH/||g" "$HTMLDEST/more.html" 
sed -i -e "s|SITEROOTPATH/||g" "$HTMLDEST/contact.html" 
sed -i -e "s|SITEROOTPATH/||g" "$HTMLDEST/tcatnoc.html" 

# absolute urls to RSS 
sed -i -e "s|SITEROOTPATH|http://npisanti.com|g" "$HTMLDEST/rss.xml" 

# --------------------------------------------------------------------
# ---------------- RETROCOMPATIBILITY --------------------------------
# --------------------------------------------------------------------

mkdir -p $HTMLDEST/journal 
cp $HTMLDEST/rss.xml $HTMLDEST/journal/rss.xml 

exit
    printf "\n"
end

function build_rss #-------------------------------------------------------------
    printf "building RSS"
    set list (cat input/journal/rss.list)    
    set text "\n"(cat input/base/rssbase.xml)

    for p in $list
        if test -n $p
        	set -l post_split (string split / $p)
        	set post_dir $post_split[1]
        	set post_name $post_split[2]
            set -l year (string sub -s 1 -l 4 $post_name)
            set -l month (string sub -s 6 -l 2 $post_name)
            set -l day (string sub -s 9 -l 2 $post_name)
            set -l title ( basename "$post_name" .html | string sub -s 13 | string replace -a _ " " )
            set -l pagelink "posts/$post_name"
            set -l RFC822_time (date --date=$month/$day/$year -R)

            set -a text "\n\t\t<item>"
            set -a text "\n\t\t\t<title>$title</title>" 
            set -a text "\n\t\t\t<description><![CDATA["
            set -a text "\n\t\t\t"(cat "input/journal/$p")
            set -a text "\n\t\t\t]]></description>"
            set -a text "\n\t\t\t<pubDate>$RFC822_time</pubDate>"
            set -a text "\n\t\t\t<guid>http://npisanti.com/$pagelink</guid>"
            set -a text "\n\t\t</item>"

            printf "."
        end
    end

    set -a text "\t</channel>"
    set -a text "\t</rss>"    
    set text (echo $text | sed -e "s|SITEROOTPATH|http://npisanti.com|g") 
    echo -e "$text" > "$OUTFOLDER/rss.xml"
    printf "\n"
end

function build_index_redirect #--------------------------------------------------
	echo "creating index redirect..."
	set    text '<!DOCTYPE html>'
	set -a text '\n<html>\n<head>\n<meta charset="utf-8" />'
	set -a text "\n<title>[ npisanti.com]</title>"
    set -a text "\n"(cat input/base/head.html) 
	set -a text (og_image_path) 
	set -a text '\n<meta property="og:image:height" content="230" />'
	set -a text '\n<meta property="og:image:width" content="230" />'
	set -a text '\n<meta http-equiv="refresh" content="0;url=main/index.html" />'
	set -a text "\n</head>"
	set -a text "\n<body>"
	set -a text "\nredirecting to main/index.html"
	set -a text "\n</body>"
	set -a text "\n</html>"
	set text (echo $text | sed -e "s|SITEROOTPATH|.|g") 
	echo -e $text > "$OUTFOLDER/index.html"
end

#--------------------- EXECUTES ALL THE FUNCTIONS -------------------------------
cd $SCRIPTFOLDER

build_pages
build_feed "main"
for dir in $CATEGORIES; build_feed $dir; end
build_posts
build_archives
build_rss
build_index_redirect

cp "input/base/style.css" "$OUTFOLDER/style.css"

# retrocompatibiliy
mkdir -p "$OUTFOLDER/journal"
cp "$OUTFOLDER/rss.xml" "$OUTFOLDER/journal/rss.xml"

exit 
\ No newline at end of file

D build_fish.sh => build_fish.sh +0 -370
@@ 1,370 0,0 @@
#!/usr/bin/fish

set SCRIPTFOLDER "$HOME/htdocs/npisantidotcomssg"
set OUTFOLDER "$SCRIPTFOLDER/output2"
set MAXPOSTSPERPAGE 6
set CATEGORIES "ink" "installations" "music" "visuals"

#--------------------------------------------------------------------------------
set GENERAL_THUMB "avatars/avatar_og.png"

function og_image_path
    set filesource "$argv[1]"
   	set og_thumbfile "$GENERAL_THUMB"
   	
	if test -n $filesource
		set post_og_thumb ( cat $filesource | ag "og_thumb=" )
		if test -z $post_og_thumb
			set og_thumbfile (echo $post_og_thumb | cut -d '=' -f2)
		end
	end

	echo "<meta property=\"og:image\" content=\"http://npisanti.com/data/$og_thumbfile\" />"
end

function date_and_category 
	set -l post_path $argv[1]
    if test -z  $argv[2]; or test $argv[2] -eq "1"
        set pagelink "index"
    else
        set pagelink "page$argv[2]"
	end
	
	set -l post_split (string split / $argv[1])
	# channel in [1], name in [2]
	set -l post_dir $post_split[1]
	set -l post_name $post_split[2]
	
	set -l date_str (string sub -s 1 -l 10 $post_name | string replace -a _ / )

	echo "<br><br><div style=\"text-align:right\"><a href=\"../posts/$post_name\">$date_str</a> | posted in <a href=\"../$post_dir/$pagelink.html\">$post_dir</a></div>"
end

function find_dir_page 
    # arg 1 is dir/postname.html 
	set -l post_split (string split / $argv[1])
	set post_dir $post_split[1]
	set post_name $post_split[2]
	set postnum "1" 
	set pagenum "1"
   
	for p in (ls -1 "$SCRIPTFOLDER/input/journal/$post_dir" | sort -r)
        if test "$p" = "$post_name"    
            set pagenum (math -s0 "(($postnum-1)/$MAXPOSTSPERPAGE)+1" )
        end
        set postnum (math "$postnum+1")
	end

	echo $pagenum
end

function open_page #-------------------------------------------------------------
	# arg 1 should be page path to get thumb
    # arg 2 should be the title
	set    text '<!DOCTYPE html>'
	set -a text '\n<html>'
	set -a text '\n<head>'
	set -a text '\n<meta charset="utf-8" />'

	if test -n $argv[2] 
	    set -a text "\n<title>[ $argv[2] ]</title>"
	else
    	set -a text "\n<title>[ npisanti.com]</title>"
	end 

    set -a text "\n"(cat input/base/head.html) 

	set -a text (og_image_path "$argv[1]") 
	
	set -a text '\n<meta property="og:image:height" content="230" />'
	set -a text '\n<meta property="og:image:width" content="230" />'

	set -a text "\n</head>"
	set -a text "\n<body>"

	echo $text
end

function close_page
	echo "</body></html>"
end

function navigation_header #-----------------------------------------------------
	# argument 1 is the tab to highlight
	set -l tabs "feed" "more" "contact" "webring"
	set text "<header>"

	for x in $tabs
		if test "$x" = "$argv[1]"
			set pretab "[ "
			set posttab " ]"
		else
			set pretab ""
			set posttab ""
		end
		
		switch $x 
		case feed main
			set -a text "$pretab<a href=\"../main/index.html\">feed</a>$posttab&nbsp;"
		case more
			set -a text "$pretab<a href=\"../pages/more.html\">more</a>$posttab&nbsp;"
		case contact 
			set -a text "$pretab<a href=\"../pages/contact.html\">contact</a>$posttab&nbsp;"
		case webring
			set -a text "$pretab<a href=\"https://webring.xxiivv.com/\">webring</a>$posttab&nbsp;"
		end
	end

	set -a text "</header>"
	echo $text
end 

function navigation_footer #-----------------------------------------------------
    set numpage "$argv[1]"
    set maxpage "$argv[2]"
    set archive_enable "$argv[3]"
	set footer "<footer>"

	if test -n "$archive_enable" 
		set -a footer "<a href=\"archive.html\">all</a>"        
	end

	if test "$numpage" -ne "1"
		set -l prev (math "$numpage-1")
		set -a footer "<a href=\"page$prev.html\">prev</a>"
	end

	for i in (seq $maxpage)
		if test "$i" -eq "$numpage"
			set -a footer "<a href=\"page$i.html\">[$i]</a>"
		else
			set -a footer "<a href=\"page$i.html\">$i</a>"
		end
	end
	
	if test "$numpage" -ne "$maxpage"
		set -l next (math "$numpage+1")
		set -a footer "<a href=\"page$next.html\">next</a>"
	end

	set -a footer "</footer>"

	echo $footer
end

function build_pages #-----------------------------------------------------------
	printf "building pages"
	
	for x in input/pages/*.html
		set name (basename $x .html)
		set outname (basename $x)

		set    text (open_page "$x" "$name")
		set -a text "\n"(navigation_header $name)
		set -a text "\n"(cat "$x")
		set -a text "\n"(close_page)
		set text (echo $text | sed -e "s|SITEROOTPATH|..|g") 		

		echo -e "$text" > "$OUTFOLDER/pages/$outname"
		printf "."
	end
	
	cp "$OUTFOLDER/pages/more.html" "$OUTFOLDER/pages/index.html" 

	printf "\n"
end

function build_feed #------------------------------------------------------------
    set channel_name "$argv[1]"
    printf "building $channel_name"
    set header_tag "$channel_name"
    set title "$channel_name"

    mkdir -p "$OUTFOLDER/$channel_name"
    
    if test "$channel_name" = "main"
        set list (cat input/journal/feed.list)
        set header_tag "feed"
        set title "npisanti.com"
    else
        set list "$argv[1]/"(ls -1 "$SCRIPTFOLDER/input/journal/$argv[1]" | sort -r)    
    end
 
	set posts_len (count $list)
	set max_pages (math "floor($posts_len / $MAXPOSTSPERPAGE)")

    # adds the last page if needed 
    if test (math -s0 "$posts_len % $MAXPOSTSPERPAGE") -ne "0"
        set max_pages (math "$max_pages+1")
    end
    
	for i in ( seq "$max_pages" )
		set start (math "(($i-1)*$MAXPOSTSPERPAGE)+1" ) 
		set stop (math "(($i)*$MAXPOSTSPERPAGE)" ) 
		# often the last page has less posts
		if test "$stop" -gt "$posts_len" 
			set stop $posts_len
		end

		set    text (open_page "" "$title")
		set -a text "\n"(navigation_header "$header_tag" )

		for p in $list[$start..$stop]
			set -a text "\n<section>"
			set -a text "\n"(cat "input/journal/$p")
			if test "$channel_name" = "main"
                # this will search for the correct category page
			    set -l dirpage (find_dir_page "$p")
			    set -a text "\n"(date_and_category $p $dirpage )
			else
			    set -a text "\n"(date_and_category $p $i)
			end
			set -a text "\n</section>"
		end

		set -a text "\n"(navigation_footer $i $max_pages "active") 
		set -a text "\n"(close_page)
		set    text (echo $text | sed -e "s|SITEROOTPATH|..|g") 		

		echo -e "$text" > "$OUTFOLDER/$channel_name/page$i.html"
		printf "."
	end
	cp "$OUTFOLDER/$channel_name/page1.html" "$OUTFOLDER/$channel_name/index.html"
    printf "\n"
end

function build_posts #-----------------------------------------------------------
    printf "building posts"
    mkdir -p "$OUTFOLDER/posts"

    for dir in $CATEGORIES
        set postnum "1"
        set list (ls -1 "$SCRIPTFOLDER/input/journal/$dir" | sort -r)    

		for p in $list
		    if test -n $p
                set -l pagenum (math -s0 "(($postnum-1)/$MAXPOSTSPERPAGE)+1" )
                set -l title ( basename "$p" .html | string sub -s 13 | string replace -a _ " " )
        		set    text (open_page "" "$title")
        		set -a text "\n"(navigation_header "post" )
    			set -a text "\n<section>"
    			set -a text "\n"(cat "input/journal/$dir/$p" )
    			set -a text "\n"(date_and_category "$dir/$p" "$pagenum" )
    			set -a text "\n</section>"
                set -a text "\n"(close_page)
                set    text (echo $text | sed -e "s|SITEROOTPATH|..|g") 		
                echo -e "$text" > "$OUTFOLDER/posts/$p"

                set postnum (math "$postnum + 1")
                printf "."
            end
		end
    end
    
    printf "\n"
end

function build_archives #--------------------------------------------------------
    printf "building archives"
    set last_year "1995"

    for dir in $CATEGORIES
        set list (ls -1 "$SCRIPTFOLDER/input/journal/$dir")    

		set    text (open_page "" "$dir archives")
		set -a text "\n"(navigation_header "$dir archives" )
        set -a text "\n<section>"

		for p in $list
			set -l post_date (string sub -s 1 -l 10 $p | string replace -a _ / )
			set -l post_year (string sub -s 1 -l 4 $p )
			if test "$last_year" != "$post_year"
                set last_year "$post_year"
                set -a text "\n<br/>"
			end

			set -l post_name ( basename "$p" .html | string sub -s 12 | string replace -a _ " " )
		    set -a text "\n$post_date <a href=\"../posts/$p\">$post_name</a><br/>"
		end

        set -a text "\n</section>"
        set -a text "\n"(close_page)
        set    text (echo $text | sed -e "s|SITEROOTPATH|..|g") 
        echo -e "$text" > "$OUTFOLDER/$dir/archive.html"
        printf "."
    end
    
    printf "\n"
end

function build_rss #-------------------------------------------------------------
    printf "building RSS"
    set list (cat input/journal/rss.list)    
    set text "\n"(cat input/base/rssbase.xml)

    for p in $list
        if test -n $p
        	set -l post_split (string split / $p)
        	set post_dir $post_split[1]
        	set post_name $post_split[2]
            set -l year (string sub -s 1 -l 4 $post_name)
            set -l month (string sub -s 6 -l 2 $post_name)
            set -l day (string sub -s 9 -l 2 $post_name)
            set -l title ( basename "$post_name" .html | string sub -s 13 | string replace -a _ " " )
            set -l pagelink "posts/$post_name"
            set -l RFC822_time (date --date=$month/$day/$year -R)

            set -a text "\n\t\t<item>"
            set -a text "\n\t\t\t<title>$title</title>" 
            set -a text "\n\t\t\t<description><![CDATA["
            set -a text "\n\t\t\t"(cat "input/journal/$p")
            set -a text "\n\t\t\t]]></description>"
            set -a text "\n\t\t\t<pubDate>$RFC822_time</pubDate>"
            set -a text "\n\t\t\t<guid>http://npisanti.com/$pagelink</guid>"
            set -a text "\n\t\t</item>"

            printf "."
        end
    end

    set -a text "\t</channel>"
    set -a text "\t</rss>"    
    set text (echo $text | sed -e "s|SITEROOTPATH|http://npisanti.com|g") 
    echo -e "$text" > "$OUTFOLDER/rss.xml"
    printf "\n"
end

function build_index_redirect #--------------------------------------------------
	echo "creating index redirect..."
	set    text '<!DOCTYPE html>'
	set -a text '\n<html>\n<head>\n<meta charset="utf-8" />'
	set -a text "\n<title>[ npisanti.com]</title>"
    set -a text "\n"(cat input/base/head.html) 
	set -a text (og_image_path) 
	set -a text '\n<meta property="og:image:height" content="230" />'
	set -a text '\n<meta property="og:image:width" content="230" />'
	set -a text '\n<meta http-equiv="refresh" content="0;url=main/index.html" />'
	set -a text "\n</head>"
	set -a text "\n<body>"
	set -a text "\nredirecting to main/index.html"
	set -a text "\n</body>"
	set text (echo $text | sed -e "s|SITEROOTPATH|.|g") 
	echo -e $text > "$OUTFOLDER/index.html"
end

#--------------------- EXECUTES ALL THE FUNCTIONS -------------------------------
cd $SCRIPTFOLDER

build_pages
build_feed "main"
for dir in $CATEGORIES; build_feed $dir; end
build_posts
build_archives
build_rss
build_index_redirect

# retrocompatibiliy
mkdir -p "$OUTFOLDER/journal"
cp "$OUTFOLDER/rss.xml" "$OUTFOLDER/journal/rss.xml"

exit 
\ No newline at end of file

D input/base/channelheader.html => input/base/channelheader.html +0 -7
@@ 1,7 0,0 @@

<header>
     <a href="../index.html">feed</a>&nbsp;
     <a href="../more.html">more</a>&nbsp;
     <a href="../contact.html">contact</a>&nbsp;
     <a href="https://webring.xxiivv.com/">webring</a>&nbsp;
</header>

D input/base/channels.html => input/base/channels.html +0 -26
@@ 1,26 0,0 @@

<header>
     <a href="main/index.html">main</a>&nbsp;
     [ <a href="channels.html">channels</a> ]&nbsp;
     <a href="tools.html">tools</a>&nbsp;
     <a href="contact.html">contact</a>&nbsp;
     <a href="rss.xml">RSS</a>&nbsp;
     <a href="https://webring.xxiivv.com/">webring</a>&nbsp;
</header>

<section class="center fill">
    <p>
    Posts in the <a href="main/index.html">main</a> feed are divided into "channels". Most channels contains extra things in their individual feeds.
    </p>
    <br>
    
    <p><a href="practice/index.html">practice</a> : works in progress and not categorized stuff. Sometime a specific project emerges and becomes another channel.</p>
    
    <p><a href="artifacts/index.html">artifacts</a> : various kind of device i build, from musical oracles to other gizmos related to multiplanar exploration.</p>   
    
    <p><a href="ink/index.html">ink</a> contains a bigger amount of doodles than the main feed.</p>
    
    <p><a href="phantom-devices/index.html">phantom-devices</a> : some experimentations on digital musical instruments.</p>

    <br>
</section>

D input/base/contact.html => input/base/contact.html +0 -20
@@ 1,20 0,0 @@

<header>
     <a href="main/index.html">feed</a>&nbsp;
     <a href="more.html">more</a>&nbsp;
     [ <a href="tcatnoc.html">t&#847;cat&#817;&#797;&#803;n&#807;o&#1161;&#790;&#790;&#796;&#813;&#840;&#810;c&#799;</a> ]&nbsp;
     <a href="https://webring.xxiivv.com/">webring</a>&nbsp;
</header>

<section class="center fill">
    <a href="SITEROOTPATH/data/avatars/caffe.jpg"  style="border-bottom:none"><img src="SITEROOTPATH/data/avatars/lofi/caffe.jpg" width="100%"></a>
    <br><br><br>
    Hi planewalker, i'm Nicola. <br>
    What do you wish to know? <br>
    <br>
    <br>
    mail: nicola [at] npisanti [dot] com
    <br>
    fediverse : <a href="https://merveilles.town/@npisanti"  rel="noopener noreferrer">@npisanti@merveilles.town</a><br>
    twitter : <a href="https://twitter.com/npisanti"   rel="noopener noreferrer">@npisanti</a><br>
</section>

D input/base/feedheader.html => input/base/feedheader.html +0 -7
@@ 1,7 0,0 @@

<header>
     [ <a href="../index.html">feed</a> ]&nbsp;
     <a href="../more.html">more</a>&nbsp;
     <a href="../contact.html">contact</a>&nbsp;
     <a href="https://webring.xxiivv.com/">webring</a>&nbsp;
</header>

D input/base/more.html => input/base/more.html +0 -52
@@ 1,52 0,0 @@
<section>
    <p>
    The main section of this site is the blog <a href="main/index.html">feed</a>. At the moment, posts are also divided into "channels" containing more posts than the main feed:
    <ul>
    <li><a href="ink/index.html">ink</a> contains a lot more doodles</li>
    <li><a href="installations/index.html">installations</a> inhabitating spaces</li>
    <li><a href="music/index.html">music</a>: livecoded, generative, jams and experiments</li>
    <li><a href="visuals/index.html">visuals</a>: code-based graphics and interactions</li>
	</ul>
    </p>
    
    <p>This <a href="rss.xml">RSS</a> feed cointains the latest posts in chronological order.</p>
</section>

<section>
    <p><a href="np-samples.html">np-samples</a>: an archive of the audio samples i've recorded in the past, free to use</p>
</section>

<section>
	For me better tools aren't the ones doing more, but tools doing no more than what i need. As removing features and simplifying code is never in the corporate agendas, open source software is the only way to have tools that are <a href="https://en.wikipedia.org/wiki/Worse_is_better">simple</a>, reliable, <a href="https://tonsky.me/blog/disenchantment/">efficient</a> and long-standing.<br>
	<br>
    I code and mantain some of my own tools and code snippets:<br>
    <p><a href="https://git.sr.ht/~npisanti/folderkit">folderkit</a>: 32 voices sampler companion for <a href="https://100r.co/site/orca.html">ORCΛ</a>

    <p><a href="https://git.sr.ht/~npisanti/raylyeh">raylyeh</a>: hot-reloaded graphics scripting tool spawned by <a href="https://www.raylib.com/">raylib</a></p>

    <p><a href="https://git.sr.ht/~npisanti/rl_tools">rl_tools</a>: tools i scripted with raylyeh</p> 
    
    <p><a href="https://git.sr.ht/~npisanti/rpiezos">rpiezos</a>: hardware and software to convert piezo sensor signals into OSC messages by using a raspberry pi and some DIY electronics</p>

    <p><a href="https://git.sr.ht/~npisanti/gpiosc">gpiosc</a>: a program to control raspberry pi GPIO pins with incoming OSC messages</p>

    <p><a href="https://git.sr.ht/~npisanti/orca-snippets/tree">orca-snippets</a>: snippets of code i use in ORCΛ</p>

	<p><a href="https://git.sr.ht/~npisanti/scrapbook">scrapbook</a>: a collection of code snippets and sketches</p>
	    
    <p><a href="https://git.sr.ht/~npisanti/grimorio">grimorio</a>: scripts and dotfiles to setup my system starting from a debian netinst</p>
</section>

<section>
    <p><a href="hexaglyphics.html">Hexaglyphics</a> is a digital noise instrument based on an invented hexadecimal alphabeth</p>
</section>

<section>
    <p>
    &#60&#60 <a href="selfteaching.html">selfteaching</a> &#62&#62: resources for learning</p>
</section>
<section>
    <p>This website doesn't use javascript, doesn't use cookies, and it's put together by a <a href="https://git.sr.ht/~npisanti/npisantidotcomssg">bash script.</a></p>
    <p> It also works offline, you can copy it entirely and you will have a working snapshot on your machine without booting a server or having internet connection.
    </p>
</section>

D input/base/moreheader.html => input/base/moreheader.html +0 -6
@@ 1,6 0,0 @@
<header>
     <a href="main/index.html">feed</a>&nbsp;
     [ <a href="more.html">more</a> ]&nbsp;
     <a href="contact.html">contact</a>&nbsp;
     <a href="https://webring.xxiivv.com/">webring</a>&nbsp;
</header>

D input/base/postpagefooter.html => input/base/postpagefooter.html +0 -3
@@ 1,3 0,0 @@
<footer class="center">
    NAVIGATION_PLACEHOLDER_TOKEN
</footer>

D input/base/sectionheader.html => input/base/sectionheader.html +0 -3
@@ 1,3 0,0 @@
<header>
	<a href="http://npisanti.com">&#60&#45&#45back to index</a>
</header>

D input/base/singlepageheader.html => input/base/singlepageheader.html +0 -6
@@ 1,6 0,0 @@
<header>
     <a href="main/index.html">feed</a>&nbsp;
     <a href="more.html">more</a>&nbsp;
     <a href="contact.html">contact</a>&nbsp;
     <a href="https://webring.xxiivv.com/">webring</a>&nbsp;
</header>

R input/base/tcatnoc.html => input/disable/pages/tcatnoc.html +0 -0

M remove_target_blank.sh => remove_target_blank.sh +1 -1
@@ 1,4 1,4 @@
#!/bin/bash
#!/usr/bin/fish
find . -name "*.html" -print0 | xargs -0 sed -i -r 's/target="_blank"//' 
#find . -name "*.html" -print0 | xargs -0 sed -i -e "s| >|>|g"
exit

M upload_data.sh => upload_data.sh +19 -10
@@ 1,15 1,24 @@
#!/bin/bash
#!/usr/bin/fish

while true; do
    read -p "the ftp transfer used in this script is not encrypted, are you behind a trusted connection? [y/n] " yn
    case $yn in
        [Yy]* ) break;;
        [Nn]* ) echo "goodbye!"; exit;;
        * ) echo "Please answer yes or no.";;
    esac
done
echo 'the ftp transfer used in this script is not encrypted, are you behind a trusted connection?'
	
while true
    set yn (read -P [y/n]: ) 

read -p "Username: " ftpuser
	switch "$yn"
    case Y y yes
    	break
    case N n no
    	 echo "goodbye!" 
    	 exit
    case '*'
    	echo "Please answer yes or no."
    end
end

set ftpuser (read -P user: )

echo ""

ncftpput -R -z -v -u "$ftpuser" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/data/


M upload_html.sh => upload_html.sh +26 -36
@@ 1,48 1,38 @@
#!/bin/bash

while true; do
    read -p "the ftp transfer used in this script is not encrypted, are you behind a trusted connection? [y/n] " yn
    case $yn in
        [Yy]* ) break;;
        [Nn]* ) echo "goodbye!"; exit;;
        * ) echo "Please answer yes or no.";;
    esac
done

read -p "Username: " ftpuser
read -s -p "Password: " ftppass
#!/usr/bin/fish

echo 'the ftp transfer used in this script is not encrypted, are you behind a trusted connection?'
	
while true
    set yn (read -P [y/n]: ) 

	switch "$yn"
    case Y y yes
    	break
    case N n no
    	 echo "goodbye!" 
    	 exit
    case '*'
    	echo "Please answer yes or no."
    end
end

set ftpuser (read -P user: )
set ftppass (read -s -P password: )

echo ""

for d in input/journal/*/ ; do
    dirname=$(echo $d | cut -d '/' -f3)
    echo "uploading folder $dirname"
    ncftpput -R -v -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html "~/htdocs/npisantidotcomssg/html_output/$dirname/"
done
set FOLDERS "main" "ink" "installations" "music" "visuals" "posts" "pages"

echo "uploading main"
ncftpput -R -v -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html "~/htdocs/npisantidotcomssg/html_output/main/"
for f in $FOLDERS
	echo "uploading folder $f"
	ncftpput -R -v -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html "~/htdocs/npisantidotcomssg/html_output/$f/"
end

echo "uploading posts"
ncftpput -R -v -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html "~/htdocs/npisantidotcomssg/html_output/posts/"

echo "uploading basic pages..."
echo "uploading index and CSS..."
ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/index.html

ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/more.html

ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/contact.html

ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/tcatnoc.html

ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/style.css

echo "uploading pages"
for f in input/pages/* ; do
    page=$(echo $f | cut -d '/' -f3)
    ncftpput -R -v -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html "~/htdocs/npisantidotcomssg/html_output/$page"
done

echo "uploading RSS"
ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/rss.xml
ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html/journal ~/htdocs/npisantidotcomssg/html_output/journal/rss.xml