memops

Artifact [0bbba8d891]
Login

Artifact 0bbba8d89118f46eb1919c89fefd74eaa3544555:

Wiki page [memops] by cfkoch 2012-03-02 02:24:07.
D 2012-03-02T02:24:07.710
L memops
P 2e11c8a0d001551fe367ed5ea69ab74af0ce04c9
U cfkoch
W 1718
<b>memops</b> is a simple plain-text to PostScript converter tool.

memops is implemented as a single Embedded Ruby (.erb) document which reads plain text from the standard input and writes the PostScript to standard output. However, because the percent symbol (%) actually has significance within PostScript, it is necessary to run <code>erb</code> with the <code>-P</code> option. For example:

<pre>
  $ erb -P memops.ps.erb < mynotes.txt > mynotes.ps
</pre>

In case you don't like PostScript, or you NEED to give someone a PDF document, then you can use the handy <code>ps2pdf</code> command which comes with the Ghostscript package:

<pre>
  $ erb -P memops.ps.erb < mynotes.txt | ps2pdf -sPAPERSIZE=letter - mynotes.pdf
</pre>

With all that said, memops is, in reality, incredibly limited:

<ul>
  <li>The output is black-and-white 12-point Courier.</li>
  <li>Only one page of output is allowed. This is approximately equal to 55 lines of text.</li>
  <li>The paper must be letter sized. (8.5" by 11")</li>
  <li>The 1-inch margins are on by default.</li>
  <li>Word wrapping is not possible.</li>
</ul>

Therefore, your input text will usually have to be formatted before being sent to memops. Most implementations of the <code>fmt(1)</code> command make text at most 65 characters long by default, which is perfect for memops:

<pre>
  $ fmt mynotes.txt | erb -P memops.ps.erb > mynotes.ps
</pre>

Of course, you can also specify an alternative width if you wish:

<pre>
  $ fmt -w 40 mynotes.txt | erb -P memops.ps.erb > mynotes.ps 
</pre>

One last note. This software is so stupidly simple that I disclaim all copyright to it and release memops into the public domain.
Z 1fa2817e0a62d4746d9af1d7248e77a3