Trac에서 TracWikiPrint 사용시 한글 출력하기

다즐링의 이미지

학교프로젝트관리용으로 Trac를 사용중입니다만

문서 제출용으로 hwp 나 pdf를 요구받았습니다.
당연히 pdf로 하겠다고 하고 나서 trac을 도입하니 pdf를 만들기가 다시 귀찬아졌습니다.

구글에 검색해보니 TracWikiPrint 라는 플러그인이 있더군요.

읽어보시면 알겠지만 몇가지 디펜던시가 있습니다. 일단 대충 깔고 보니..

한글이 출력이 안되고 네모로 나오는 것입니다.

안될꺼라는 이야기를 좀 들었지만 검색해보니 xhtml2pdf라는걸 쓰는데 xhtml로 출력해보니 한글형태가 잘 나오는데 안되는것이 이상했습니다.
결론은 폰트를 임베딩 해줘야 하더군요.

일단 써버에 은폰트를 깔았습니다.

그리고 tracwikiprintplugin/0.11/wikiprint/defaults.py 를 수정합니다.

기존에는 font-family 가 Helvetica로 나옵니다. 은돋움으로 바꾸어줬습니다.

CSS = """
 
html {
    font-family: Helvetica;
    font-size: 10px;

수정후

CSS = """
 
@font-face {
  font-family: UnDotum , "UnDotum";
  src: url(/usr/share/fonts/truetype/unfonts/UnBatang.ttf);
}
html {
    font-family: UnDotum ,  Dotum, Verdana, AppleGothic, Sans-serif, Helvetica;
    font-size: 10px;

매우 잘 나옵니다. css수정으로 뭔가 규격은 맞추어야겠지만 위키작성문서를 바로 pdf로 변환하여 배포가 가능하게되었습니다.
( 보고서낼때 쉽겠군요 )

댓글

auditory의 이미지

trac wiki를 한글 pdf로 만드는걸 시도하다가 포기했었는데,
좋은정보 감사합니다..

그런데 저는 TracPrintWiki 이 설치가 안되네요.. 설치해도 admin에서 안보여요..

혹시 dependency를 설치하는데 문제는 없으셨는지요?
reportLab도 따로 설치해야하고, 설치할때 gcc에러도 나고
easy_install 로 설치한 egg파일의 퍼미션도 문제가 되는것 같고,
PIL은 다른 이름으로 설치를 해야하고.. (Imaging?)

등등 여러문제가 있던데요.. 어찌어찌 다 설치는 했는데,
admin에서는 계속 안보이네요..

다즐링의 이미지

trac.ini 에서 설정해주셔야하고...
.egg 때문에 아파치에러로그를 보면서 디버깅해야합니다 ㅎㅎ

------------------------------------------------------------------------------------------------
Life is in 다즐링

------------------------------------------------------------------------------------------------
Life is in 다즐링

auditory의 이미지


플러그인 설치 자체가 좀 어렵네요...

default.py파일은 어디에 두는건지 잘 모르겠네요..
여러가지 방법으로 설치를 해봤는데, 결국

TracWikiPrintPlugin-1.6-py2.6.egg

파일만 카피되던데요..

다즐링의 이미지

python setup.py install 을 실행하면 egg로 만들어집니다.

즉 소스에서 고치고 재설치를 하면 됩니다.

------------------------------------------------------------------------------------------------
Life is in 다즐링

------------------------------------------------------------------------------------------------
Life is in 다즐링

academic의 이미지

안타깝게 0.11 버전용이군요.

한글화 때문에 0.10 버전을 그대로 사용하고 있는지라...

0.12 버전이 정식 배포된 후에 한번 적용해보겠습니다.

--
academic은 제 고등학교 때 동아리 이름입니다.
academic, 아주 가끔은 저도 이랬으면 좋겠습니다.

----
academic은 제 고등학교 때 동아리 이름입니다.
academic, 아주 가끔은 저도 이랬으면 좋겠습니다.

다즐링의 이미지

0.12가 언제 나올런지;;;

그냥 0.11이 현재는 최선인듯합니다.

------------------------------------------------------------------------------------------------
Life is in 다즐링

------------------------------------------------------------------------------------------------
Life is in 다즐링

auditory의 이미지

설치는 잘 끝난것 같은데, plugin이 계속 안보이면
어떻게 문제를 해결해야하나요?
apache error로그에도 아무것도 안나옵니다.

설치후 apache 서비스는 다시 시작했고,
trac.ini 설정은 wikiprint.* = enabled 만 추가했습니다..
파일퍼미션은 아래와 같이 조절했습니다.

# pwd
/usr/local/lib/python2.6/dist-packages
# # ls -l
total 580
-rw-r--r-- 1 root staff    437 2009-10-07 14:27 easy-install.pth
-rw-r--r-- 1 root root  229338 2009-10-07 14:27 Genshi-0.5.1-py2.6-linux-i686.egg
-rw-r--r-- 1 root root  223137 2009-10-07 10:45 html5lib-0.11.1-py2.6.egg
drwxr-sr-x 3 root staff  12288 2009-10-07 10:34 PIL-1.1.6-py2.6-linux-i686.egg
drwxr-sr-x 5 root staff   4096 2009-08-07 16:15 pisa-3.0.32-py2.6.egg
drwxr-sr-x 4 root staff   4096 2009-08-07 16:35 Pygments-1.0-py2.6.egg
-rw-r--r-- 1 root root   64334 2009-10-07 10:45 pyPdf-1.12-py2.6.egg
drwxr-sr-x 4 root staff   4096 2009-05-28 14:43 scikits.audiolab-0.10.2-py2.6-linux-i686.egg
-rw------- 1 root staff     33 2009-10-07 14:34 setuptools.pth
-rw-r--r-- 1 root staff  26452 2009-10-07 14:34 TracWikiPrintPlugin-1.6-py2.6.egg

설치로그는 아래와 같습니다.

Removing /usr/local/lib/python2.6/dist-packages/TracWikiPrintPlugin-1.6-py2.6.egg
Copying TracWikiPrintPlugin-1.6-py2.6.egg to /usr/local/lib/python2.6/dist-packages
TracWikiPrintPlugin 1.6 is already the active version in easy-install.pth
 
Installed /usr/local/lib/python2.6/dist-packages/TracWikiPrintPlugin-1.6-py2.6.egg
Processing dependencies for TracWikiPrintPlugin==1.6
Searching for reportlab==2.3
Best match: reportlab 2.3
Adding reportlab 2.3 to easy-install.pth file
 
Using /usr/lib/python2.6/dist-packages
Searching for html5lib==0.11.1
Best match: html5lib 0.11.1
Processing html5lib-0.11.1-py2.6.egg
html5lib 0.11.1 is already the active version in easy-install.pth
 
Using /usr/local/lib/python2.6/dist-packages/html5lib-0.11.1-py2.6.egg
Searching for PIL==1.1.6
Best match: PIL 1.1.6
Processing PIL-1.1.6-py2.6-linux-i686.egg
PIL 1.1.6 is already the active version in easy-install.pth
Installing pilfile.py script to /usr/local/bin
Installing pilprint.py script to /usr/local/bin
Installing pilfont.py script to /usr/local/bin
Installing pilconvert.py script to /usr/local/bin
Installing pildriver.py script to /usr/local/bin
 
Using /usr/local/lib/python2.6/dist-packages/PIL-1.1.6-py2.6-linux-i686.egg
Searching for pisa==3.0.32
Best match: pisa 3.0.32
Processing pisa-3.0.32-py2.6.egg
pisa 3.0.32 is already the active version in easy-install.pth
Installing pisa script to /usr/local/bin
Installing xhtml2pdf script to /usr/local/bin
 
Using /usr/local/lib/python2.6/dist-packages/pisa-3.0.32-py2.6.egg
Searching for Trac==0.11.1
Best match: Trac 0.11.1
Adding Trac 0.11.1 to easy-install.pth file
Installing trac-admin script to /usr/local/bin
Installing tracd script to /usr/local/bin
 
Using /usr/lib/python2.6/dist-packages
Searching for Genshi==0.5.1
Best match: Genshi 0.5.1
Processing Genshi-0.5.1-py2.6-linux-i686.egg
Genshi 0.5.1 is already the active version in easy-install.pth
 
Using /usr/local/lib/python2.6/dist-packages/Genshi-0.5.1-py2.6-linux-i686.egg
Searching for setuptools==0.6c9
Best match: setuptools 0.6c9
Adding setuptools 0.6c9 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.5 script to /usr/local/bin
Installing easy_install-2.6 script to /usr/local/bin
 
Using /usr/lib/python2.6/dist-packages
Finished processing dependencies for TracWikiPrintPlugin==1.6
다즐링의 이미지

신기하네요.

위키페이지 하단에

Download in other formats:
 
    * Plain Text
    * PDF Article
    * PDF Book
    * Printable HTML

이런게 안뜨나요?

------------------------------------------------------------------------------------------------
Life is in 다즐링

------------------------------------------------------------------------------------------------
Life is in 다즐링

auditory의 이미지

어찌어찌하여 설치에 성공했습니다.
퍼미션 문제였습니다. 서브 디렉토리에 o+x가 빠져있어서 다른 파일들을 읽지를 못하고 있었습니다.

그런데, 저는 한글이 안나오네요..
네모가 아니라 물음표로 나옵니다..
printable html에서도 똑같이 물음표로 나오고요..
다른 설정이 있을까요??

다즐링의 이미지

로케일이 한글인지 확인해보세요. ko_KR.UTF-8

------------------------------------------------------------------------------------------------
Life is in 다즐링

------------------------------------------------------------------------------------------------
Life is in 다즐링

auditory의 이미지

설치할때부터 주로 en_US.UTF-8을 씁니다.
아마 이 문제일듯 싶군요.
그런데 이경우 누구의 로케일을 바꿔야 하는건가요?
루트? 아니면 www-data?
아니면 /etc/environment 파일을 수정해서
시스템 와이드하게 바꿔야하나요?
--
/etc/environment수정하고,
메뉴에서도 Language Support 수정해서
ko_KR.UTF-8 이 되도록 고쳤는데도 여전히 그러네요..

이게 되면 참 좋을텐데요...

다즐링의 이미지

trac 을 어떻게 돌리시는지에 따라 다르겠지만..

trac 이 도는 instance 만 로케일이 맞으면 될듯하네요.

아파치에 돌리신다면 아파치만 바꾸면 되겠죠.

------------------------------------------------------------------------------------------------
Life is in 다즐링

------------------------------------------------------------------------------------------------
Life is in 다즐링

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.