Coder Social home page Coder Social logo

cxw42 / pfft Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 570 KB

PDF From Formatted Text: very lightweight markdown-to-PDF converter

License: BSD 3-Clause "New" or "Revised" License

Makefile 4.77% Shell 5.96% M4 7.40% Vala 68.32% C++ 0.23% C 5.69% Roff 7.63%
markdown pdf pdf-generation lightweight glib pango cairo pangocairo vala hacktoberfest

pfft's Introduction

PDF From Formatted Text: markdown to PDF with fewer dependencies

Build Status codecov

I think TeX, LaTeX, and Pandoc are fantastic tools! However, I sometimes need a markdown-to-PDF converter with fewer dependencies. Pfft is that tool.

Pfft:

  • Doesn't need a Web browser --- it doesn't use HTML
  • Doesn't need a build system --- it comes with an autoconf-generated build script
  • Doesn't need a separate rendering library --- it uses pangocairo, which is standard on GNOME systems.

Installing from a source tarball

(Package names may differ --- these are for Ubuntu)

$ sudo apt install -y libpango1.0-dev libgee-0.8-dev libgstreamer1.0-dev
$ tar xvf pfft-VERSION.tar.gz
$ cd pfft-VERSION
$ ./configure && make -j4 && sudo make install

For the HTML documentation, run make html, then open doc/valadoc/pfft/index.htm.

Contributing to Pfft's development

See CONTRIBUTING.md.

The version history is in CHANGELOG.md.

Thanks

Legal

Most of pfft is BSD-3-clause (see file LICENSE). The files in src/logging are LGPL 2.1+ (see file LGPL-2.1).

pfft's People

Contributors

cxw42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pfft's Issues

Debian packaging

  • Support it
  • Have Travis run debs for Bionic, Eoan Travis can make the .deb, but I don't have a deployment provider set up to receive it!

Move code-block processing commands into core

Currently, the pango-markup writer recognizes ```pfft:foo ...-style code blocks as processing commands.

  • Move that function into core (edit recognizing those blocks is still a reader function)
  • Add objects to represent processing instructions in a source-agnostic way
  • Update md4c-reader to recognize special blocks and use the new objects
  • Update pango-markup to use the new objects edit Specific types of special block, and how they are rendered, should be in separate issues.

Add a template/page-description language

Blocked by #7.

Add a language for expressing templates, much as Pandoc has. Human-readable and -writeable. Should permit specifying:

  • Headers/footers: L, C, R text with placeholders; rules; margins
  • Page size, margins
  • Default paragraph alignment (L, C, R, J)
  • Default font and size
  • Parskip

[ ] Find out if there is an existing one we can use. I looked at the list on https://en.wikipedia.org/wiki/Page_description_language and didn't see one that looked like it would fit. Edit Maybe Lua? Edit 2 For now, nothing anywhere near Turing-completeness :) .

  • If necessary, design one. Serialize in YAML or TOML? Edit For now, using INI-like GLib keyfiles (vala, C)
  • Implement the reader in core
  • In the pango-markup writer, respond to the template commands.

pango-markup: Add option to include the number of pages in headers/footers ("page X of Y")

See src/writer/pango-markup.vala.

Currently, headers and footers can include %p, which will be replaced with the number of the current page. Add logic to replace %n with the number of pages.

I think the only way to do this is to render twice: once without actually laying down ink, to get the page count, and then a second time to make the PDF with the page count filled in.

Support units in template dimensions

I tried https://github.com/LLNL/units (see branch units). It looked good and compiled fine, but the resulting executable was 7.2MB. Since pfft is meant to be lightweight, I am going to leave units behind for now.

I already looked online, and LLNL's units was the best contender I found for a unit-parsing library with a permissive license. I think I am going to roll my own with regexes. https://www.cs.utexas.edu/users/novak/units95.html looks like it might have some good ideas.

Decide how to write unit tests for writer/pango-markup

It currently has many private functions. I would like to test them since many are not trivial. I can think of several options; any suggestions? Other alternatives I haven't thought of?

  • MethodObject: refactor the complex functions into smaller classes
  • Write the test code in src/writer alongside the code being tested
  • Give more symbols package visibility and move the t/ files into the package where necessary
  • Make all those functions public (not preferred)

Expand manpage

Edit src/pfft.pod, which is in perlpod format. Add any of the following (can be in separate PRs):

  • --template
    • An overview of the template format and keys
  • An overview or reference to Pango markup

Edit For bonus points, make it possible to autogen one of the manpage or the GLib argparser from the other. I would strongly prefer not to use vanilla help2man(1) since doing so prevents cross-compiling. (However, HOSTCC + some creative preprocessor defines in src/app might permit using help2man.)

Support title pages

Various options:

I would like to avoid having multiple sets of properties: (size, alignment, justification) x (title, subtitle, header, footer, heading, copy) is way too much for a flat list of properties.

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.