Skip to content

Commit

Permalink
redirect all basecast pages to try.perm.pub
Browse files Browse the repository at this point in the history
  • Loading branch information
castedo committed Oct 26, 2023
1 parent 564a891 commit 0d02eef
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 229 deletions.
4 changes: 2 additions & 2 deletions docs/author.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ For more information,

## Stage 1: Generation

[Basecast](basecast/index.md) is a tool that can generate the contents of a baseprint.
[Basecast](https://try.perm.pub/basecast/) is a tool that can generate the contents of a baseprint.
Other tools that can generate JATS XML can potentially be adapted to generate
baseprint contents.

[Generate baseprint contents with Basecast](basecast/index.md){ .md-button .md-button--primary }
[Generate baseprint contents with Basecast](https://try.perm.pub/basecast/){ .md-button .md-button--primary }


## Stage 2: Committing
Expand Down
17 changes: 0 additions & 17 deletions docs/basecast/examples/main.tex

This file was deleted.

24 changes: 0 additions & 24 deletions docs/basecast/examples/pandocin.yaml

This file was deleted.

60 changes: 4 additions & 56 deletions docs/basecast/index.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,4 @@
# Basecast

Basecast is an authoring tool that:

* generates [baseprint](https://perm.pub/HKSI5NPzMFmgRlb4Vboi71OTKYo) contents,
* reads [Pandoc](https://pandoc.org) source formats such as LaTeX and Markdown,
* can generate HTML and PDF previews,
* can automatically regenerate outputs when source files are edited, and
* is [open-source](https://gitlab.com/castedo/basecast).

Basecast can be run in the cloud (GitHub) or from the command line.


## Run in the cloud (GitHub)

Start the try.perm.pub tutorial:

[Author a Baseprint via GitHub](https://try.perm.pub/tutorial/basecast_via_github/){ .md-button .md-button--primary target='_blank' }


## Run from the command line

Instead of running basecast as a GitHub Action,
you can run it from the command line.
Here's a simple example of bash commands that demonstrate `basecast`:

```
echo Hello World > doc.md
basecast doc.md --baseprint=out
```

The above example will generate a baseprint in the `out`
subdirectory, which will contain a JATS XML file named `article.xml`.
For more details, consult the [Usage page](usage.md).

To use Basecast from the command line, it needs to be either "installed" via containers
or installed locally.


### Setup 1: Container

Running `basecast` in an [OCI](https://opencontainers.org/){ target='_blank' }
(Docker) container is the recommended way to try `basecast`
as it avoids many common installation problems.

[Setup via containers](https://try.perm.pub/howto/basecast_container/){ .md-button }


### Setup 2: Packages

Running `basecast` via a container
will download and cache almost a gigabyte of container image data.
Installing `basecast` directly will consume much less disk space.
However, installing packages locally is more difficult and might not work.

[Install packages](https://try.perm.pub/howto/install_basecast/){ .md-button }
---
template: redirect.html
location: https://try.perm.pub/basecast/
---
129 changes: 4 additions & 125 deletions docs/basecast/usage.md
Original file line number Diff line number Diff line change
@@ -1,125 +1,4 @@
# Usage

To use the command line interface,
[run basecast via OCI/Docker container](https://try.perm.pub/howto/basecast_container/)
(recommended) or
[install software packages](https://try.perm.pub/howto/install_basecast/).

```
usage: basecast [-h] [-b BASEPRINT] [-o OUTDIR] [-C DIRECTORY] [--skip-pdf]
[-m MONITOR] [-d DEFAULTS]
[infiles ...]
positional arguments:
infiles pandoc input files
options:
-h, --help show this help message and exit
-b BASEPRINT, --baseprint BASEPRINT
baseprint output directory
-o OUTDIR, --outdir OUTDIR
HTML/PDF output directory
-C DIRECTORY, --directory DIRECTORY
run from this directory
--skip-pdf Do not generate PDF
-m MONITOR, --monitor MONITOR
paths to monitor
-d DEFAULTS, --defaults DEFAULTS
pandoc default option settings
```

The non-option arguments for input files (`infiles ...`) are passed through to
[`pandoc`](https://pandoc.org).
Pandoc will concatenate multiple input files.
Options for `-d` and `--defaults` for defaults files are also passed through to `pandoc`.
See the [Defaults files section of the Pandoc User's
Guide](https://pandoc.org/MANUAL.html#defaults-files) for more information.


## Markdown

Files with the `.md` suffix will be parsed as Markdown by [`pandoc`](https://pandoc.org).
A simple way to try `basecast` is to write plain text into a `doc.tex` file and pass it
as an input file to `basecast`.

```
basecast doc.md -b=baseprint
```

A baseprint is created in the subdirectory `baseprint` (containing a JATS XML file named `article.xml`).


## Use with LaTeX

Input files with the `.tex` suffix will be interpreted as LaTeX.
LaTeX can also be embedded inside Markdown files.
However, not all LaTeX is understood by `pandoc`. `basecast` is not
running a traditional LaTeX compiler. It is merely calling `pandoc`
to convert to JATS XML from LaTeX or markdown with embedded LaTeX.


## Use with other LaTeX compilers and Overleaf

`basecast` can be used in parallel with other LaTeX compilers such as those found on
[Overleaf](https://www.overleaf.com/) (e.g. pdfLaTeX, LaTeX, XƎLaTeX, and LuaLaTeX).

An approach that works well with a LaTeX compiler
is to maintain separate `main.tex` and `doc.tex` files.
The `doc.tex` file contains the content of the document whereas `main.tex`
is a minimal wrapper that includes `doc.tex`.
Only `doc.tex` is read by `pandoc`
whereas `main.tex` is provided to a full LaTeX compiler (such as on Overleaf).
LaTeX markup that is only needed for a full LaTeX compiler is kept in `main.tex`.
LaTeX markup that is read by both `pandoc` and a full LaTeX compiler is placed in
`doc.tex`.

[Here is an example `main.tex`](examples/main.tex).

The use of a Pandoc defaults file is very useful for handling
separate files such as a `bibliography.bib` file. A Pandoc defaults
file is also useful for setting JATS XML document metadata.

A defaults file like [this example `pandocin.yaml` file](examples/pandocin.yaml) can be used as follows:

```
basecast --defaults mydoc/pandocin.yaml -b=baseprint
```

With this approach, the input file `doc.tex` can include a line of LaTeX such as
`\addbibresource{references.bib}` and it will be found by `pandoc`.


## Monitoring Input Files

With the `-m` and `--monitor` options, folders or files will be continuously monitored
for changes. Upon any folder or file change, the outputs (for baseprint, HTML, and/or
PDF) will be automatically regenerated.

When generating a PDF preview, some PDF applications will automatically refresh when
showing a PDF file on a filesystem.
For HTML outputs, a web server like the NPM package `live-server` can be very useful.
There are many such web servers that will automatically refresh web pages in a web
browser when the HTML files are updated.

Press `CTRL-C` to stop `basecast` when running with `-m`/`--monitor`.

WARNING: Some editors, like `vim` on Linux by default change files in a way that
prevents the proper functioning of `-m`/`--monitor`. Either stick to monitoring a folder
or in the case of `vim` use `set backupcopy=yes`.


### Automatic web page refresh via container

You can run both `basecast` with monitoring and a web server with automatic web page refresh
by completing the [last optional step of the setup with
containers](containers.md#step-four-optional).

With the `live-basecast` shell function defined, you can run the shell command:

```
live-basecast --defaults mydoc/pandocin.yaml --monitor mydoc -b=baseprint
```

like `basecast` but a `-o=site` output option is automatically added.
After running you can browse to `http://localhost:8080` to view an automatically
refreshing HTML preview of the baseprint.
---
template: redirect.html
location: https://try.perm.pub/basecast/cli/
---
6 changes: 1 addition & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ theme:
- toc.integrate
- navigation.footer
- navigation.indexes
- navigation.tabs
- navigation.top
- navigation.tracking
markdown_extensions:
Expand All @@ -17,10 +16,7 @@ markdown_extensions:
nav:
- Baseprints:
- index.md
- Authoring: author.md
- Basecast:
- basecast/index.md
- Usage: basecast/usage.md
- author.md
watch:
- docs
- theme

0 comments on commit 0d02eef

Please sign in to comment.