Lines that start with # that is not followed by a space is taken to be an op.
This is a first step to make ttyshot specs (mostly) valid Elvish scripts.
The wait-for-str op is no longer needed since the ttyshot procedure will now end
gracefully.
The wait-for-re op seems to never been used in the first place.
Also add a -v flag that enables verbose logging, although there is no logging
call yet.
- Handle newlines correctly, in case they appear in the middle of a segment.
- Don't wrap unstyled segments in <span>.
- Strip unstyled trailing spaces.
- Don't escape ' and " - they are pretty frequent, and not escaping them makes
it slightly easier to read diffs.
Also fix a bug in waitForOutput when budget is exactly 0.
- Move the output writing to the end. This avoids putting the output file in a
truncated state while the ttyshot process is running.
- Don't save raw output of capture-pane unless the -save-raw flag is given.
- Use a fork of testutil.ApplyDir to specify the layout in a map
- Hardcode the elvish directory's layout, remove cp-elvish.sh
- Put rc.elv where Elvish expects to find it
- Place temporary files in a hidden .tmp directory
- Start with an empty environment, only setting HOME, PATH and TERM
- Use -T to force terminal features, removing the need for a dedicated tmux.conf
file
The before-readline hook now just writes out "[PROMPT]", and the //prompt op now
just waits for "[PROMPT]" to appear.
Also strip all the prompt markers from the output.
The thumb part of scroll bars are rendered with stylized spaces. The
capture-pane command strips trailing spaces by default and will remove those
parts.
Instead of using tmux kill-session, bound Alt-q to a key that runs capture-pane
and then exits.
Tmux can now be expected to exit without error, and there is no longer a need to
hardcode a 100ms for the ttyshot to stablize.
The master/slave terminology is now increasingly shunned. The origin author of
the pty library has moved away from it back in 2019:
7dc38fb350
Unfortunately, renaming "master" to "pty" is problematic because it conflicts
with the package name. Use "ctrl" as a compromise - the same "ctrl" term is
already used in pkg/cli/clitest, in ttyCtrl.
The main benefits of this change are:
1) It uses a hermetic "home" directory with a known command and location
history. Which means it no longer depends on the interactive history
and directory layout of the person creating the ttyshot. Which also
means it no longer leaks the private history of anyone creating a
ttyshot. This produces reproducible results when updating ttyshots.
2) The user no longer has to augment the ttyshot by manually adding the
output of the commands to the generated HTML file. A process that is
error prone. The output of the commands that generate the ttyshot is
now captured and automatically included in the resulting HTML.
3) It makes it trivial to recreate every ttyshot. Simply execute these
commands:
```
make ttyshot
for f [website/ttyshot/**.spec] { put $f; ./ttyshot $f }
```
4) It makes it easy to introduce new "ttyshot" images by creating a
shell session "spec" file. This makes it easy to replace the existing
"```elvish-transcript...```" examples with ttyshots in order to
ensure a consistent representation and visual consistency with the
transcripts that are currently generated as ttyshots.
The downside of this change is the introduction of a dependency on the
Tmux application. But that seems reasonable since Tmux is a mature
application available on Linux, macOS, BSD, and probably every other
UNIX like OS we care about. Note that generating the Elvish
documentation already depends on similar apps such as Pandoc.
Related #1459
Upsides:
- Removing the render-blocking fonts.css allows the page to be visible while the
font is being loaded.
- The original WOFF2 files are smaller than the base64-encoded version in
fonts.css.
- Browsers may be smart enough to not download fonts that are not needed.
The only downside is that this requires the browser to make more requests - up
to 6 for all 6 font files. But this is not a problem with modern browsers.
- Use go:embed (available since Go 1.16) to embed them into the binary
- Teach elvdoc to support comments starting with #, and find *.elv when given a directory
- Move from pkg/eval/mods to pkg/mods
- Introduce mods.AddTo that adds all standard library modules
- Move epm and readline-binding into their own packages
The @module macro is placed at the beginning of a doc, and calls elvdoc after
processing the doc.
This is needed in order to correctly put the Module anchor at the beginning of
the doc, instead of at the place that calls @elvdoc.
Also refactor the macros command to reduce boilerplate in macro implementations.