Skip to content

Commit

Permalink
RELEASE: v2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tmedwards authored Feb 25, 2020
2 parents 78cc697 + 0a08219 commit 81d1d71
Show file tree
Hide file tree
Showing 24 changed files with 46 additions and 42 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2019, Thomas Michael Edwards <[email protected]>.
Copyright (c) 2014-2020, Thomas Michael Edwards <[email protected]>.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion docs/core/faq-and-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ You may convert a Twee2 notation file to a Twee&nbsp;v3 notation file like so:
tweego -d -o twee_v3_file.twee twee2_file.tw2
```

Or, if the Twee2 notation file has a standard Twee file extension, like so:
Or, if the Twee2 notation file has a standard Twee file extension (`.tw`, `.twee`), like so:

```
tweego --twee2-compat -d -o twee_v3_file.twee twee2_file.twee
Expand Down
6 changes: 3 additions & 3 deletions docs/core/special-passages-and-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The core properties used with all story formats include:
The properties used only with Twine&nbsp;2-style story formats include:

- <var>format</var>: (string) Optional. The name of the story format to compile against—e.g., `SugarCube`, `Harlowe`, `Chapbook`, `Snowman`.
- <var>format-version</var>: (string) Optional. The version of the story format to compile against—e.g., `2.29.0`. From the installed story formats matching the name specified in <var>format</var>, Tweego will attempt to use the greatest version that matches the specified major version—i.e., if <var>format-version</var> is `2.0.0` and you have the versions `1.0.0`, `2.0.0`, `2.5.0`, and `3.0.0` installed, Tweego will choose `2.5.0`.
- <var>format-version</var>: (string) Optional. The version of the story format to compile against. Story format versions follow the [Semantic Versioning specification](https://semver.org/), though generally use only the <var>major.minor.patch</var> form—e.g., `2.30.0`. From the installed story formats matching the name specified in <var>format</var>, Tweego will attempt to use the greatest version that matches the specified <var>major</var> version—i.e., if <var>format-version</var> is `2.0.0` and you have the versions `1.0.0`, `2.0.0`, `2.5.0`, and `3.0.0` installed, then Tweego will choose `2.5.0`.

<p role="note"><b>Note:</b>
The above is <em>not</em> an exhaustive list of all Twine&nbsp;2-style story format properties. There are others available that are only useful when actually interoperating with Twine&nbsp;2—e.g, <var>tag-colors</var> and <var>zoom</var>. See the <a href="https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md" target="&#95;blank">twee-3-specification.md</a> for more information.
Expand All @@ -57,7 +57,7 @@ To compile against a specific version of a story format, use the format command
</p>

<p class="warning" role="note"><b>Warning:</b>
JSON chunks are not JavaScript object literals, though they look much alike. Property names must always be double quoted and you should not include a trailing comma after the last property.
JSON chunks are not JavaScript object literals, though they look much alike. Property names must always be double quoted and you must not include a trailing comma after the last property.
</p>

#### Example
Expand All @@ -67,7 +67,7 @@ JSON chunks are not JavaScript object literals, though they look much alike. Pr
{
"ifid": "D674C58C-DEFA-4F70-B7A2-27742230C0FC",
"format": "SugarCube",
"format-version": "2.29.0",
"format-version": "2.30.0",
"start": "My Starting Passage"
}
```
Expand Down
2 changes: 1 addition & 1 deletion escaping.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
16 changes: 6 additions & 10 deletions filesystem.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand All @@ -12,7 +12,6 @@ import (
"log"
"os"
"path/filepath"
"strings"
"time"
// external packages
"github.com/radovskyb/watcher"
Expand All @@ -33,7 +32,7 @@ func init() {
}
}

var noOutToIn = fmt.Errorf("no output to input source")
var errNoOutToIn = fmt.Errorf("no output to input source")

// Walk the specified pathnames, collecting regular files.
func getFilenames(pathnames []string, outFilename string) []string {
Expand All @@ -55,7 +54,7 @@ func getFilenames(pathnames []string, outFilename string) []string {
return err
}
if absolute == absOutFile {
return noOutToIn
return errNoOutToIn
}
relative, _ := filepath.Rel(workingDir, absolute) // Failure is okay.
if relative != "" {
Expand All @@ -77,7 +76,7 @@ func getFilenames(pathnames []string, outFilename string) []string {
log.Print("warning: path -: Reading from standard input is unsupported.")
continue
} else if err := filepath.Walk(pathname, fileWalker); err != nil {
if err == noOutToIn {
if err == errNoOutToIn {
log.Fatalf("error: path %s: Output file cannot be an input source.", pathname)
} else {
log.Printf("warning: path %s: %s", pathname, err.Error())
Expand Down Expand Up @@ -133,12 +132,9 @@ func watchFilesystem(pathnames []string, outFilename string, buildCallback func(
var pathname string
switch event.Op {
case watcher.Move, watcher.Rename:
// NOTE: Format of Move/Rename event `Path` field: "oldName -> newName".
// TODO: Should probably error out if we can't split the event.Path value.
names := strings.Split(event.Path, " -> ")
pathname = fmt.Sprintf("%s -> %s", relPath(names[0]), relPath(names[1]))
pathname = fmt.Sprintf("%s -> %s", relPath(event.OldPath), relPath(event.Path))
if !build && !isDir {
build = knownFileType(names[0]) || knownFileType(names[1])
build = knownFileType(event.OldPath) || knownFileType(event.Path)
}
default:
pathname = relPath(event.Path)
Expand Down
2 changes: 1 addition & 1 deletion formats.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion html.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion ifid.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion io.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
5 changes: 2 additions & 3 deletions module.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down Expand Up @@ -98,8 +98,7 @@ func loadModuleFont(filename string) ([]byte, error) {
}

var (
name = filepath.Base(filename)
family = strings.Split(name, ".")[0]
family = strings.Split(filepath.Base(filename), ".")[0]
idSlug = "style-module-" + slugify(family)
ext = normalizedFileExt(filename)
mediaType = mediaTypeFromExt(ext)
Expand Down
2 changes: 1 addition & 1 deletion passage.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion passagedata.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
3 changes: 2 additions & 1 deletion sort.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand All @@ -10,6 +10,7 @@ import (
"unicode"
)

// StringsInsensitively provides for case insensitively sorting slices of strings.
type StringsInsensitively []string

func (p StringsInsensitively) Len() int {
Expand Down
2 changes: 1 addition & 1 deletion statsitics.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion story.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion storydata.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion storyload.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion storyout.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
2 changes: 1 addition & 1 deletion tweego.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
tweego (a twee compiler in Go)
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
4 changes: 2 additions & 2 deletions usage.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down Expand Up @@ -120,7 +120,7 @@ func usageVersion() {
fmt.Fprintf(os.Stderr, "\n%s, %s\n", tweegoName, tweegoVersion)
fmt.Fprint(os.Stderr, `
Tweego (a Twee compiler in Go) [http://www.motoslave.net/tweego/]
Copyright (c) 2014-2019 Thomas Michael Edwards. All rights reserved.
Copyright (c) 2014-2020 Thomas Michael Edwards. All rights reserved.
`)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion user.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down
16 changes: 12 additions & 4 deletions util.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand Down Expand Up @@ -85,10 +85,18 @@ func normalizedFileExt(filename string) string {
return strings.ToLower(ext[1:])
}

// Returns a trimmed and encoded slug of the passed string that should be safe
// for use as a DOM ID or class name.
func slugify(original string) string {
// TODO: Maybe expand this to include non-ASCII alphas?
invalidRe := regexp.MustCompile(`[^[:word:]-]`)
return strings.ToLower(invalidRe.ReplaceAllLiteralString(original, "-"))
// NOTE: The range of illegal characters consists of: C0 controls, space, exclamation,
// double quote, number, dollar, percent, ampersand, single quote, left paren, right
// paren, asterisk, plus, comma, hyphen, period, forward slash, colon, semi-colon,
// less-than, equals, greater-than, question, at, left bracket, backslash, right
// bracket, caret, backquote/grave, left brace, pipe/vertical-bar, right brace, tilde,
// delete, C1 controls.
illegalRe := regexp.MustCompile(`[\x00-\x20!-/:-@[-^\x60{-\x9f]+`)

return illegalRe.ReplaceAllLiteralString(original, "_")
}

func stringSliceContains(haystack []string, needle string) bool {
Expand Down
4 changes: 2 additions & 2 deletions version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2014–2019 Thomas Michael Edwards. All rights reserved.
Copyright © 2014–2020 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
Expand All @@ -24,7 +24,7 @@ var (
tweegoVersion = versionInfo{
major: 2,
minor: 1,
patch: 0,
patch: 1,
pre: "",
}
// tweegoVersion holds the build ID.
Expand Down

0 comments on commit 81d1d71

Please sign in to comment.