Added basic README
Getty Ritter
8 years ago
1 | # ptolemy | |
2 | ||
3 | **WARNING: STILL SUPER EARLY IN DEVELOPMENT, AND MAY NEVER GO ANYWHERE | |
4 | AT ALL.** | |
5 | ||
6 | The motivation behind Ptolemy is to address some minor gripes about | |
7 | Pandoc as a library. Let's be clear: Pandoc is _awesome_. It's amazing | |
8 | both as a utility and as a library, and a ridiculous amount of work | |
9 | has gone into making it as cool as it is. | |
10 | ||
11 | One of the major strengths of Pandoc is that it's frankly huge. It's | |
12 | got all kinds of amazing features and implements a ridiculous amount | |
13 | of stuff. The downside to that is that when you want to use Pandoc as | |
14 | a library, you often only want a tiny subset of its functionality. | |
15 | Maybe you want to parse Markdown and RST, and produce HTML. Maybe | |
16 | you want to pull in HTML but also spit out LaTeX. With Pandoc, you | |
17 | can't go in a little bit: you have to get it _all_. | |
18 | ||
19 | This library is an experiment in building a heavily Pandoc-inspired | |
20 | system with a more modular structure. With Ptolemy, you can select | |
21 | just the readers and writers you want and compose them together | |
22 | without having to draw in the the hundred-odd modules that compose | |
23 | Pandoc proper. It also should simplify plugging in new modules to | |
24 | a Pandoc-like ecosystem: I could, for example, create a new markup | |
25 | format and easily translate it to the Ptolemy internal format and | |
26 | then use existing Ptolemy writers with it. | |
27 | ||
28 | _That said_, it might turn out that this is no net win at all. We'll | |
29 | see! | |
30 | ||
31 | ## What Does It Look Like? | |
32 | ||
33 | This doesn't actually work yet, but it will look something like | |
34 | this. This program will depend on `ptolemy-reader-markdown`, | |
35 | `ptolemy-writer-html` and `text`: | |
36 | ||
37 | ~~~.haskell | |
38 | import qualified Data.Text as Text | |
39 | import qualified Text.Ptolemy.Markdown.Writer as MS | |
40 | import qualified Text.Ptolemy.HTML.Writer as HTML | |
41 | ||
42 | main :: IO | |
43 | main = do | |
44 | cs <- Text.getContents | |
45 | case MD.readSlackdown MD.defaultOpts cs of | |
46 | Left err -> putStrLn err | |
47 | Right pt -> Text.putStrLn (HTML.writeHtmlStrict pt) | |
48 | ~~~ | |
49 | ||
50 | ## Why The Name? | |
51 | ||
52 | The name _Ptolemy_ is a Greek name that was given to a number of famous | |
53 | Greek and Egyptian historical figures, but I chose it for this project | |
54 | for two reasons: | |
55 | ||
56 | - Like "Pandoc", "Ptolemy" starts with a P, and | |
57 | - The Rosetta Stone, the multilingual decree that survived and served | |
58 | much later as Europe's key to deciphering Egyptian hieroglyphs, was | |
59 | made on the orders of King Ptolemy V. |