diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index cb5d5b3..9d5ecbc 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -2,22 +2,25 @@ name: Test
on:
push:
- branches: [main]
+ branches:
pull_request:
branches: [main]
+
jobs:
build:
strategy:
matrix:
- go-version: '1.20'
- os: [ubuntu-latest, windows-latest]
+ go-version: [1.20.x]
+ os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- - name: Checkout code
- uses: actions/checkout@v3
- - name: Test
+
+ - name: Check Out Code
+ uses: actions/checkout@v4
+
+ - name: Test Library API For Regressions
run: go test -race -v .
diff --git a/README.md b/README.md
index 4b8f402..d7eff71 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,23 @@
+
+
# GoAT: Go ASCII Tool
-
-![](https://github.com/github/docs/actions/workflows/test.yml/badge.svg)
+
+
## What **GoAT** Can Do For You
@@ -71,7 +87,7 @@ GoAT's [README.md](README.md), then finally rendered to HTML `````` element
```
-![](./examples/trees.svg)
+![](//examples/trees.svg)
### Trees -- mid-range color value
Setting a foreground color in the middle of the possible range of value or luminance
@@ -83,7 +99,7 @@ CSS property by
from within an enclosing `` element such as are generated by Markdown.
-![](./trees.mid-blue.svg)
+![](//trees.mid-blue.svg)
### Overlaps
```
@@ -97,7 +113,7 @@ from within an enclosing `` element such as are generated by Markdown.
'-' '-' '-' '-' '-' '-'
```
-![](./examples/overlaps.svg)
+![](//examples/overlaps.svg)
### Line Decorations
```
@@ -110,7 +126,7 @@ from within an enclosing `` element such as are generated by Markdown.
/\ *---------------'
```
-![](./examples/line-decorations.svg)
+![](//examples/line-decorations.svg)
### Line Ends
```
@@ -127,7 +143,7 @@ from within an enclosing `` element such as are generated by Markdown.
```
-![](./examples/line-ends.svg)
+![](//examples/line-ends.svg)
### Dot Grids
```
@@ -141,7 +157,7 @@ from within an enclosing `` element such as are generated by Markdown.
```
Note that '·' above is not ASCII, but rather Unicode, the MIDDLE DOT character, encoded with UTF-8.
-![](./examples/dot-grids.svg)
+![](//examples/dot-grids.svg)
### Large Nodes
```
@@ -156,7 +172,7 @@ Note that '·' above is not ASCII, but rather Unicode, the MIDDLE DOT character,
'-' '---' '-' '---' '-' '-' '---'
```
-![](./examples/large-nodes.svg)
+![](//examples/large-nodes.svg)
### Small Grids
```
@@ -170,7 +186,7 @@ Note that '·' above is not ASCII, but rather Unicode, the MIDDLE DOT character,
```
-![](./examples/small-grids.svg)
+![](//examples/small-grids.svg)
### Big Grids
```
@@ -188,7 +204,7 @@ Note that '·' above is not ASCII, but rather Unicode, the MIDDLE DOT character,
```
-![](./examples/big-grids.svg)
+![](//examples/big-grids.svg)
### Complicated
```
@@ -218,7 +234,7 @@ Note that '·' above is not ASCII, but rather Unicode, the MIDDLE DOT character,
'-' '---------+--' / Nor/is this. ---
```
-![](./examples/complicated.svg)
+![](//examples/complicated.svg)
### More examples are [here](examples)
@@ -236,7 +252,7 @@ A nicely formatted reference may be found at [pkg.go.dev](https://pkg.go.dev/git
$ go get -u github.com/blampe/goat/
```
### Library Data Flow
-![](./goat.svg)
+![](//goat.svg)
The diagram above was derived by [./make.sh](./make.sh) from ASCII-art in the Go
source file [./goat.go](./goat.go).
diff --git a/README.md.tmpl b/README.md.tmpl
index 8c44774..b384da4 100644
--- a/README.md.tmpl
+++ b/README.md.tmpl
@@ -1,7 +1,23 @@
+
+
# GoAT: Go ASCII Tool
-
-![](https://github.com/github/docs/actions/workflows/test.yml/badge.svg)
+
+
## What **GoAT** Can Do For You
@@ -42,7 +58,7 @@ with rows above and below.
## Installation
```
- $ go install github.com/{{.GithubUser}}/goat/cmd/goat@latest
+ $ go install github.com/{{.Github_Repository_Owner}}/goat/cmd/goat@latest
```
@@ -133,12 +149,12 @@ The core engine of ```goat``` is accessible as a Go library package, for inclusi
code of your own.
The code implements a subset, and some extensions, of the ASCII diagram generation function of the browser-side Javascript in [Markdeep](http://casual-effects.com/markdeep/).
-A nicely formatted reference may be found at [pkg.go.dev](https://pkg.go.dev/github.com/{{.GithubUser}}/goat).
+A nicely formatted reference may be found at [pkg.go.dev](https://pkg.go.dev/github.com/{{.Github_Repository_Owner}}/goat).
### Installation
```
- $ go get -u github.com/{{.GithubUser}}/goat/
+ $ go get -u github.com/{{.Github_Repository_Owner}}/goat/
```
### Library Data Flow
![]({{.Root}}/goat.svg)
@@ -150,13 +166,13 @@ source file [./goat.go](./goat.go).
### Project Tenets
diff --git a/local-markdown.sh b/local-markdown.sh
new file mode 100755
index 0000000..f12375f
--- /dev/null
+++ b/local-markdown.sh
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+# Render to HTML, for local inspection.
+./markdown_to_html.sh README.md >README.html
+./markdown_to_html.sh CHANGELOG.md >CHANGELOG.html
diff --git a/make.sh b/pre-push.sh
similarity index 53%
rename from make.sh
rename to pre-push.sh
index 3117777..d865ec3 100755
--- a/make.sh
+++ b/pre-push.sh
@@ -3,46 +3,47 @@
# Run all tests, and all pre-compilation build steps.
# Certain output files should be committed to the SCM archive.
#
-# Recall that an end-user eventually installing with 'go get ...'
-# will trigger a compilation from source within the local environment.
-# XX Give this file a more descriptive name.
+# Recall that an end-user eventually installing with 'go get ...' will
+# trigger a compilation from source within the local environment,
+# without help from this file.
set -e
set -x
usage () {
+ set +x
printf "%s\n\n" "$*"
- printf "usage: %s [-g GitHub_Username] [-w]\n" ${0##*/}
+ printf "usage: %s [-w]\n" ${0##*/}
printf "\t%s\t%s\n" ""
printf "\t%s\t%s\n" "$*"
exit 1
}
-# Define colors for SVG ~foreground~ seen on Github front page.
-svg_color_dark_scheme="#EEF"
-svg_color_light_scheme="#011"
-github_blue_color="#2F81F7"
-
-# GOMOD=$(go env GOMOD)
-# from_username=${GOMOD##*github.com/}
-# githubuser=${from_username%%/*}
-#
-# X Is it acceptable to push to a PR branch files that refer to the owner's main branch?
-githubuser=blampe
-
TEST_ARGS=
-
while getopts hg:iw flag
do
case $flag in
h) usage "";;
- g) githubuser=${OPTARG};; # Override guess based on GOMOD
w) TEST_ARGS=${TEST_ARGS}" -write";;
\?) usage "unrecognized option flag";;
esac
done
+PACKAGE_PATH=$(go list .)
+UPSTREAM_OWNER=${PACKAGE_PATH#*/}
+UPSTREAM_OWNER=${UPSTREAM_OWNER%/*}
+
+GITHUB_REPOSITORY_OWNER=$USER
+CURRENT_BRANCH_NAME=$(git-branch --show-current)
+# If the current branch name contains the GitHub username of the owner of the upstream repo,
+# assume the intention is to prepare and push a pull request.
+if [ $(expr $CURRENT_BRANCH_NAME : ".*$UPSTREAM_OWNER") != 0 ]
+then
+ GITHUB_REPOSITORY_OWNER=$UPSTREAM_OWNER
+fi
+
tmpl_expand () {
- go run ./cmd/tmpl-expand Root="." GithubUser=${githubuser} "$@"
+ # XX Root="/" resolves to root of the repo -- consider dropping the variable.
+ go run ./cmd/tmpl-expand Root="/" Github_Repository_Owner=${GITHUB_REPOSITORY_OWNER} "$@"
}
#tmpl_expand go.mod
@@ -51,27 +52,18 @@ tmpl_expand () {
# SVG examples/ regeneration.
#
# If the command fails due to expected changes in SVG output, rerun
-# this script with "TEST_ARGS=-write" first on the command line.
+# this script with "TEST_ARGS=-write".
# X Results are used as "golden" standard for GitHub-side regression tests --
# so arguments here must not conflict with those in "test.yml".
# XX How to share a single arg list shared between the two i.e. "DRY"?
go test -run . -v \
${TEST_ARGS}
-# Illustrate a workaround for lack of support in certain browsers e.g. Safari for
-# inheritance of CSS property 'color-scheme' from elements downward to nested
-#