Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ruuda/pris
A language for designing slides
https://github.com/ruuda/pris
design dsl graphics pdf slides
Last synced: 2 months ago
JSON representation
A language for designing slides
- Host: GitHub
- URL: https://github.com/ruuda/pris
- Owner: ruuda
- License: gpl-3.0
- Created: 2017-02-18T11:18:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-20T22:15:06.000Z (about 1 year ago)
- Last Synced: 2024-10-25T12:49:27.343Z (3 months ago)
- Topics: design, dsl, graphics, pdf, slides
- Language: Rust
- Homepage: https://docs.ruuda.nl/pris/
- Size: 568 KB
- Stars: 115
- Watchers: 10
- Forks: 5
- Open Issues: 9
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: license
Awesome Lists containing this project
README
# Pris
Pris is a domain-specific language for designing slides and other graphics.
[![Build Status][ci-img]][ci]
[![Gitter][gitter-img]][gitter]## Example
The obligatory “hello world”:
{
put t("Hello world") at (0.1w, 0.5h)
}And to show a little more of the language, here is a slightly more elaborate
program that also draws lines:top_left = (0w, 0h)
top_right = (1w, 0h)
bottom_left = (0w, 1h)
bottom_right = (1w, 1h){
put line(bottom_right) at top_left
put line(top_right - bottom_left) at bottom_leftfont_family = "Cantarell"
font_size = 0.3h
color = #882244
put t("A language for designing slides.") at (0.1w, 0.1w + font_size)
}{
color = #000000
put line((1w, 0h)) at (0w, 0.5h)
}It creates two slides, the first one with a cross in it, the second one with a
horizontal line. The first slide contains text in dark purple.## Comparison to other technologies
* Pris is similar to LaTeX with Beamer in the sense that you write your slides
in a text-based, human readable format, from which a pdf is produced. Pris
differs from LaTeX with Beamer in not doing any lay-out. All elements must be
placed manually.
* Pris is similar to reveal.js in that its control over visuals superficially
resembles css. It differs from reveal.js in requiring a separate compilation
step that renders a pdf. It differs from html in being imperative rather than
declarative.
* Pris is similar to TikZ in LaTeX, in the sense that it is a domain-specific
language for creating graphics. It is similar in providing complete control
over where elements are placed. Pris differs from TikZ in not being embedded
in LaTeX. It has a more modern syntax, and it has first class support for
computation. For instance, arithmetic with coordinates is supported out of
the box, and Pris has proper functions, rather than TeX macros.
* Pris is similar to [Fran][fran], in having first-class, composable graphics
(although implementation is a work in progress). Pris differs from Fran in
not being embedded in Haskell. Pris differs from Fran in placing emphasis on
graphics rather than animation.
* Pris is similar to [Diagrams][diagrams] in being a domain-specific language
with first-class composable graphics, giving complete control over layout.
Pris differs from Diagrams in not being embedded in Haskell. Pris differs
from Diagrams in its styling system. Customization in Pris resembles CSS due
to dynamic scoping, whereas in Diagrams functions pass around a style value.
* Pris is vaguely similar to Powerpoint and graphical editors like Illustrator
or Inkscape in providing complete control over where elements are placed. It
differs in being a text-based format intended to be edited with a text
editor, rather than with a graphical editor.
* Pris is similar to an html canvas element, or to drawing with Skia or Cairo,
in providing complete control over how graphics are drawn. It differs from
direct canvas drawing in being more high-level (graphic elements can be
manipulated as first-class values), and in being a domain-specific language
rather than being controlled by a general-purpose scripting language.## Documentation
* [A language for designing slides][blogpost], a blog post that details the
motivation for building Pris.
* [Examples](examples), small examples that demonstrate one feature at a time.
* Ask questions in [the Gitter chatroom][gitter], or [send me an email][contact].
* The [online documentation][docs] (a work in progress).## Building
Pris uses [Cairo][cairo] for drawing and [Harfbuzz][harfbuzz] for text shaping,
and links against `libcairo.so` and `libharfbuzz.so`. It uses [Rsvg][rsvg] to
render svg images, for which it links against `librsvg-2.so`. Ensure that these
are installed:# On Ubuntu
apt install fonts-cantarell libcairo2-dev libharfbuzz-dev librsvg2-dev# On Arch
pacman -S --needed cantarell-fonts cairo harfbuzz librsvg fontconfig freetype2Pris is written in [Rust][rust] and builds with Cargo, the build tool bundled
with Rust.cargo build --release
target/release/pris examples/lines.pris
evince examples/lines.pdf## License
Pris is free software. It is licensed under the
[GNU General Public License][gplv3], version 3.[ci-img]: https://travis-ci.org/ruuda/pris.svg?branch=master
[ci]: https://travis-ci.org/ruuda/pris
[gitter-img]: https://badges.gitter.im/ruuda/pris.svg
[gitter]: https://gitter.im/ruuda/pris
[blogpost]: https://ruudvanasseldonk.com/2017/04/27/a-language-for-designing-slides
[contact]: https://ruudvanasseldonk.com/contact
[docs]: https://ruuda.github.io/pris/
[rust]: https://rust-lang.org
[cairo]: https://cairographics.org
[harfbuzz]: https://www.freedesktop.org/wiki/Software/HarfBuzz/
[rsvg]: https://wiki.gnome.org/Projects/LibRsvg
[gplv3]: https://www.gnu.org/licenses/gpl-3.0.html
[fran]: http://conal.net/fran/
[diagrams]: https://archives.haskell.org/projects.haskell.org/diagrams/