On 2017-02-08, Grant Edwards <grant.b.edwa...@gmail.com> wrote:
> I usually try to avoid Qt apps, but I needed a way to preview markdown
> text.  One option was pandoc, but it needed to install 100+ packages
> as dependancies.  Another option was retext, which only required a few
> new packages.
>
> So I installed retext.  The install seemed to go fine, but it doesn't run:
> [...]

[This was with the stable retext.]

I looked at the retext sources, and AFAICT with no command-line args
there are situations retext tries to mix QT4 and QT5 modules (that
seems obviouisly wrong, but I'm no Qt expert).  I tried forcing retext
to use qt4 only by specifying --pyqt4, but that failed in other ways.

I gave up on the stable version of retext and tried the ~amd64 version
of retext, and it wanted to install more QT5 stuff than I had patience
for.

So I finally gave up on retext and wrote my own command-line markdown
to html converter utility:

------------------------------------------------------------------------
#!/usr/bin/python
import sys,markups
argc,argv = len(sys.argv),sys.argv

if argc > 3:
    sys.stderr.write("usage: %s [infile [outfile]]\n" % argv[0])

if argc > 2 and argv[2] != '-':
    out_file = open(argv[2],"w")
else:
    out_file = sys.stdout

if argc > 1 and argv[1] != '-':
    with open(sys.argv[1],"r") as f:
        in_text = f.read()
else:
    in_text = sys.stdin.read()
        
cm = markups.MarkdownMarkup().convert(in_text)
out_file.write(cm.get_whole_html())
------------------------------------------------------------------------



-- 
Grant Edwards               grant.b.edwards        Yow! Hold the MAYO & pass
                                  at               the COSMIC AWARENESS ...
                              gmail.com            


Reply via email to