본문 바로가기
OldStory/Home Linux

feed2html.py feed-to-HTML converter in Python

by Alnilam 2013. 10. 2.


feed2html.py를 사용하면 RSS/RDF/Atom feed를 HTML문서로 변화 할 수 있다.


Using feed2html.py from the command line:

% feed2html.py -h
Usage:
    feed2html.py [options]

Options:
    -D var=val  Define variable equals to value.
    -h          Display this help message.
    -i input    Feed input. It can be an URL, a local file name, or '-' for
                standard input. (Default standard input)
    -o output   HTML output. It can be a local file name, or '-' for standard
                output. (Default standard output)
    -t tplfile  Template file name. If omitted, default template will be used.

For example, downloading the latest news for nerds from Slashdot:

% feed2html.py -i http://slashdot.org/index.rss > slashdot.html


Template 파일를 만들어 추가 하면 template에 맞게 페이지를 구성 할 수 있다.

다음은 본문(content)를 template에 추가하는 경우 tag 사용 법이다. 

<tpl:contents>
<div class="content"><tpl:content value="value" filter="nl2br"/> </div>
</tpl:contents>


이 때 본문(content)이 HTML로 쓰여지지 않은 경우  개행문자(\n)를 <p> 와 <br>로 변경 해주 는 필터(filter="nl2br") 를 추가 해야 한다. 그렇지 않으면 개행문자가 무시 되어 문자들이 붙어서 표시 되어 보기 안좋은 문제가 있다!!!


http://scott.yang.id.au/2005/05/feed2html/


'OldStory > Home Linux' 카테고리의 다른 글

nl2br filter  (0) 2013.10.02
Python feedparser  (0) 2013.10.01
How to Set Up a Minecraft Server on Linux  (0) 2013.01.25
서버교체  (0) 2013.01.22
USB Smart Card Reader OMNIKEY 3201  (0) 2013.01.18