Skip to content

Instantly share code, notes, and snippets.

@kmuto
Last active February 2, 2020 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmuto/556a3dbcf8f3ee7d885767ca0556cdd0 to your computer and use it in GitHub Desktop.
Save kmuto/556a3dbcf8f3ee7d885767ca0556cdd0 to your computer and use it in GitHub Desktop.
dtのfootnoteの特例
module ReVIEW
module CompilerOverride
def compile_dlist(f)
@strategy.dl_begin
while /\A\s*:/ =~ f.peek
if @strategy.class.to_s =~ /LATEX/
s = f.gets
@strategy.dt(s.sub(/\A\s*:/, '').strip)
else
@strategy.dt(text(f.gets.sub(/\A\s*:/, '').strip))
end
desc = f.break(/\A(\S|\s*:|\s+\d+\.\s|\s+\*\s)/).map { |line| text(line.strip) }
@strategy.dd(desc)
f.skip_blank_lines
f.skip_comment_lines
end
@strategy.dl_end
end
end
class Compiler
prepend CompilerOverride
end
module LATEXBuilderOverride
def dt(str)
str.sub!(/\[/) { '\lbrack{}' }
str.sub!(/\]/) { '\rbrack{}' }
@doc_status[:caption] = true
puts '\item[' + compile_inline(str) + '] \mbox{} \\\\'
@doc_status[:caption] = nil
end
end
class LATEXBuilder
prepend LATEXBuilderOverride
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment