groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Markdown to MOM Using Pandoc


From: Yves Cloutier
Subject: [Groff] Markdown to MOM Using Pandoc
Date: Wed, 23 Jul 2014 16:14:55 -0400

Hello,

I have begun working on a custom writer for Pandoc to convert Markdown into
MOM, Peter's Groff macro set.  You can check it out here.

https://github.com/cloutiy/markdown-to-mom

I will upload my files in a few hours once I arrive home from work.

I'm not a developer or programmer, so anyone who is interested in helping
out is welcome!
MOM Macros for Groff

Peter Schaffer's MOM macros <http://www.schaffter.ca/mom/> are a set of
macros that make it easy for create professionally typeset documents, from
simple articles to complete books. MOM is well documented and actually very
pleasant to work with.It can do whatever LaTeX can do and often can do it
more easily.

Groff and MOM are extremely lightweight and comiling a document is blazing
fast. The only drawback is that writing in pure MOM---as with writing in
pure LaTeX/ConText---is that it can be distracting to have to write so many
tags while typing.
<https://github.com/cloutiy/markdown-to-mom#markdown-and-pandoc>Markdown
and Pandoc

Enter Markdown. Mardown is a simple markup language which can be used to
write your content in plain text without being distracted by prsentation of
that content. Using Pandoc, Markdown can be converted into many target
outputs, including LaTex and ConText.

I wanted to see how easy it would be to do the same for converting Markdown
to MOM. Turns out it's not that difficult. But I certainly welcome any
input from more experienced coders!
<https://github.com/cloutiy/markdown-to-mom#trying-it-out>Trying it Out!

If you have pandoc installed, you can give it a whirl by running the
following:

pandoc mom-test.txt -t mom.lua -o mom-test.mom

Where:

   1. mom.lua is the custom writer for markdown->MOM. It assumes that file
   is in your current working directory. Otherwise you will have to explicitly
   write out the path of where you put this file.
   2. mom-test.txt is a markdown file. The one I'm using for my tests is in
   the repository.
   3. mom-test.mom is the output mom file you are generating.

Then to generate a PDF from your .mom document, run:

pdfmom mom-test.mom > mom-test.pdf
<https://github.com/cloutiy/markdown-to-mom#what-works>What Works

Still very much a hack at this point as I'm still new to all this. But
conversion of basic Markdown elements to MOM works for:

   - headings
   - bold, italics
   - blockquotes
   - footnotes
   - lists
   - superscripts

<https://github.com/cloutiy/markdown-to-mom#what-doesnt-work>What Doesn't
Work

Right now these don't work, or only partially work:

   - images

<https://github.com/cloutiy/markdown-to-mom#the-plan>The Plan

Right now I have hardcoded some default values into the script that
generates the MOM code, but the idea will be that all those settings that
relate to HOW you want your document to look (like page size, margins,
heading styles) would be specified in a separate file, like a stylesheet,
which you can specifiy to use when the document being compiled. This would
allow for easily changing the look of your document simply by specifying a
different "stylesheet".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]