Skip to content

Commit

Permalink
return div not nil for non-qualifying latex div
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Dec 21, 2020
1 parent 62ae2ed commit 225ecb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inst/rmarkdown/lua/latex-div.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Div = function (div)
options = div.attributes['data-latex']
end
if not options or #div.attr.classes == 0 then
return nil
return div
end

-- if the output format is not latex, remove the attr and return
Expand Down

2 comments on commit 225ecb7

@cderv
Copy link
Collaborator

@cderv cderv commented on 225ecb7 Dec 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjallaire For my understanding and better knowledge for next Lua filters I'll write, Did you encounter any any issue with returning nil ?
From Pandoc Lua filter docs, returning nil means that the object should remain unchanged. It seems ok to use it this filter.
Returning div will have the same result as it is passed unchanged, I am just curious to better understand what motivated the change. Thanks!

@jjallaire
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are indeed correct! I had another filter where the nil yielded a problem, but only because I had a helper function that chained together a set of filters so they could operate in a single pass (so the nil return ended up getting passed to the next filter in the chain). Thanks for pointing this out -- I will update my chain implementation and I will revert this fix.

Please sign in to comment.