From 3e933c148630cc5dcd8c34cf54910c525daafb75 Mon Sep 17 00:00:00 2001 From: "R. S. Doiel" Date: Wed, 22 Nov 2017 10:25:26 -0800 Subject: [PATCH] prep for new release --- README.md | 1 + TODO.html | 133 +++++++++++++++++++++++++++++++++++++++ datatools.go | 2 +- docs/csv2json.html | 2 +- docs/csv2json.md | 2 +- docs/csv2mdtable.html | 2 +- docs/csv2mdtable.md | 2 +- docs/csv2xlsx.html | 2 +- docs/csv2xlsx.md | 2 +- docs/csvcols.html | 2 +- docs/csvcols.md | 2 +- docs/csvfind.html | 2 +- docs/csvfind.md | 2 +- docs/csvjoin.html | 2 +- docs/csvjoin.md | 2 +- docs/csvrows.html | 2 +- docs/csvrows.md | 2 +- docs/finddir.html | 2 +- docs/finddir.md | 2 +- docs/findfile.html | 2 +- docs/findfile.md | 2 +- docs/index.html | 1 + docs/index.md | 1 + docs/jsoncols.html | 2 +- docs/jsoncols.md | 2 +- docs/jsonjoin.html | 2 +- docs/jsonjoin.md | 2 +- docs/jsonmunge.html | 2 +- docs/jsonmunge.md | 2 +- docs/jsonrange.html | 2 +- docs/jsonrange.md | 2 +- docs/mergepath.html | 2 +- docs/mergepath.md | 2 +- docs/nav.html | 41 ------------ docs/range.html | 2 +- docs/range.md | 2 +- docs/reldate.html | 2 +- docs/reldate.md | 2 +- docs/splitstring.html | 92 +++++++++++++++++++++++++++ docs/splitstring.md | 63 +++++++++++++++++++ docs/timefmt.html | 2 +- docs/timefmt.md | 2 +- docs/urlparse.html | 2 +- docs/urlparse.md | 2 +- docs/vcard2json.html | 2 +- docs/vcard2json.md | 2 +- docs/xlsx2csv.html | 2 +- docs/xlsx2csv.md | 2 +- docs/xlsx2json.html | 2 +- docs/xlsx2json.md | 2 +- how-to/nav.html | 41 ------------ index.html | 3 + mk-website.bash | 141 +++++++++++++----------------------------- page.tmpl | 4 +- 54 files changed, 381 insertions(+), 226 deletions(-) create mode 100644 TODO.html delete mode 100644 docs/nav.html create mode 100644 docs/splitstring.html create mode 100644 docs/splitstring.md delete mode 100644 how-to/nav.html diff --git a/README.md b/README.md index 96d14fb..9bacfe4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ general purpose shell scripting. + [jsonjoin](docs/jsonjoin.html) - a tool for joining JSON object documents + [jsonmunge](docs/jsonmunge.html) - a tool to transform JSON documents into something else + [jsonrange](docs/jsonrange.html) - a tool for iterating for JSON maps and arrays ++ [splitstring](docs/splitstring.html) - splits a string using a delimiting string and returns a JSON array + [vcard2json](docs/vcard2json.html) - an experimental tool to convert vCards to JSON + [xlsx2csv](docs/xlsx2csv.html) - a tool for converting Excel Workbooks sheets to a CSV file(s) + [xlsx2json](docs/xlsx2json.html) - a tool for converting Excel Workbooks to JSON files diff --git a/TODO.html b/TODO.html new file mode 100644 index 0000000..0bbf937 --- /dev/null +++ b/TODO.html @@ -0,0 +1,133 @@ + + + + Caltech Library's Digital Library Development Sandbox + + + + +
+Caltech Library logo +
+ + +
+

Action Items

+ +

Bug

+ +

Next

+ + + +

Someday, Maybe

+ + + +

Completed

+ + + +
+ + + + diff --git a/datatools.go b/datatools.go index 959a801..262b961 100644 --- a/datatools.go +++ b/datatools.go @@ -35,7 +35,7 @@ import ( ) const ( - Version = `v0.0.16-dev` + Version = `v0.0.16` LicenseText = ` %s %s diff --git a/docs/csv2json.html b/docs/csv2json.html index c36a798..4f66d57 100644 --- a/docs/csv2json.html +++ b/docs/csv2json.html @@ -60,7 +60,7 @@

EXAMPLES

    csv2json -as-blobs -i data1.csv
 
-

csv2json v0.0.15

+

csv2json v0.0.16

diff --git a/docs/csv2json.md b/docs/csv2json.md index 30f4013..b403a09 100644 --- a/docs/csv2json.md +++ b/docs/csv2json.md @@ -41,4 +41,4 @@ Convert data1.csv to JSON blobs, one line per blob ``` -csv2json v0.0.15 +csv2json v0.0.16 diff --git a/docs/csv2mdtable.html b/docs/csv2mdtable.html index 1c389fb..a314572 100644 --- a/docs/csv2mdtable.html +++ b/docs/csv2mdtable.html @@ -57,7 +57,7 @@

EXAMPLES

    csv2mdtable -i data1.csv -o data1.md
 
-

csv2mdtable v0.0.15

+

csv2mdtable v0.0.16

diff --git a/docs/csv2mdtable.md b/docs/csv2mdtable.md index 27b1437..d83b53d 100644 --- a/docs/csv2mdtable.md +++ b/docs/csv2mdtable.md @@ -38,4 +38,4 @@ Convert data1.csv to data1.md using options. ``` -csv2mdtable v0.0.15 +csv2mdtable v0.0.16 diff --git a/docs/csv2xlsx.html b/docs/csv2xlsx.html index 9f4028f..61051eb 100644 --- a/docs/csv2xlsx.html +++ b/docs/csv2xlsx.html @@ -59,7 +59,7 @@

EXAMPLE

This does the same but the contents of data.csv are piped into the workbook’s sheet.

-

csv2xlsx v0.0.15

+

csv2xlsx v0.0.16

diff --git a/docs/csv2xlsx.md b/docs/csv2xlsx.md index 79f05ef..8927177 100644 --- a/docs/csv2xlsx.md +++ b/docs/csv2xlsx.md @@ -40,4 +40,4 @@ This does the same but the contents of data.csv are piped into the workbook's sheet. -csv2xlsx v0.0.15 +csv2xlsx v0.0.16 diff --git a/docs/csvcols.html b/docs/csvcols.html index 7c20eee..d2bb69e 100644 --- a/docs/csvcols.html +++ b/docs/csvcols.html @@ -76,7 +76,7 @@

EXAMPLES

    csvcols -i 10col.csv -col 1,4,6 > 3col.csv
 
-

csvcols v0.0.15

+

csvcols v0.0.16

diff --git a/docs/csvcols.md b/docs/csvcols.md index 042ab2d..df32f36 100644 --- a/docs/csvcols.md +++ b/docs/csvcols.md @@ -60,4 +60,4 @@ Filter a 10 columns CSV file for columns 1,4,6 from file named "10col.csv" ``` -csvcols v0.0.15 +csvcols v0.0.16 diff --git a/docs/csvfind.html b/docs/csvfind.html index 9bb3c85..e5551ba 100644 --- a/docs/csvfind.html +++ b/docs/csvfind.html @@ -82,7 +82,7 @@

EXAMPLES

    csvfind -i books.csv -col=2 -contains "Red Book"
 
-

csvfind v0.0.15

+

csvfind v0.0.16

diff --git a/docs/csvfind.md b/docs/csvfind.md index af41f0a..b04a47c 100644 --- a/docs/csvfind.md +++ b/docs/csvfind.md @@ -64,4 +64,4 @@ You can also search for phrases in columns. ``` -csvfind v0.0.15 +csvfind v0.0.16 diff --git a/docs/csvjoin.html b/docs/csvjoin.html index 9e36727..96f54a4 100644 --- a/docs/csvjoin.html +++ b/docs/csvjoin.html @@ -72,7 +72,7 @@

EXAMPLES

-output=merged-data.csv -

csvjoin v0.0.15

+

csvjoin v0.0.16

diff --git a/docs/csvjoin.md b/docs/csvjoin.md index d186329..9ae24e4 100644 --- a/docs/csvjoin.md +++ b/docs/csvjoin.md @@ -51,4 +51,4 @@ merged-data.csv.. -output=merged-data.csv ``` -csvjoin v0.0.15 +csvjoin v0.0.16 diff --git a/docs/csvrows.html b/docs/csvrows.html index 1a288b0..28015f5 100644 --- a/docs/csvrows.html +++ b/docs/csvrows.html @@ -77,7 +77,7 @@

EXAMPLES

    csvrows -i 10row.csv -row 1,4,6 > 3rows.csv
 
-

csvrows v0.0.15

+

csvrows v0.0.16

diff --git a/docs/csvrows.md b/docs/csvrows.md index 8bdd11f..9a3eaad 100644 --- a/docs/csvrows.md +++ b/docs/csvrows.md @@ -60,4 +60,4 @@ Filter a 10 row CSV file for rows 1,4,6 from file named "10row.csv" ``` -csvrows v0.0.15 +csvrows v0.0.16 diff --git a/docs/finddir.html b/docs/finddir.html index f076c9b..56b24eb 100644 --- a/docs/finddir.html +++ b/docs/finddir.html @@ -59,7 +59,7 @@

EXAMPLE

Find all subdirectories starting with “img”.

-

finddir v0.0.15

+

finddir v0.0.16

diff --git a/docs/finddir.md b/docs/finddir.md index 6674be1..2dcee77 100644 --- a/docs/finddir.md +++ b/docs/finddir.md @@ -39,4 +39,4 @@ finddir finds directory based on matching prefix, suffix or contained text in ba Find all subdirectories starting with "img". -finddir v0.0.15 +finddir v0.0.16 diff --git a/docs/findfile.html b/docs/findfile.html index b06c867..f7cd89b 100644 --- a/docs/findfile.html +++ b/docs/findfile.html @@ -59,7 +59,7 @@

EXAMPLE

Search the current directory and subdirectories for Markdown files with extension of “.md”.

-

findfile v0.0.15

+

findfile v0.0.16

diff --git a/docs/findfile.md b/docs/findfile.md index 8630047..63606e0 100644 --- a/docs/findfile.md +++ b/docs/findfile.md @@ -39,4 +39,4 @@ findfile finds files based on matching prefix, suffix or contained text in base Search the current directory and subdirectories for Markdown files with extension of ".md". -findfile v0.0.15 +findfile v0.0.16 diff --git a/docs/index.html b/docs/index.html index 667bc50..c8b620d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -39,6 +39,7 @@

datatools command help

  • mergepath
  • range
  • reldate
  • +
  • splitstring
  • timefmt
  • urlparse
  • vcard2json
  • diff --git a/docs/index.md b/docs/index.md index fd949ad..86b1714 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,6 +17,7 @@ + [mergepath](mergepath.html) + [range](range.html) + [reldate](reldate.html) ++ [splitstring](splitstring.html) + [timefmt](timefmt.html) + [urlparse](urlparse.html) + [vcard2json](vcard2json.html) diff --git a/docs/jsoncols.html b/docs/jsoncols.html index 1067c1c..a2bd8b6 100644 --- a/docs/jsoncols.html +++ b/docs/jsoncols.html @@ -109,7 +109,7 @@

    EXAMPLES

       "Doe, Jane",jane.doe@xample.org,42
     
    -

    jsoncols v0.0.15

    +

    jsoncols v0.0.16

    diff --git a/docs/jsoncols.md b/docs/jsoncols.md index 9b40650..20f8939 100644 --- a/docs/jsoncols.md +++ b/docs/jsoncols.md @@ -88,4 +88,4 @@ Would yield ``` -jsoncols v0.0.15 +jsoncols v0.0.16 diff --git a/docs/jsonjoin.html b/docs/jsonjoin.html index d50949c..65e4e3e 100644 --- a/docs/jsonjoin.html +++ b/docs/jsonjoin.html @@ -159,7 +159,7 @@

    EXAMPLES

    "bio": "World renowned geophysist." } -

    jsonjoin v0.0.15

    +

    jsonjoin v0.0.16

    diff --git a/docs/jsonjoin.md b/docs/jsonjoin.md index 2ba196c..0a953b3 100644 --- a/docs/jsonjoin.md +++ b/docs/jsonjoin.md @@ -149,4 +149,4 @@ would yield ``` -jsonjoin v0.0.15 +jsonjoin v0.0.16 diff --git a/docs/jsonmunge.html b/docs/jsonmunge.html index 0b274d1..16fa9c8 100644 --- a/docs/jsonmunge.html +++ b/docs/jsonmunge.html @@ -71,7 +71,7 @@

    EXAMPLES

        "Doe, Jane"
     
    -

    jsonmunge v0.0.15

    +

    jsonmunge v0.0.16

    diff --git a/docs/jsonmunge.md b/docs/jsonmunge.md index 984f9d9..81f6950 100644 --- a/docs/jsonmunge.md +++ b/docs/jsonmunge.md @@ -52,4 +52,4 @@ This would yeild ``` -jsonmunge v0.0.15 +jsonmunge v0.0.16 diff --git a/docs/jsonrange.html b/docs/jsonrange.html index 18ce904..f5e1a4c 100644 --- a/docs/jsonrange.html +++ b/docs/jsonrange.html @@ -160,7 +160,7 @@

    EXAMPLES

    2 -

    jsonrange v0.0.15

    +

    jsonrange v0.0.16

    diff --git a/docs/jsonrange.md b/docs/jsonrange.md index d06760b..972ec92 100644 --- a/docs/jsonrange.md +++ b/docs/jsonrange.md @@ -149,4 +149,4 @@ would yield 2 ``` -jsonrange v0.0.15 +jsonrange v0.0.16 diff --git a/docs/mergepath.html b/docs/mergepath.html index 4cad6ac..3b18da5 100644 --- a/docs/mergepath.html +++ b/docs/mergepath.html @@ -57,7 +57,7 @@

    EXAMPLE

    This would put your home bin directory at the beginning of your path.

    -

    mergepath v0.0.15

    +

    mergepath v0.0.16

    diff --git a/docs/mergepath.md b/docs/mergepath.md index 490d449..c8e8ded 100644 --- a/docs/mergepath.md +++ b/docs/mergepath.md @@ -37,4 +37,4 @@ path and removing the resulting duplicate. This would put your home bin directory at the beginning of your path. -mergepath v0.0.15 +mergepath v0.0.16 diff --git a/docs/nav.html b/docs/nav.html deleted file mode 100644 index a8255e4..0000000 --- a/docs/nav.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - Caltech Library's Digital Library Development Sandbox - - - - -
    -Caltech Library logo -
    - - -
    - - -
    - - - - diff --git a/docs/range.html b/docs/range.html index 802d311..8cd2e6e 100644 --- a/docs/range.html +++ b/docs/range.html @@ -79,7 +79,7 @@

    EXAMPLES

    Yields a random integer from 0 to 10

    -

    range v0.0.15

    +

    range v0.0.16

    diff --git a/docs/range.md b/docs/range.md index f816ae8..bc39a23 100644 --- a/docs/range.md +++ b/docs/range.md @@ -63,4 +63,4 @@ Yields 10 9 8 7 6 5 4 3 2 1 Yields a random integer from 0 to 10 -range v0.0.15 +range v0.0.16 diff --git a/docs/reldate.html b/docs/reldate.html index 804e3e9..692726a 100644 --- a/docs/reldate.html +++ b/docs/reldate.html @@ -123,7 +123,7 @@

    EXAMPLES

    insensitive and can be the first three letters of the English names or full English names (e.g. Monday, monday, Mon, mon).

    -

    reldate v0.0.15

    +

    reldate v0.0.16

    diff --git a/docs/reldate.md b/docs/reldate.md index 6d592ff..6ea8fd9 100644 --- a/docs/reldate.md +++ b/docs/reldate.md @@ -107,4 +107,4 @@ insensitive and can be the first three letters of the English names or full English names (e.g. Monday, monday, Mon, mon). -reldate v0.0.15 +reldate v0.0.16 diff --git a/docs/splitstring.html b/docs/splitstring.html new file mode 100644 index 0000000..a178d22 --- /dev/null +++ b/docs/splitstring.html @@ -0,0 +1,92 @@ + + + + Caltech Library's Digital Library Development Sandbox + + + + +
    +Caltech Library logo +
    + + +
    +

    USAGE

    + +

    splitstring [OPTIONS] [STRING_TO_SPLIT]

    + +

    splitstring splits a string based on a delimiting string provided. The default +delimiter is a space. You can specify a delimiting string via +the -d or –delimiter option. %!s(MISSING) will split the string provided +as a command line argument but can read split string(s) recieved on +stdin in with the -i or –input option. By default the split +strings are render as a JSON array but with the option -nl or +–newline you can render each split string one per line.

    + +

    OPTIONS

    + +
        -d	set the delimiting string value
    +	-delimiter	set the delimiting string value
    +	-example	display example(s)
    +	-h	display help
    +	-help	display help
    +	-i	input filename
    +	-input	input filename
    +	-l	display license
    +	-license	display license
    +	-newline	output as one substring per line rather than JSON
    +	-nl	output as one substring per line rather than JSON
    +	-o	output filename
    +	-output	output filename
    +	-v	display version
    +	-version	display version
    +
    + +

    EXAMPLES

    + +

    Splitting a string that is double pipe delimited rendering +one sub string per line.

    + +
        splitstring -nl -d '||' "one||two||three"
    +
    + +

    This should yield

    + +
        one
    +	two
    +	three
    +
    + +

    Splitting a string that is double pipe delimited rendering JSON

    + +
        splitstring -d '||' "one||two||three"
    +
    + +

    This should yield

    + +
       ["one","two","three"]
    +
    + +

    splitstring v0.0.16

    + +
    + + + + diff --git a/docs/splitstring.md b/docs/splitstring.md new file mode 100644 index 0000000..f4c21d8 --- /dev/null +++ b/docs/splitstring.md @@ -0,0 +1,63 @@ + +# USAGE + +## splitstring [OPTIONS] [STRING_TO_SPLIT] + +splitstring splits a string based on a delimiting string provided. The default +delimiter is a space. You can specify a delimiting string via +the -d or --delimiter option. %!s(MISSING) will split the string provided +as a command line argument but can read split string(s) recieved on +stdin in with the -i or --input option. By default the split +strings are render as a JSON array but with the option -nl or +--newline you can render each split string one per line. + +## OPTIONS + +``` + -d set the delimiting string value + -delimiter set the delimiting string value + -example display example(s) + -h display help + -help display help + -i input filename + -input input filename + -l display license + -license display license + -newline output as one substring per line rather than JSON + -nl output as one substring per line rather than JSON + -o output filename + -output output filename + -v display version + -version display version +``` + +## EXAMPLES + +Splitting a string that is double pipe delimited rendering +one sub string per line. + +```shell + splitstring -nl -d '||' "one||two||three" +``` + +This should yield + +``` + one + two + three +``` + +Splitting a string that is double pipe delimited rendering JSON + +```shell + splitstring -d '||' "one||two||three" +``` + +This should yield + +```json + ["one","two","three"] +``` + +splitstring v0.0.16 diff --git a/docs/timefmt.html b/docs/timefmt.html index a6cce4b..671f416 100644 --- a/docs/timefmt.html +++ b/docs/timefmt.html @@ -64,7 +64,7 @@

    EXAMPLES

    Yields “02 Jul 16 08:08 UTC”

    -

    timefmt v0.0.15

    +

    timefmt v0.0.16

    diff --git a/docs/timefmt.md b/docs/timefmt.md index d1d586b..4d99d08 100644 --- a/docs/timefmt.md +++ b/docs/timefmt.md @@ -43,4 +43,4 @@ Yields "07/02/2016" Yields "02 Jul 16 08:08 UTC" -timefmt v0.0.15 +timefmt v0.0.16 diff --git a/docs/urlparse.html b/docs/urlparse.html index 8d561d0..99479ae 100644 --- a/docs/urlparse.html +++ b/docs/urlparse.html @@ -88,7 +88,7 @@

    EXAMPLE

    Without options urlparse returns protocol, host and path fields separated by a tab.

    -

    urlparse v0.0.15

    +

    urlparse v0.0.16

    diff --git a/docs/urlparse.md b/docs/urlparse.md index 8b482be..6d7e787 100644 --- a/docs/urlparse.md +++ b/docs/urlparse.md @@ -73,4 +73,4 @@ Without options urlparse returns protocol, host and path fields separated by a tab. -urlparse v0.0.15 +urlparse v0.0.16 diff --git a/docs/vcard2json.html b/docs/vcard2json.html index 05edfbb..f8bc5bf 100644 --- a/docs/vcard2json.html +++ b/docs/vcard2json.html @@ -55,7 +55,7 @@

    EXAMPLES

        vcard2json -i mv.cvf -o myVCard.json
     
    -

    vcard2json v0.0.15

    +

    vcard2json v0.0.16

    diff --git a/docs/vcard2json.md b/docs/vcard2json.md index ceddc94..299e970 100644 --- a/docs/vcard2json.md +++ b/docs/vcard2json.md @@ -36,4 +36,4 @@ Or reading, writing to specific file ``` -vcard2json v0.0.15 +vcard2json v0.0.16 diff --git a/docs/xlsx2csv.html b/docs/xlsx2csv.html index 0000a82..4d611af 100644 --- a/docs/xlsx2csv.html +++ b/docs/xlsx2csv.html @@ -66,7 +66,7 @@

    EXAMPLE

    done -

    xlsx2csv v0.0.15

    +

    xlsx2csv v0.0.16

    diff --git a/docs/xlsx2csv.md b/docs/xlsx2csv.md index 261a591..6cf141e 100644 --- a/docs/xlsx2csv.md +++ b/docs/xlsx2csv.md @@ -49,4 +49,4 @@ Putting it all together in a shell script. ``` -xlsx2csv v0.0.15 +xlsx2csv v0.0.16 diff --git a/docs/xlsx2json.html b/docs/xlsx2json.html index e39fe9e..17c3dd1 100644 --- a/docs/xlsx2json.html +++ b/docs/xlsx2json.html @@ -67,7 +67,7 @@

    EXAMPLE

    done -

    xlsx2json v0.0.15

    +

    xlsx2json v0.0.16

    diff --git a/docs/xlsx2json.md b/docs/xlsx2json.md index b8fdffd..3731ddf 100644 --- a/docs/xlsx2json.md +++ b/docs/xlsx2json.md @@ -50,4 +50,4 @@ Putting it all together in a shell script. ``` -xlsx2json v0.0.15 +xlsx2json v0.0.16 diff --git a/how-to/nav.html b/how-to/nav.html deleted file mode 100644 index 3f14ff9..0000000 --- a/how-to/nav.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - Caltech Library's Digital Library Development Sandbox - - - - -
    -Caltech Library logo -
    - - -
    - - -
    - - - - diff --git a/index.html b/index.html index f5b99a0..b951aef 100644 --- a/index.html +++ b/index.html @@ -25,6 +25,8 @@

    datatools

    +

    For data

    +

    Command line utilities for simplifying work with CSV, JSON, Excel Workbooks and plain text files or content and general purpose shell scripting.

    @@ -40,6 +42,7 @@

    datatools

  • jsonjoin - a tool for joining JSON object documents
  • jsonmunge - a tool to transform JSON documents into something else
  • jsonrange - a tool for iterating for JSON maps and arrays
  • +
  • splitstring - splits a string using a delimiting string and returns a JSON array
  • vcard2json - an experimental tool to convert vCards to JSON
  • xlsx2csv - a tool for converting Excel Workbooks sheets to a CSV file(s)
  • xlsx2json - a tool for converting Excel Workbooks to JSON files
  • diff --git a/mk-website.bash b/mk-website.bash index 3e1ade5..c384f17 100755 --- a/mk-website.bash +++ b/mk-website.bash @@ -1,109 +1,52 @@ #!/bin/bash -PROJECT="datatools" - -function checkApp() { - APP_NAME=$(which "$1") - if [ "$APP_NAME" = "" ] && [ ! -f "./bin/$1" ]; then - echo "Missing $APP_NAME" - exit 1 - fi -} - -function softwareCheck() { - for APP_NAME in "$@"; do - checkApp "$APP_NAME" - done +function cleanUpHTML() { + findfile -s ".html" . | while read P; do + rm "$P" + done } -function MakePage() { - nav="$1" - content="$2" - html="$3" - # Always use the latest compiled mkpage - APP=$(which mkpage) - - echo "Rendering $html" - $APP \ - "Nav=$nav" \ - "Content=$content" \ - page.tmpl >"$html" - git add "$html" +function FindNavMD() { + DNAME="$1" + if [ -f "${DNAME}/nav.md" ]; then + echo "${DNAME}/nav.md" + return + fi + DNAME=$(dirname "${DNAME}") + FindNavMD "${DNAME}" } -echo "Checking necessary software is installed" -softwareCheck mkpage - -echo "Generating website index.html" -MakePage nav.md README.md index.html -echo "Generating install.html" -MakePage nav.md INSTALL.md install.html -echo "Generating license.html" -MakePage nav.md "markdown:$(cat LICENSE)" license.html - -# Generate docs/nav.md -cat <docs/nav.md - -+ [Home](/) -+ [up](../) -EOF1 -INDEX_MENU=$(cat docs/nav.md) - -echo "+ [Documentation](./)" >> docs/nav.md -echo "+ [How To ...](../how-to/)" >> docs/nav.md -git add docs/nav.md - -# Generate docs/index.md -cat <docs/index.md - -# $PROJECT command help - -EOF2 - -# Generate the index for command docuumentation pages -for FNAME in csv2json csv2mdtable csv2xlsx csvcols csvfind csvjoin csvrows finddir findfile jsoncols jsonjoin jsonmunge jsonrange mergepath range reldate timefmt urlparse vcard2json xlsx2csv xlsx2json; do - echo "+ [$FNAME](${FNAME}.html)" -done >>docs/index.md -git add docs/index.md - -# Generate the individual command docuumentation pages -for FNAME in csv2json csv2mdtable csv2xlsx csvcols csvfind csvjoin csvrows finddir findfile jsoncols jsonjoin jsonmunge jsonrange mergepath range reldate timefmt urlparse vcard2json xlsx2csv xlsx2json; do - echo "Generating docs/$FNAME.html" - MakePage docs/nav.md "docs/$FNAME.md" "docs/$FNAME.html" -done - -MakePage "docs/nav.md" "docs/index.md" "docs/index.html" - - -# Generate nav for How To section -echo "$INDEX_MENU" > how-to/nav.md -echo "+ [Documentation](../docs/)" >> how-to/nav.md -echo "+ [How To ...](./)" >> how-to/nav.md -git add how-to/nav.md - -# Generate index page for How To section -cat <how-to/index.md - -# How To ... - -EOF3 - -find ./how-to -type f | grep -E "\.md$" | while read FNAME; do - TITLE="$(titleline -i "$FNAME")" - FNAME="$(basename "$FNAME" ".md")" - if [ "$FNAME" != "nav" ] && [ "$FNAME" != "index" ]; then - echo "+ [${TITLE}](${FNAME}.html)" +# Cleanup stale HTML files +cleanUpHTML + +# Look through files and build new site +mkpage "nav=nav.md" "content=markdown:$(cat LICENSE)" page.tmpl > license.html +findfile -s ".md" . | while read P; do + DNAME=$(dirname "$P") + FNAME=$(basename "$P") + case "$FNAME" in + "INSTALL.md") + HTML_NAME="${DNAME}/install.html" + ;; + "README.md") + if [ ! -f "${DNAME}/index.md" ]; then + HTML_NAME="${DNAME}/index.html" + else + HTML_NAME="${DNAME}/README.html" + fi + ;; + *) + HTML_NAME=$(echo "$P" | sed -E 's/.md$/.html/g') + ;; + esac + if [ "${DNAME:0:4}" != "dist" ] && [ "${FNAME}" != "nav.md" ]; then + NAV=$(FindNavMD "$DNAME") + echo "Building $HTML_NAME from $DNAME/$FNAME and $NAV" + mkpage "nav=$NAV" "content=${DNAME}/${FNAME}" page.tmpl >"${HTML_NAME}" + git add "${HTML_NAME}" + else + echo "Skipping $P" fi -done >>how-to/index.md -git add how-to/index.md - -MakePage "markdown:${INDEX_MENU}" "how-to/index.md" "how-to/index.html" -git add how-to/index.html - -# Generate the individual How To documents -find ./how-to -type f | grep -E "\.md$" | while read FNAME; do - FNAME="$(basename "$FNAME" ".md")" - MakePage "how-to/nav.md" "how-to/${FNAME}.md" "how-to/${FNAME}.html" done diff --git a/page.tmpl b/page.tmpl index e73cdce..a658b9f 100644 --- a/page.tmpl +++ b/page.tmpl @@ -10,11 +10,11 @@ Caltech Library logo
    -{{ .Content }} +{{ .content }}