Permalink
Browse files

update

  • Loading branch information...
takahashim committed Dec 19, 2010
1 parent 4c125e9 commit be141f0fdabf32677ed548ca01497ae29b7d5fdf
Showing with 603 additions and 8 deletions.
  1. +1 −1 LICENSE
  2. +46 −3 README.rdoc
  3. +4 −3 Rakefile
  4. +46 −0 bin/a4r
  5. +505 −0 lib/aozora4reader.rb
  6. +1 −1 test/test_aozora4reader.rb
View
@@ -1,4 +1,4 @@
-Copyright (c) 2009 takahashim
+Copyright (c) 2010 takahashim
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,6 +1,46 @@
= aozora4reader
-Description goes here.
+aozora4reader is a tool to parse and convert documents in Aozora Bunko (http://www.aozora.gr.jp/).
+
+aozora4readerは青空文庫に蓄積された書籍を解析し、ソニーリーダー用のPDFを生成するためのツールです。
+現状はPRS-650 Touch Editionをターゲットとしています。
+また、PDFの生成にはLaTeXを利用しています。
+
+
+== Usage
+
+You can use a4r command to convert into LaTeX file.
+
+ $ a4r <aozora bunko file>
+
+ ex. a4r kokoro.txt
+
+You also can use -a option to generate PDF file.
+
+ ex. a4r -a kokoro.txt
+
+When using -a option, you need LaTeX environment and dvipdfmx.
+
+
+== Sources
+
+You can get source codes in GitHub.
+
+http://github.com/takahashim/aozora4reader
+
+
+== Special Thanks
+
+aozora4readerのコアの部分と、LaTeX用スタイルシートは、齋藤修三郎さんが作成した青空文庫パッケージが元になっています。
+
+ 「青空文庫を読もう!」 http://psitau.kitunebi.com/aozora.html
+
+また、そもそも開発の発端は、高山恭介さんが公開されている「青空キンドル」を参考にソニーリーダーに対応させたい、というものでした。高山さんが公開されているaz2tex.rb、kindleaozora.styも参考にしています。
+
+ 「青空キンドル [Beta]」 http://a2k.aill.org/
+
+この場を借りて斉藤さん、高山さんに御礼申し上げます。
+
== Note on Patches/Pull Requests
@@ -12,6 +52,9 @@ Description goes here.
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.
-== Copyright
+== Author
+
+Masayoshi Takahashi (@takahashim)
+ The core library and LaTeX style file are based on psitau's "aozora bunko package".
-Copyright (c) 2010 takahashim. See LICENSE for details.
+See LICENSE for details.
View
@@ -5,13 +5,14 @@ begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "aozora4reader"
- gem.summary = %Q{TODO: one-line summary of your gem}
- gem.description = %Q{TODO: longer description of your gem}
+ gem.summary = %Q{Aozora Bunko parser for Sony Reader}
+ gem.description = %Q{Aozora Bunko parser for Sony Reader}
gem.email = "maki@rubycolor.org"
gem.homepage = "http://github.com/takahashim/aozora4reader"
gem.authors = ["takahashim"]
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
+# gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+ gem.files.include << "data/gaiji.txt"
end
Jeweler::GemcutterTasks.new
rescue LoadError
View
46 bin/a4r
@@ -0,0 +1,46 @@
+#!/usr/bin/env ruby
+# encoding: utf-8
+
+require 'rubygems'
+require 'aozora4reader'
+require 'optparse'
+
+EBB = 'ebb'
+PLATEX = 'platex -interaction=nonstopmode'
+DVIPDFMX = 'dvipdfmx'
+
+def error_and_exit(msg)
+ STDERR.puts msg
+ exit
+end
+
+def usage()
+ error_and_exit "usage: a4r <srcfile>"
+end
+
+opt = OptionParser.new
+make_pdf = nil
+opt.on('-a', '--all', 'generate PDF') do
+ make_pdf = true
+end
+
+opt.parse!(ARGV)
+
+if ARGV.size != 1
+ usage
+end
+
+file = ARGV.shift
+if !File.exists? file
+ error_and_exit "No such file: #{file}"
+end
+
+Aozora4Reader.a4r(file)
+
+if make_pdf
+ system("#{EBB} *.png")
+ system("#{PLATEX} #{file.gsub(/.txt$/,'.tex')}")
+ system("#{DVIPDFMX} #{file.gsub(/.txt$/,'.dvi')}")
+end
+
+
Oops, something went wrong.

0 comments on commit be141f0

Please sign in to comment.