instiki PDF export
http://bbs.kldp.org/viewtopic.php?t=54753에 있는대로 instiki에서 PDF 출력을 할 수 있도록 해보고 있습니다.
tex를 고치는 것은 instiki/app/views/wiki/tex.rhtml를 아래처럼 수정을 했고,
\documentclass{article} \usepackage[hangul] %------------------------------------------------------------------- \begin{document} %------------------------------------------------------------------- \section*{<%= @page.name %>} <%= @tex_content %> \end{document}
tex to pdf는 instiki/app/controllers/wiki_controller.rb에 convert_tex_to_pdf는 주석처리하고, convert_tex_to_dvi와 convert_dvi_to_pdf를 대신에 넣어 보았습니다.
# convert_tex_to_pdf("#{file_path}.tex") convert_tex_to_dvi("#{file_path}.tex") convert_dvi_to_tex("#{file_path}.dvi")
def convert_tex_to_dvi(tex_path) # TODO remove earlier DVI files with the same prefix # TODO handle gracefully situation where lambda is not available begin wd = Dir.getwd Dir.chdir(File.dirname(tex_path)) logger.info `lambda #{File.basename(tex_path)}` ensure Dir.chdir(wd) end end def convert_dvi_to_pdf(dvi_path) # TODO remove earlier PDF files with the same prefix # TODO handle gracefully situation where dvipdfm is not available begin wd = Dir.getwd Dir.chdir(File.dirname(dvi_path)) logger.info `dvipdfm #{File.basename(dvi_path)}` ensure Dir.chdir(wd) end end
그런데, 잘 안되는군요. 위처럼 해서 Sample로 생성된 tex가
\documentclass{article} \usepackage[hangul] %------------------------------------------------------------------- \begin{document} %------------------------------------------------------------------- \section*{HomePage} devInstiki from rubyspace/instiki 한글 테스트\\rubyspace/instiki/app/views/wiki/tex.rhtml\\ rubyspace/instiki/app/controllers/wiki\_controller.rb\\convert\_tex\_to\_dvi("#{file\_path}.tex")\\convert\_dvi\_to\_tex("#{file\_path}.dvi") [ViewCVS] \end{document}
인데, 아무래도
def tex @tex_content = RedClothForTex.new(@page.content).to_tex end에서 생성되는 tex가 위의 샘플처럼 파싱을 제대로 못하는 듯 합니다.
혹시, 같은 문제를 해결하신 분이나 도움을 주실 분이 계신가요?
첨부 | 파일 크기 |
---|---|
![]() | 183.06 KB |
oops...
이런... :oops:
\usepackage[hangul]
를
\usepackage{hangul}
로 해서 manual로 일단 해보고 있습니다.
convert_dvi_to_tex("#{file_path}.dvi")
는
convert_dvi_to_pdf("#{file_path}.dvi")
가 되야 하고요.
----
I paint objects as I think them, not as I see them.
atie's minipage
자답입니다.
위의 oops... 수정을 하고, tex.rhtml을 이렇게 바꾼 후에
한글 문장 한 줄과 특수기호 없는 영문 문장 한 줄 만으로 테스트를 해보니 한글이 정상적으로 보이는 pdf가 생성이 되는군요. :D
이젠 tex가 어떻게 생성이 되는지 RedClothForTex을 들여다 봐야겠습니다. 그리고 시간이 나는대로 pdflatex가 포함된 소스들에 lambda와 dvipdfm을 곁들여 넣어나야 하겠고요.
----
I paint objects as I think them, not as I see them.
atie's minipage
조금 더 보고 있는데, 아무래도 RedCloth에서 나오는 tex를 손봐
조금 더 보고 있는데, 아무래도 RedCloth에서 나오는 tex를 손봐야 쓸만한 PDF를 얻을 수 있을 듯 합니다. 첨부 파일처럼 <pre></pre> 로 된 것은 인식을 못하고 #에 의해서 숫자를 매기는 중간 파일 (.tex)이 생성이 되는데... 더 손 보고자하면 어디를 기웃거려 봐야 할까요?
아니면, instiki에서는 pdflatex를 의도하였지만 html2pdf 같은 방법으로 ruby code를 손봐서 해결을 할 수도 있을까요?
----
I paint objects as I think them, not as I see them.
atie's minipage
댓글 달기