matze / jekyll-ditaa

Jekyll ditaa Plugin
MIT License
29 stars 9 forks source link

As of last commit, jekyll serve fails when using {% ditaa %} without an --alt something #9

Closed grepsuzette closed 1 year ago

grepsuzette commented 6 years ago

As of last commit, jekyll serve fails when using {% ditaa %} without an --alt something:

      Generating...
  Liquid Exception: no implicit conversion of nil into String in
/home/perez/code/n.net/_posts/2017-07-21-larmiche.markdown
/home/perez/code/n.net/_plugins/jekyll-ditaa/ditaa.rb:97:in
`+': no implicit conversion of nil into String (TypeError)
        from
/home/perez/code/n.net/_plugins/jekyll-ditaa/ditaa.rb:97:in
`render''

The fix so trivial, I'd rather not bother you with a pull request.

In ditaa.rb line 30:

        if @ditaa_options.include? "--alt"
          @alt_text = @ditaa_options.scan(/--alt "([^"]*)"/).last.first
          @ditaa_options = @ditaa_options.sub /--alt "([">]*)"/, ''
        end

My suggestion is to just add else @alt_text = "" and it fixes the bug.