Write a Markdown - Latex converter The NetBSD Project
Status: Closed Time to complete: 192 hrs Mentors: Julian Coleman, Julian Fagir Tags: C, Latex, research, wiki, ui

This task is not strictly for NetBSD, but another project named libsoldout: http://fossil.instinctive.eu/libsoldout/index

libsoldout is a markdown converter written in C and published under public domain. Though there are already other tools which would do this task, they either have a licence that is not usable by NetBSD or have too many dependencies (like pandoc).
Your task is to write a converter from Markdown to Latex (or PDF, which might be a fairly large task and not suited for Code-In), which is just specifying some tags you use for inserting and putting it in C code.


You can take the html or the mdoc converter as a template for this:

http://fossil.instinctive.eu/libsoldout/artifact/fd100c723c722189d62fd9bf261d67db69240043 and http://fossil.instinctive.eu/libsoldout/artifact/1e22b7962dfba92c28f4916609746045dbe29a90 respectively. 

Though this task seems large, the task itself is rather small. You have to analyze the converters for mdoc and html and replace their tags by the appropriate Latex ones.
If you're not as good with Latex, feel free to ask for the tags that are to replace. Latex is not a strict prerequisite!

Uploaded Work
File name/URL File size Date submitted
mkd2latex.zip 4.5 KB November 27 2012 10:55 UTC
mkd2latex escapier.zip 4.6 KB November 28 2012 05:26 UTC
mkd2latex prolog epilog.zip 4.6 KB November 29 2012 05:08 UTC
Comments
fernozzle on November 27 2012 06:30 UTC Task Claimed

I would like to work on this task.

Aleksej Saushev on November 27 2012 08:22 UTC Task Assigned

This task has been assigned to fernozzle. You have 192 hours to complete this task, good luck!

fernozzle on November 27 2012 10:56 UTC Ready for review

The work on this task is ready to be reviewed.

Julian Coleman on November 27 2012 11:10 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

Julian Coleman on November 27 2012 11:20 UTC mkd2latex.zip needs more work

Hi,


I downloaded the zip and tried to build the prgram with:


  make -f BSDMakefile


However, it did not build.  Please could you include some instructions on how to build and run the program, and maybe also a small example file that it will convert?


Thanks,


J


 

Julian Fagir on November 27 2012 11:54 UTC It is a plugin

Hi,


this is a plugin for the libsoldout program. I will check this task later on.


Regards, Julian 

fernozzle on November 27 2012 14:52 UTC The zip only contains the files that I changed

Sorry, the zip only contains the files that I changed from those of libsoldout.

fernozzle on November 27 2012 17:01 UTC The changes that I made

Sorry, the changes that I mentioned are that I created mkd2latex.c and I added tgat it to the makefiles.

fernozzle on November 27 2012 17:07 UTC "tgat" (typo)

Whoops. "tgat" is supposed to be "that", and it's supposed to go before "added".

Julian Fagir on November 27 2012 17:35 UTC Very nice, just some small things

Hi,


actually, this is very nice. I didn't expect the task to be solved that fast and that nice!


There are just a few quirks:



  • Please document somewhere which packages are needed (e.g. hyperref must be included in the document)

  • Some characters must be escaped. I just tried a random document from the NetBSD wiki and there were several underscores and dollar signs which had to be escaped manually (I think this was inside a texttt environment).


Regards, Julian 

Julian Fagir on November 27 2012 17:46 UTC Noticing the author

Hi,


just one more task that would be nice: Contact the author of libsoldout with a link to this work, you can find her e-mail address and gpg key here:


    http://wwwkeys.pgp.net:11371/pks/lookup?op=index&search=0x69277CC1


I think she will be glad to see more projects spawning from her own one.


If you don't want to do so, but you permit others to use your code (I suppose so after the licence I read), I can do this as well. 


Regards, Julian 

fernozzle on November 27 2012 23:56 UTC How should I document which packages are needed?

Thanks.


How would you like me to document which packages are needed? I'm not sure where they shoud be documented.

fernozzle on November 28 2012 00:11 UTC *should

*should


Also, I do not want to contact her. I am a lowly student!

Julian Fagir on November 28 2012 00:14 UTC Documentation and contact

Hi,


if you do not want to contact her, that's not a problem. She will be poked to this program anyway.


If you don't need more than hyperref, you don't have to care for the documentation. Except for escaping invalid characters in environments as underscores and dollar signs, you're fine with your written program.


Regards, Julian 

fernozzle on November 28 2012 00:38 UTC graphicx package

I need to require the graphicx package for images!

fernozzle on November 28 2012 05:26 UTC Ready for review

The work on this task is ready to be reviewed.

fernozzle on November 28 2012 05:32 UTC New version, now with improved escaping

It's a little difficult for me to tell what rendering function's calling what  so that I don't escape characters multiple times — (and what LaTeX commands require escaping and what don't), but hopefully this new revision (named "mkd2latex escapier.zip") solves the problems of \texttt not being escaped.


Thanks!

Julian Fagir on November 28 2012 14:33 UTC Problems analyzed

Hi,


Ok, just two final things, then this task is done: 



  • please escape only in normal_text, code_block and code_span.



  • please create hooks for  building a whole latex document. The first to NULLs in the to_latex structure are for callbacks used for beginning and ending the document. This should be sufficient for the beginning:


\documentclass{article}
\usepackage{hyperref}


\usepackage{graphicx}
\begin{document}


and for the ending:


\end{document}


I contacted the original author about your plugin, and she agrees that it could be included in the official libsoldout repository. You won't have to maintain it, she would do so, but of course you could stay in touch with her if you're interested in the further development.


 


Though you might have spent much effort in this single task, it is a greatly appreciated one.


Regards, Julian 

fernozzle on November 29 2012 05:12 UTC New version, now with proper escaping and added hooks

Hi,


I've submitted a new version with the changes you requested.


Thanks for your help!

fernozzle on November 29 2012 06:45 UTC Claim Removed

The claim on this task has been removed, someone else can claim it now.

fernozzle on November 29 2012 06:45 UTC Task Claimed

I would like to work on this task.

fernozzle on November 29 2012 06:51 UTC Removing my claim on this task was an accident

My removal of my claim on this task was accidental. Sorry about that.

Aleksej Saushev on November 29 2012 09:44 UTC Task Assigned

This task has been assigned to fernozzle. You have 192 hours to complete this task, good luck!

fernozzle on November 29 2012 14:43 UTC Ready for review

The work on this task is ready to be reviewed.

Julian Fagir on November 30 2012 00:33 UTC Two minor quirks, but very good nonetheless

Ok, there are two minor quirks (there's no trailing newline, and escapes are still in the code part, though I think I asked for this). Anyway, you don't have to care for this anymore.


Thank you very much for this great work! We have several other Latex, Markdown and coding related tasks for NetBSD. If you are interested in this, you can look at these, maybe there's another one you want to claim. 

Julian Fagir on November 30 2012 00:33 UTC Task Closed

Congratulations, this task has been completed successfully.

Julian Fagir on December 3 2012 10:21 UTC Maybe another task?

We just created this task: http://www.google-melange.com/gci/task/view/google/gci2012/8015211


Maybe you want to have a look? It's the same as this one. Only this time, you have to write a markdown to terminal converter. This means you have to read a bit into curses and then use the bold, underline, italic characters in curses, and indentation.