Giter Club home page Giter Club logo

html2odt's People

Contributors

jkraemer avatar meineerde avatar schmidt avatar thegcat avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html2odt's Issues

Which ruby version is needed?

If i run it, this error apperas:
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in require': /usr/local/rvm/gems/ruby-1.9.3-p551/gems/html2odt-0.3.3/lib/html2odt/document.rb:17: syntax error, unexpected tLABEL, expecting ')' (SyntaxError) def initialize(template: Html2Odt::ODT_TEMPLATE, html: nil) ^ /usr/local/rvm/gems/ruby-1.9.3-p551/gems/html2odt-0.3.3/lib/html2odt/document.rb:17: dynamic constant assignment def initialize(template: Html2Odt::ODT_TEMPLATE, html: nil) ^ /usr/local/rvm/gems/ruby-1.9.3-p551/gems/html2odt-0.3.3/lib/html2odt/document.rb:17: syntax error, unexpected tLABEL, expecting '=' def initialize(template: Html2Odt::ODT_TEMPLATE, html: nil) ^ /usr/local/rvm/gems/ruby-1.9.3-p551/gems/html2odt-0.3.3/lib/html2odt/document.rb:423: syntax error, unexpected keyword_end, expecting $end from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /usr/local/rvm/gems/ruby-1.9.3-p551/gems/html2odt-0.3.3/lib/html2odt.rb:16:in <top (required)>' from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in require' from /usr/local/rvm/gems/ruby-1.9.3-p551/gems/html2odt-0.3.3/bin/html2odt.rb:4:in<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p551/bin/html2odt.rb:23:in load' from /usr/local/rvm/gems/ruby-1.9.3-p551/bin/html2odt.rb:23:in

'
from /usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in eval' from /usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in'

Is there any solution for that?

Encoding::UndefinedConversionError ("\xC6" from ASCII-8BIT to UTF-8):

running html2odt.rb in mac-os terminal works fine :
$ html2odt.rb -i input.html -o output.odt
Wrote document to: output.odt

when I run it in a rails controller I get the encoding error
doc = Html2Odt::Document.new
doc.html= @content_page.content
doc.write_to "#{ @content_page.title}.odt"

changing the File.write mode in the gems document.rb to wb solves the error :
def write_to(path)
File.write(path, data, mode: "wb" )
end

Is there another way to solve this?

images from active storage redirect

The images uploaded to active storage have an url containing a redirect :
"/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBNQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--9f786814030d4f67f566db1f3e05d3d1beb1f7d8/zot.jpeg"

This can be solved with the following change in document.rb to get the url :

  def uri_to_file(uri)
    Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
      resp = http.get(uri)
      if resp.is_a?(Net::HTTPRedirection)
          redirect_uri = URI.parse(resp['location'])
          resp= http.get(redirect_uri)
      end
      return nil unless resp.is_a?(Net::HTTPSuccess)

      file = Tempfile.new("html2odt")
      file.binmode

      file.write(resp.body)
      file.flush

      file
    end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.