instiki PDF export

atie의 이미지

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가 위의 샘플처럼 파싱을 제대로 못하는 듯 합니다.

혹시, 같은 문제를 해결하신 분이나 도움을 주실 분이 계신가요?

File attachments: 
첨부파일 크기
Image icon instiki-pdf.png183.06 KB
atie의 이미지

이런... :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

atie의 이미지

위의 oops... 수정을 하고, tex.rhtml을 이렇게 바꾼 후에

\documentclass{article}
\usepackage{hangul}
\begin{document}
\section{<%= @page.name %>}
<%= @tex_content %>
\end{document}

한글 문장 한 줄과 특수기호 없는 영문 문장 한 줄 만으로 테스트를 해보니 한글이 정상적으로 보이는 pdf가 생성이 되는군요. :D

이젠 tex가 어떻게 생성이 되는지 RedClothForTex을 들여다 봐야겠습니다. 그리고 시간이 나는대로 pdflatex가 포함된 소스들에 lambda와 dvipdfm을 곁들여 넣어나야 하겠고요.

----
I paint objects as I think them, not as I see them.
atie's minipage

atie의 이미지

조금 더 보고 있는데, 아무래도 RedCloth에서 나오는 tex를 손봐야 쓸만한 PDF를 얻을 수 있을 듯 합니다. 첨부 파일처럼 <pre></pre> 로 된 것은 인식을 못하고 #에 의해서 숫자를 매기는 중간 파일 (.tex)이 생성이 되는데... 더 손 보고자하면 어디를 기웃거려 봐야 할까요?

아니면, instiki에서는 pdflatex를 의도하였지만 html2pdf 같은 방법으로 ruby code를 손봐서 해결을 할 수도 있을까요?

댓글 첨부 파일: 
첨부파일 크기
Image icon 0바이트

----
I paint objects as I think them, not as I see them.
atie's minipage

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.