由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to convert zipped text files to a ePub
相关主题
请教MS的高手一个shell的问题php DOM parse 中文乱码问题 (转载)
node.js里面,哪些操作用http,哪些用websocket(tcp) ?Newbie javascript question: change radio button updates textbox message
how to decode these data from users' input at a web siteMySQL 存储 中文出现乱码,用的 hibernate
sucks (转载)吐槽 MySQL
怎样遍历一个字母的组合 (转载)Angular ng-include not working
同主题转寄 (转载)Angularjs ng-click redirect not working as expected
cookie的问题用react的试过中文么?
Marshal C++ struct to C# structremove a module from cvs
相关话题的讨论汇总
话题: html话题: epub话题: convert话题: echo话题: zipped
进入Programming版参与讨论
1 (共1页)
D****r
发帖数: 309
1
Cablire only convert 1 page, don't know why.
thanks in advacne!
t******n
发帖数: 138
2
试一试calibre。
epub是html文件的zip打包?

【在 D****r 的大作中提到】
: Cablire only convert 1 page, don't know why.
: thanks in advacne!

D****r
发帖数: 309
3
thanks.
I am already using calibre and the zipped package is all .txt files.
D****r
发帖数: 309
4
seems the problem lies in charset/ encoding.
D****r
发帖数: 309
5
我参考网上捣鼓了个小程序,请各位大侠指正:
我用的cygwin + iconv, ebook-convert.exe
先把zipped text file unzip to a directory.
------------
#!/bin/bash
# convert all txt files in current DIR into one ePub ---- by Donier
### Firstly convert all files into utf-8 charset ###
for f in *.txt
do
if test -f $f
then
echo -e "\nConverting $f"
CHARSET="$( file -bi "$f"|awk -F "=" '{print $2}')"
if [ "$CHARSET" != utf-8 ]
then
mv $f $f.old
iconv -f "$CHARSET" -t utf-8 $f.old > $f
# rm -f $f.old
fi
fi
done
### pack all text file into one html ####
html=output.html
echo "" > $html
echo "" >> $html
for file in *.txt ; do
echo "processing " $file " ... "
h1=$(echo $file | sed 's/\.txt$//i')
echo "

Part" $h1 "


" >> $html
while read line ; do
echo "$line
" >> $html
done < $file
done
echo "" >> $html
echo "" >> $html
### convert html into epub
ebook-convert.exe output.html output.epub
1 (共1页)
进入Programming版参与讨论
相关主题
remove a module from cvs怎样遍历一个字母的组合 (转载)
简单的perl问题同主题转寄 (转载)
问一个link的问题cookie的问题
how to convert GMT to timestamp of the computer's current timeMarshal C++ struct to C# struct
请教MS的高手一个shell的问题php DOM parse 中文乱码问题 (转载)
node.js里面,哪些操作用http,哪些用websocket(tcp) ?Newbie javascript question: change radio button updates textbox message
how to decode these data from users' input at a web siteMySQL 存储 中文出现乱码,用的 hibernate
sucks (转载)吐槽 MySQL
相关话题的讨论汇总
话题: html话题: epub话题: convert话题: echo话题: zipped