Skip to content

Commit 920a84a

Browse files
committed
flow: Merged <release> 'v2.2.0' to <master> ('default').
2 parents 8638776 + cd0d22d commit 920a84a

File tree

11 files changed

+1411
-122
lines changed

11 files changed

+1411
-122
lines changed

.flow

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[branchname]
2+
hotfix=hotfix/
3+
develop=develop
4+
master=default
5+
release=release/
6+
support=support/
7+
feature=feature/

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,38 @@ To add DotGraph to Twine 2, use this URL (under Formats > Add a New Format): [ht
66

77
To add DotGraph to Twine 1, create a new folder called `dotgraph` inside your targets folder, then download this file [https://mcdemarco.net/tools/scree/dotgraph/header.html](https://mcdemarco.net/tools/scree/dotgraph/header.html) and place it inside the `dotgraph` folder. (See the Twine wiki for more information about installing and using story formats in Twine 1.)
88

9+
To use DotGraph to graph a published story, open an already-dotgrapphed story in a browser and add a question mark followed by the story's URL.
10+
You can also do this by typing in the URL at the DotGraph site [here](https://mcdemarco.net/tools/scree/dotgraph/#DotGraph.as.a.Service).
11+
12+
## Notes
13+
14+
The start node is double-circled, as are any unreachable nodes. Traced nodes are hex-shaped. When color is on, nodes that are linked but do not exist are colored white. When color by length is on, all other nodes are colored in shades of red (shorter than average) to blue (longer than average) based on the relative length of their contents.
15+
16+
The cluster and color by tag options use the first tag on each passage unless *Use last tag* is checked; optionally detected special tags are ignored in this ordering. Optional detection of an "End" tag changes the shape of "end" passages to an egg (and puts diagonals on loose ends and disconnected nodes). Optional detection of a "checkpoint" tag changes the shape of checkpoint passages to a diamond. The omit by tag(s) option omits the passage regardless of tag order.
17+
18+
Stray or misplaced nodes can result from the omit tags setting, or from duplicate passage names or other linking issues.
19+
20+
The layout engine options change the graph style; some options are slower than the default ("dot"). Some options are only supported under the "dot" engine, such as clustering by tag and choosing the graph direction (the arrows). You can find a [brief description (PDF)](https://graphviz.gitlab.io/_pages/pdf/dot.1.pdf) of the engines and fuller documentation for each one on GraphViz's [documentation page](https://graphviz.org/documentation/).
21+
22+
The image format is SVG.
23+
924
## Troubleshooting
1025

1126
DotGraph may fail to draw the graph in some versions of Twine 2 due to issues with Chrome;
1227
in that case it will still give you the text of the dot source file, as well as some links to sites online that can render it for you.
1328

1429
DotGraph may fail to save the SVG in Safari; if it fails, try a different browser.
1530

31+
## SnowStick
32+
33+
SnowStick is a bit of JavaScript and CSS you can add to stories that use Snowman-based story formats in order to track your reading/proofing progress and graph it with DotGraph. It can also be used without DotGraph. See [its separate README](snowstick/README.md) for more details.
34+
1635
## Versions
1736

37+
### 2.2.0
38+
39+
Add SnowStick (a reading tracker integrated with DotGraph), support for configuration using the DotGraphSettings passage (a safer and more flexible spot than StorySettings, though the latter is still supported), viewing another story by URL (a quicker way than by loading the story and this format into Twine), and Graphviz engine options (after updating to the latest [viz.js](http://viz-js.com) to fix some special character issues).
40+
1841
### 2.1.0
1942

2043
Add a text tracing option and and support for configuration using the StorySettings passage.

grunt/build.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = function(grunt) {
4242
var data = {
4343
name: '{{STORY_NAME}}',
4444
passages: '{{STORY_DATA}}',
45-
vizScript: '<script src="https://mcdemarco.net/tools/scree/dotgraph/viz.js" type="text/javascript"></script>',
45+
vizScript: '<script src="https://mcdemarco.net/tools/viz/viz.js" type="text/javascript"></script><script src="https://mcdemarco.net/tools/viz/full.render.js" type="text/javascript"></script>',
4646
script: '<script>' + grunt.file.read('build/dotgraph.js') + '</script>'
4747
};
4848

@@ -55,7 +55,7 @@ module.exports = function(grunt) {
5555
var data = {
5656
name: '{{STORY_NAME}}',
5757
passages: '{{STORY_DATA}}',
58-
vizScript: '<script>' + grunt.file.read('lib/viz.js') + '</script>',
58+
vizScript: '<script>' + grunt.file.read('lib/viz.js') + '</script><script>' + grunt.file.read('lib/full.render.js') + '</script>',
5959
script: '<script>' + grunt.file.read('build/dotgraph.js') + '</script>'
6060
};
6161

@@ -68,7 +68,7 @@ module.exports = function(grunt) {
6868
var data = {
6969
name: 'DotGraph',
7070
passages: '<div id="storeArea" data-size="STORY_SIZE" hidden>"STORY"</div>',
71-
vizScript: '<script src="https://mcdemarco.net/tools/scree/dotgraph/viz.js" type="text/javascript"></script>',
71+
vizScript: '<script src="https://mcdemarco.net/tools/viz/viz.js" type="text/javascript"></script><script src="https://mcdemarco.net/tools/viz/full.render.js" type="text/javascript"></script>',
7272
script: '<script>' + grunt.file.read('build/dotgraph.js') + '</script>'
7373
};
7474

@@ -81,7 +81,7 @@ module.exports = function(grunt) {
8181
var data = {
8282
name: 'DotGraph',
8383
passages: '<div id="storeArea" data-size="STORY_SIZE" hidden>"STORY"</div>',
84-
vizScript: '<script>' + grunt.file.read('lib/viz.js') + '</script>',
84+
vizScript: '<script>' + grunt.file.read('lib/viz.js') + '</script><script>' + grunt.file.read('lib/full.render.js') + '</script>',
8585
script: '<script>' + grunt.file.read('build/dotgraph.js') + '</script>'
8686
};
8787

lib/full.render.js

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/viz.js

Lines changed: 326 additions & 2 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "DotGraph",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "A proofing format to make a Graphviz graph of a story.",
55
"author": "M. C. DeMarco",
66
"license": "MIT",

snowstick/README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# SnowStick
2+
3+
SnowStick is a bit of JavaScript and CSS you can add to stories that use Snowman (or other story formats based on it), in order to track your reading/proofing progress and graph it with DotGraph. SnowStick can be used without DotGraph, in which case you can still tell where you've been by the link styling (crossed-out for completed branches, squiggly underlining for previously visited links, and no alteration for unvisited links).
4+
5+
## Installation
6+
7+
### Twine 2
8+
9+
1. Put the javascript from `snowstick.js` into your Story JavaScript using the Twine menu item *Edit Story JavaScript*.
10+
2. Set a mode manually at the top of the javascript (see below).
11+
3. Put the CSS from `snowstick.css` into your Story Stylesheet using the Twine menu item *Edit Story Stylesheet*.
12+
13+
### TweeGo
14+
15+
1. Save the files `snowstick.js` and `snowstick.css` to the directory that contains your story file(s).
16+
2. To change the mode, edit the configuration at the top of `snowstick.js` using your favorite text editor.
17+
18+
### Twine 1 or Twee
19+
20+
(This applies to any Twee processor, including TweeGo if you prefer to do it this way.)
21+
22+
1. Put the javascript from `snowstick.js` into a passage tagged *script*.
23+
2. Set a mode manually at the top of the javascript (see below).
24+
3. Put the CSS from `snowstick.css` into a passage tagged *stylesheet*.
25+
26+
## Mode
27+
28+
SnowStick has two main `modes`, *proof* and *read*; you should set one at the top of the SnowStick JavaScript (where you can also set some minor configuration options):
29+
30+
var config = {
31+
mode: 'read',
32+
openBookmark: true,
33+
leafedMessage: ' (all children checked) ',
34+
tags: false,
35+
bar: false
36+
};
37+
38+
In *proof* mode:
39+
40+
* the passage title, overall percentage read, and (optionally) tags appear in a footer, and a note appears when the branch is completely proofed; you can change the note using the `leafedMessage` option
41+
* the percentage can be replaced with a gradient bar by setting the `bar` option to *true*
42+
* the passage is only marked proofed when the footer checkbox is checked off.
43+
* the links are restyled according to whether they're completely new, already proofed, or completed.
44+
45+
In *read* mode:
46+
47+
* the percentage read is the only added UI element (hover on it for details, including optional tags);
48+
* the percentage can be changed from text to a bar by setting the `bar` option to *true*
49+
* the passage is automatically marked read when read.
50+
* the links are restyled according to whether they're completely new, previously read, or completed.
51+
52+
There is also a *clear* mode for clearing all read data from the current browser.
53+
You can use this to start fresh on the current story, or to switch between Twine 1 stories. (See *Issues* below).
54+
55+
In *off* mode, SnowStick is turned off (without uninstalling the code).
56+
57+
## Bookmarking
58+
59+
SnowStick will, optionally, start the story from the passage you left off at. If the story format is managing your story state (or if state matters), you may want to turn this feature off by setting `openBookmark` to *false*. You can switch it on and off again as necessary to restart the story.
60+
61+
## Issues
62+
63+
SnowStick stores its data in your browser's localStorage, so for it to work you must open your story in the same browser and not clear or disable your browser's local storage while reading. You can make changes to the story and republish it, however, without confusing SnowStick. (If you change the IFID, it will be treated as a different story.)
64+
65+
In certain cases, such as Twine 1 stories and other stories without IFID, SnowStick will need to be cleared between stories. To read more than one such story at a time, use a different browser for each story (*e.g.,* Chrome vs. Brave). (This is not a concern for Twine 2 stories that have distinct IFIDs.)
66+
67+
The total passage count includes special and unreachable passages, so you may not hit 100%.
68+
69+
## ToDo
70+
71+
It would be nice to validate the current read/leaf lists against the full passage list (in case passage names change), but that could slow things down and should perhaps be a separate mode.
72+
73+
## Versions
74+
75+
### 0.1
76+
77+
Betaish.

snowstick/snowstick.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/* SnowStick 0.1
2+
supporting CSS for snowstick
3+
see snowstick.js for details
4+
*/
5+
6+
/* the footer only appears in proofing mode, not in reading mode */
7+
8+
#snowstick-footer {
9+
background-color: lightsalmon;
10+
position: bottom center;
11+
width:100%;
12+
padding-left:3px;
13+
}
14+
15+
.snowstick-bar #snowstick-footer {
16+
background-color: white;
17+
background-image: linear-gradient(to right, lightsalmon, white 1%);
18+
}
19+
20+
#snowstick-name {
21+
font-weight:bold;
22+
font-style: italic;
23+
}
24+
25+
/* the percentage read always appears;
26+
remove it by setting display to none instead of inline-block */
27+
28+
#snowstick-percent {
29+
display: inline-block;
30+
float: right;
31+
}
32+
33+
.snowstick-read #snowstick-percent {
34+
color: darkslategray;
35+
padding:3px 6px;
36+
border: 1px solid slategray;
37+
border-radius: 3px;
38+
}
39+
40+
.snowstick-bar.snowstick-proof #snowstick-percent {
41+
width: auto!important;
42+
}
43+
44+
.snowstick-bar.snowstick-read #snowstick-percent {
45+
display:block;
46+
position:fixed;
47+
left:0;
48+
bottom:0;
49+
height:2px;
50+
width:1%;
51+
background-color: rgba(204,136,41,0.45);
52+
border: 0;
53+
border-radius: 0;
54+
}
55+
56+
/* styling of completed leaf nodes and of read (or proofed) nodes */
57+
58+
body.snowstick a.snowstick-read {
59+
text-decoration-style: wavy;
60+
text-decoration-line: underline;
61+
text-decoration-color: #cc8929;
62+
border: none;
63+
}
64+
65+
body.snowstick a.snowstick-leaf,
66+
body.snowstick a.snowstick-read.snowstick-leaf {
67+
text-decoration-style: solid;
68+
text-decoration-line: line-through;
69+
text-decoration-color: black;
70+
}

0 commit comments

Comments
 (0)