New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to pass generic Pandoc options in Rules #526

Closed
ddfreyne opened this Issue Jan 31, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@ddfreyne
Member

ddfreyne commented Jan 31, 2015

It is impossible to pass these options to Pandoc in the Rules file:

:s, {:f => :markdown, :to => :html}, 'no-wrap', :toc
@ghiknt

This comment has been minimized.

Show comment
Hide comment
@ghiknt

ghiknt Jan 31, 2015

After further experiment it is also impossible to pass options twice (e.g. --filter). Since the last one is all that is kept in the hash. Temporally worked around by adapting test case to filter wrapper:

class PandocCommandLine < Nanoc::Filter
  identifier :pandoc_commandline
  type :text
  def run(content, params={})
   filter = ::Nanoc::Filters::Pandoc.new
   filter.setup_and_run(content, *params[:args])
  end
end

Which is called by Rules file.

opts = ['table-of-contents', {:to => :html5, 'base-header-level' => 2}, {:filter =>'pandoc-zotxt'}, {:filter => 'pandoc-citeproc'}]
filter :pandoc_commandline, :args => opts 
  • Note table-of-contents is not a good one to use for testing though since it only gets rendered in latest pandoc when --standalone is specified.

ghiknt commented Jan 31, 2015

After further experiment it is also impossible to pass options twice (e.g. --filter). Since the last one is all that is kept in the hash. Temporally worked around by adapting test case to filter wrapper:

class PandocCommandLine < Nanoc::Filter
  identifier :pandoc_commandline
  type :text
  def run(content, params={})
   filter = ::Nanoc::Filters::Pandoc.new
   filter.setup_and_run(content, *params[:args])
  end
end

Which is called by Rules file.

opts = ['table-of-contents', {:to => :html5, 'base-header-level' => 2}, {:filter =>'pandoc-zotxt'}, {:filter => 'pandoc-citeproc'}]
filter :pandoc_commandline, :args => opts 
  • Note table-of-contents is not a good one to use for testing though since it only gets rendered in latest pandoc when --standalone is specified.
@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 7, 2015

Member

Yeah, I feel that the only solution to this would be to introduce an arbitrary :args param, as you suggested. I think I’ll fix it like that; there’ll be a PR incoming soon.

Member

ddfreyne commented Feb 7, 2015

Yeah, I feel that the only solution to this would be to introduce an arbitrary :args param, as you suggested. I think I’ll fix it like that; there’ll be a PR incoming soon.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 21, 2015

Member

Potential fix in #535.

Member

ddfreyne commented Feb 21, 2015

Potential fix in #535.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Mar 7, 2015

Member

Fixed by #535.

Member

ddfreyne commented Mar 7, 2015

Fixed by #535.

@ddfreyne ddfreyne closed this Mar 7, 2015

@ddfreyne ddfreyne added this to the 3.7.6 milestone Apr 19, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment