Docverter / docverter

Docverter Server
Other
831 stars 100 forks source link

Options without values, like "smart" or "table_of_contents," fail #17

Closed wcaleb closed 10 years ago

wcaleb commented 11 years ago

I have been unable to get Docverter to accept requests that include options such as smart and table_of_contents that have no values other than "true" or "false."

For example, this command

  curl http://c.docverter.com/convert -F from=markdown -F to=pdf -F smart=true -F input_files[]=@input.txt

returns the errors contained in this gist.

I have tried the same command with different to= values and different input files, as well as true/false options other than smart=, and it looks like I get the same result.

I'm testing this on Mac OSX Lion.

chrisvfritz commented 11 years ago

I'm also experiencing this problem in Ruby:

Docverter::Conversion.run do |c|
      c.from    = "markdown"
      c.to      = "#{params[:download_type]}"
      c.content = params[:included_chapters].split(',').map {|id| Chapter.find(id.to_i).content}.join("\n\n")
      c.table_of_contents
end

I've also tried the variations mentioned by the first poster. No luck.

jldiaz commented 11 years ago

Also hit this bug, and it is a real problem for me because most of my markdown documents are utf-8, and they cannot be converted to pdf (utf-8 chars are dropped, see this question in Stack Overflow for example), unless the option --ascii is passed to pandoc which is not possible because it is a boolean option and those options seem to be broken.

peterkeen commented 11 years ago

This is fixed in v1.0.3 which is running on c.docverter.com. Using the Docverter API you'd do this:

Docverter::Conversion.run do |c|
      c.from    = "markdown"
      c.to      = "#{params[:download_type]}"
      c.content = params[:included_chapters].split(',').map {|id| Chapter.find(id.to_i).content}.join("\n\n")
      c.table_of_contents = true
end

Using curl you'd say -F table_of_contents=true.

Please comment here if you have any more problems getting it to work. I'll close the issue in a few days if everything's cool.

jldiaz commented 11 years ago

Thank you very much! I can confirm that ascii option is working now (tested from python, using httplib).

wcaleb commented 11 years ago

Thanks for fixing this! I tested the "smart" option with my Pythonista script and it worked great!