Skip to content

Commit

Permalink
doc: Get current version number into Snek startup message example
Browse files Browse the repository at this point in the history
That involved changing how the version was passed to asciidoctor and
figuring out how to enable attribute substitution inside the relevant
paragraph.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Mar 7, 2019
1 parent 57193c4 commit 54a879f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doc/Makefile
Expand Up @@ -14,7 +14,7 @@ IMAGE_FILES=../snek.svg

all: $(HTML_FILES) $(PDF_FILES)

ATTRIBUTES= --attribute="revdate=$(SNEK_DATE)" --attribute="revnumber=v$(SNEK_VERSION)"
ATTRIBUTES= --attribute="revdate=$(SNEK_DATE)" --attribute="version=$(SNEK_VERSION)"

.adoc.html:
asciidoctor -B$(SNEK_ROOT) $(ATTRIBUTES) -b html5 $*.adoc
Expand Down
12 changes: 7 additions & 5 deletions doc/snek.adoc
@@ -1,7 +1,8 @@
= The Snek Programming Language: A Python-inspired Embedded Computing System
Keith Packard <keithp@keithp.com
:title-logo-image: image:snek.svg[Snek]
.revnumber: v0.0
:version: 0.0
:revnumber: v{version}
:revdate: 1 Jan 1970
:icons:
:icontype: svg
Expand Down Expand Up @@ -179,11 +180,12 @@ words "hello, world" to the console. Because snek offers an
interactive command line, we can actually do this in several ways.

The first way is to simply evaluate an expression. Start up Snek on
your computer (perhaps by typing 'snek' at the usual command prompt):
your computer (perhaps by finding Snek in your system menu or by
typing 'snek' at the usual command prompt):

$ snek
Welcome to Snek version 1.0
>
[source,python,subs="attributes+"]
Welcome to Snek version {revnumber}
>

At this prompt, the result of any expression typed in will be printed:

Expand Down

0 comments on commit 54a879f

Please sign in to comment.