Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Can I add a button to each wiki page in ikiwiki which launches an external application (on the client side) or script with the markdown code of the current page as input?

Edit: I didn't realize that it might be complicated to do it on client side as Zenklys' answer suggested. So perhaps I should describe more concretely what I have in mind:

I want to have two buttons:

  1. "Get LaTeX" and 2. "Get pdf".

Clicking on "Get LaTeX should generate a LaTeX file and the browser should simply open or download that file. Analogously for the pdf.

It would even be ok, to have a button "Generate LaTeX" instead, which generates the LaTeX code and changes after the generation to "Get LaTeX" which simply points to the LaTeX file.

So it is not really necessary to do the generation of the files on client side. Would be ok, if this is done (on a temporary folder) on server side.

For the LaTeX resp. pdf generation I want to use a custom wrapper script for pandoc, let's call it mymarkdown2latex resp. mymarkdown2pdf.

share|improve this question
add comment

2 Answers 2

That is actually pretty difficult. All you can do is include links. Links can have certain protocols. For example when printing a http://www.whateverlink.com, your operating system is configured to open those with a web browser.

When using ftp:// for example, it will try to open the link with a ftp client. You can try to use a protocol used for markdown edition, but I doubt you'll find any standard for that.

share|improve this answer
add comment

How difficult this is would depend on what technologies you are using server-side and how readily available you can find existing code to convert HTML to LaTeX and PDF. However this should be a server-side thing, and shouldn't even be necessary to write to disk (temporary file like you say) unless you cared about caching. The links should point to server-side scripts that will convert the Markdown to HTML (assuming it's easier to convert to/from HTML than to/from Markdown directly) and then to either LaTeX or PDF and return the response using a header that will trigger download in the browser, such as:

Content-disposition: attachment; filename=your_page.tex

Edit: Looks like ikiwiki uses PERL. Here are some resources using that language:

share|improve this answer
    
To convert markdown to latex, I wanted to use pandoc. I don't want to convert from html because from markdown it seems to be cleaner, it contains everything about the document structure and nothing else... –  student Feb 21 '12 at 9:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.