Nenhuma descrição

Getty Ritter 8a34d6bd1e Fixed import issues in last merge 8 anos atrás
ptolemy 8a34d6bd1e Fixed import issues in last merge 8 anos atrás
ptolemy-bridge 4a11d3df77 Resolved merge problems with metadata section in Core 8 anos atrás
ptolemy-core 8a34d6bd1e Fixed import issues in last merge 8 anos atrás
ptolemy-reader-markdown 59976ff04a Added BSD license to each package 8 anos atrás
ptolemy-reader-slackdown 65f03da720 Added BSD license to slackdown reader 8 anos atrás
ptolemy-writer-html ae525d2f91 Began implementation of HTML writer 8 anos atrás
.gitignore 27c6d1d2b2 Gitignores are very useful 8 anos atrás
README.md 5b061a4877 Added basic README 8 anos atrás
cabal.project b4f8141104 Added Slackdown (minimal Markdown-like formatting) reader 8 anos atrás

README.md

ptolemy

WARNING: STILL SUPER EARLY IN DEVELOPMENT, AND MAY NEVER GO ANYWHERE AT ALL.

The motivation behind Ptolemy is to address some minor gripes about Pandoc as a library. Let's be clear: Pandoc is awesome. It's amazing both as a utility and as a library, and a ridiculous amount of work has gone into making it as cool as it is.

One of the major strengths of Pandoc is that it's frankly huge. It's got all kinds of amazing features and implements a ridiculous amount of stuff. The downside to that is that when you want to use Pandoc as a library, you often only want a tiny subset of its functionality. Maybe you want to parse Markdown and RST, and produce HTML. Maybe you want to pull in HTML but also spit out LaTeX. With Pandoc, you can't go in a little bit: you have to get it all.

This library is an experiment in building a heavily Pandoc-inspired system with a more modular structure. With Ptolemy, you can select just the readers and writers you want and compose them together without having to draw in the the hundred-odd modules that compose Pandoc proper. It also should simplify plugging in new modules to a Pandoc-like ecosystem: I could, for example, create a new markup format and easily translate it to the Ptolemy internal format and then use existing Ptolemy writers with it.

That said, it might turn out that this is no net win at all. We'll see!

What Does It Look Like?

This doesn't actually work yet, but it will look something like this. This program will depend on ptolemy-reader-markdown, ptolemy-writer-html and text:

import qualified Data.Text as Text
import qualified Text.Ptolemy.Markdown.Writer as MS
import qualified Text.Ptolemy.HTML.Writer as HTML

main :: IO
main = do
  cs <- Text.getContents
  case MD.readSlackdown MD.defaultOpts cs of
    Left err -> putStrLn err
    Right pt -> Text.putStrLn (HTML.writeHtmlStrict pt)

Why The Name?

The name Ptolemy is a Greek name that was given to a number of famous Greek and Egyptian historical figures, but I chose it for this project for two reasons:

  • Like "Pandoc", "Ptolemy" starts with a P, and
  • The Rosetta Stone, the multilingual decree that survived and served much later as Europe's key to deciphering Egyptian hieroglyphs, was made on the orders of King Ptolemy V.