Code Monkey home page Code Monkey logo

satysfi-base's Introduction

satysfi-base

build status

TL;DR

let get-image ratio path =
  path |> String.append `images/`
       |> Image.of-jpeg
       |> Inline.of-image (13.5cm |> Length.scale ratio)
in

ctx |> Inline.read {
  The quick brown fox jumps over the lazy dog.
  \eval(Inline.mandatory-break);
  \eval-const(`fox.jpg` |> get-image 0.45);
}

What is satysfi-base

This repository contains a collection of utility functions and modules for SATySFi. Because the library bundled with the default installation configuration of SATySFi is currently not rich enough, this project aims to provide a complementary library sufficient for most situations in typesetting.

Our repository contains:

  • basic types and utilities (e.g. String, Char, etc)
  • data structures (e.g. Array, Map, etc)
  • program controls (e.g. Ref, Lazy, etc)
  • text processing (e.g. RegExp, Lexer, Parser, etc)
  • extra typesetting functions (e.g. Inline, Pager, etc)

We also provide some specific packages for typesetting:

  • derive: display proof trees
  • code2: display program sources with syntax highlight

Installation

Easy installation using satyrographos:

$ opam install satysfi-base

Contribution

Any pull requests and/or issues are welcome. For the moment, we also give access rights to the repository to everyone who is willing to contribute us. You can freely make changes, create branches, and push them. If you are intersted in development of this project, please contact us.

License

All files in this repository are licensed under MIT.

satysfi-base's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar gfngfn avatar maswag avatar na4zagin3 avatar nyuichi avatar puripuri2100 avatar takagiy avatar uemurax avatar y-yu avatar yasuo-ozu avatar zeptometer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

satysfi-base's Issues

Create LaTeXiT-sh class file

It would be useful to have a class file such that

  • it takes a single block-boxes
  • and creates a document with single page where page size fits the given block-boxes

We want to use such a class file when we create a figure with SATySFi which will be embedded in another document ofLaTeX or Word.

Change the default value of `fill-tail` in `Block.of-inline` to `true`

According to the document,

%% If [fill-tail] is true, [Inline.fil] is added at the end of the return value.

If fill-tail is false, there may be no Inline.fil in the inline text and sometimes line-break fails to break it into lines. It seems more user-friendly to set fill-tail as true by default because that's what we expect in most of the cases.

How to become a contributor

Please send a message saying "let me join!" in this thread if you wish to become a contributor of this project. Note that, however, being a contributor of this repository does not mean you are fully able to push arbitrary changes to master. Usually we follow the following workflow to make changes in the code in master:

  • create a pull request
  • get it reviewed from a contributor who knows well the code base you are changing
  • once your reviewer approved your pull request, merge it to master

That is, even a non contributor can send us pull requests and even a contributor has to create a pull request whenever, so becoming a contributor is not very important if you just want to send us changes. Instead contributors are assigned reviewing tasks and responsible for checking the given patch works fine.

Try migrating unit tests to satysfi-test

Background

At present, we have unit tests and regression tests to keep quality. We write unit tests by writing all test results to output and compare them with snapshots because we don't have unit testing frameworks for SATySFi.

I published the very first version of satysfi-test. I consider we can try it out, and replace all unit tests to ones with satysfi-test if it works well.

Goal

We should have better unit tests using satysfi-test.

Stop using zrbase

We want more precise implementations of Float.ceil, Float.floor, etc than ZP0.ceil, ZP0.floor, etc.

Use jest-pdf-snapshot for regression tests

Background

Currently, we use jest-image-snapshot for regression. Tests compile test SATySFi files to pdf files and then convert to images, and finally compare them with snapshots. This was kind of a compromise plan, give that we don't have very good tooling for comparing pdf snapshot directly.

That's why I developed jest-pdf-snapshot. Although it is still unstable, I believe this will helps us have better regression tests.

Goal

Replace the current regressions tests with jest-image-snapshot with those with jest-pdf-snapshot.

Separate out Derive module into independent repo/package

Derive provides typesetting commands for displaying proof trees. We included Drive in satysfi-base for convenience when we didn't have a package management system.

Now that Satyrographos is widely used in the SATySFi community, it's better to have it as an independent package from satysfi-base. Derive provides a different feature from the core concern of satysfi-base.

Release version 1.0 on 15 Dec

the date when I am assigned to the SATySFi advent calendar 2019.

  • rename satysfi-lib to satysfi-base
  • update README
  • add a package file for satyrographos
  • add LICENSE
  • publish on satyrographos-repo

Add dependency on fonts-dejavu

typeset/code2.satyh uses DejaVuSansMono. The trouble is that the vanilla SATySFi doesn't provide the font and users need to install it manually. We can avoid this by adding SATySFi-fonts-dejavu as satyrographos dependency.

Release strategy

Aside from #55 and #96, I would appreciate if you could release a new minor version instantly when every new feature has been added unless it's considered conflicting with existing part. How do you think @nyuichi ?

RegExp.exec is very slow for some inputs

RegExp.exec is very slow for the following example.

@require: stdja
@require: base/regexp

let longString = ` I do not know why but it seems code2 is slow if it contains a long line.
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo
wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo wakegawakaranaiyo` in 
%% This is slow
let slowRegex = RegExp.seq RegExp.bof RegExp.space in
%% These are not slow
let notSlowRegexList = [
    RegExp.bof;
    RegExp.space;
    RegExp.seq RegExp.bof RegExp.alpha;
    ] in
let _ = RegExp.exec slowRegex longString in
let _ = List.map (fun notSlowRegex -> RegExp.exec notSlowRegex longString) notSlowRegexList in
document (|
  title = {slow regexp};
  author = {MasWag};
  show-title = false;
  show-toc = false;
|) '<>

In my environment, a single call of RegExp.exec + (almost minimal typesetting) took about 30 seconds.

real	0m33.527s
user	0m33.334s
sys	0m0.040s

Get rid of JS dependency

Currently, this repo has two dependencies on JS(node/yarn)

  • unit tests (being replaced with #142)
  • scripts

Considering their verboseness, we want to get rid of JS dependency and find an alternative that is more concise.

Support satysfi v0.0.7

The current version of SATySFi is 0.0.7 (NOTE: 0.0.8 is not available at opam?), while the current release of satysfi-base supports 0.0.6. satysfi-base should support the latest SATySFi.

Refer to:

To be clarified:

  • Which version to support?
    • likely 0.0.5-0.0.7
    • How do we ensure that it works as expected for each version?

TODO

  • update dependency in opam
  • refine CI to run tests against different versions of satysfi

Block doesn't export `frame-breakable`

I found the Block module in block.satyh has the following definition

  let frame-breakable pads deco f ctx =
    block-frame-breakable ctx pads deco f

while it doesn't have frame-breakable in its signature.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.