minor refactoring
This commit is contained in:
parent
71a6cca8e0
commit
4f3780e167
1 changed files with 5 additions and 7 deletions
|
|
@ -4,11 +4,10 @@ import os, osproc, strutils, parseopt
|
|||
import jester
|
||||
import argparse
|
||||
|
||||
proc getContent(pad:string, etherpadUrl:string):string =
|
||||
proc getContent(pad:string, etherpadUrl:string): string =
|
||||
var client = newHTTPClient()
|
||||
result = client.getContent(etherpadUrl & "p/" & pad & "/export/txt")
|
||||
|
||||
|
||||
when isMainModule:
|
||||
var p = newParser("etherpad2latex"):
|
||||
help("Compiles etherpad pads to pdf")
|
||||
|
|
@ -21,11 +20,10 @@ when isMainModule:
|
|||
get "/@pad":
|
||||
let
|
||||
pad = @"pad"
|
||||
content = getContent(pad, opts.etherpadaddress)
|
||||
texFile = open(pad & ".tex", fmWrite)
|
||||
|
||||
texFile.write(content)
|
||||
texFile.close()
|
||||
etherpadUrl = opts.etherpadAddress
|
||||
content = getContent(pad, etherpadUrl)
|
||||
|
||||
writeFile(pad & ".tex", content)
|
||||
|
||||
let (output, exitCode) = execCmdEx(quoteShellCommand(["pdflatex", "-halt-on-error", pad & ".tex"]))
|
||||
if exitCode == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue