Skip to content

Instantly share code, notes, and snippets.

Avatar

Masayoshi Takahashi takahashim

View GitHub Profile
View review-new-syntax.md

#Re:VIEWの構文拡張について

Re:VIEWではブロックの構文が拡張されることになりました。一部非互換があります。

旧ルールでは以下のように記述していたものが、

//foo[bar][buz][baa]{
//}
@takahashim
takahashim / sigil2.diff
Created Mar 15, 2014
SigilでEPUB3を開いて保存しても壊さないようにするpatchその2 (※Preferece->Clean SourceでOpenもSaveもチェックを外しておくこと)
View sigil2.diff
$ git diff
diff --git a/src/Sigil/ResourceObjects/OPFResource.cpp b/src/Sigil/ResourceObjects/OPFResource.cpp
index bfb11e9..1918925 100644
--- a/src/Sigil/ResourceObjects/OPFResource.cpp
+++ b/src/Sigil/ResourceObjects/OPFResource.cpp
@@ -1196,8 +1196,9 @@ void OPFResource::AddModificationDateMeta()
XhtmlDoc::GetTagMatchingDescendants(*document, "date", DUBLIN_CORE_NS);
foreach(xc::DOMElement * meta, metas) {
QString name = XtoQ(meta->getAttribute(QtoX("opf:event")));
+ QString epub_version = GetEpubVersion(*document);
@takahashim
takahashim / sigil.diff
Created Mar 15, 2014
SigilでEPUB3を開いて保存しても壊さないようにするpatch (※Preferece->Clean SourceでOpenもSaveもチェックを外しておくこと)
View sigil.diff
$ git diff
diff --git a/src/Sigil/Exporters/ExportEPUB.cpp b/src/Sigil/Exporters/ExportEPUB.cpp
index 72d5f80..6ad2128 100644
--- a/src/Sigil/Exporters/ExportEPUB.cpp
+++ b/src/Sigil/Exporters/ExportEPUB.cpp
@@ -92,7 +92,7 @@ void ExportEPUB::WriteBook()
}
m_Book->GetOPF().AddSigilVersionMeta();
- m_Book->GetOPF().AddModificationDateMeta();
View review-epubmaker.diff
diff --git a/bin/review-epubmaker b/bin/review-epubmaker
index 8b7a06d..99f782d 100755
--- a/bin/review-epubmaker
+++ b/bin/review-epubmaker
@@ -98,15 +98,17 @@ def main
end
if File.exist?("images")
+ allow_exts = %w(png gif jpg jpeg svg ttf woff otf)
Dir.mkdir("#{@bookdir}/OEBPS/images")
View irb-session.sh
$ irb -f
irb(main):001:0> require 'irb/completion'
=> true
irb(main):002:0> require 'epub/parser'
=> true
irb(main):003:0> book = EPUB::Parser.parse("ondeck_w100.epub")
=> #<EPUB::Book:0x007f819d8d8648 @epub_file="/Users/maki/tmp/ondeck_w100.epub", @ocf=#<EPUB::OCF:0x007f819d8d85a8 @container=#<EPUB::OCF::Container:0x007f819d8d8418 @rootfiles=[#<EPUB::OCF::Container::Rootfile:0x007f819d2b3d58 @full_path=#<Addressable::URI:0x3fc0ce959d6c URI:OEBPS/media.opf>, @media_type="application/oebps-package+xml">]>, @book=#<EPUB::Book:0x007f819d8d8648 ...>>, @package=#<EPUB::Publication::Package:7f819d2b3100 @prefix={} @version="3.0" @xml_lang=nil @dir=nil @id=nil @book=#<EPUB::Book:0x007f819d8d8648 ...> @metadata=#<EPUB::Publication::Package::Metadata:7f819d2b28b8> @manifest=#<EPUB::Publication::Package::Manifest:7f819d2c29c0> @spine=#<EPUB::Publication::Package::Spine:7f819d2eb3e8> @guide=#<EPUB::Publication::Package::Guide:7f819d2e89e0> @bindings=#<EPUB::Publication::Package::Bindings:7f819d2e8490>>>
irb(main):004:0>
View test.rb
class Task
def initialize
end
def fake_result(stat)
@stat = stat
end
def run(args)
if @stat
View xml-output.md

XML output

The new -out argument can be used to output a xml file containing some information extracted from the input EPUB file.

Calling java -jar epubcheck-3.0.1.jar -out output.xml file.epub will generate the file output.xml containing information on the file.epub.

The output file uses the jhove schema (available at http://hul.harvard.edu/ois/xml/xsd/jhove/jhove.xsd or see the project http://sourceforge.net/projects/jhove/) in order to display the information so that properties of any type can be output.

Here is an example of XML output (for src/test/resources/30/epub/invalid/invalid-ncx.epub with epubcheck-3.0.1):

View test_markdown.txt
# NG
* foo
* bar
* buz
* hoge
# OK
* foo
View test.md

foo bar

buz

class Foo
 def aa
View 20140805.log
mba-2:epubcheck-4.0 maki$ git co p/apond/cr/logging
Already on 'p/apond/cr/logging'
Your branch is up-to-date with 'origin/p/apond/cr/logging'.
mba-2:epubcheck-4.0 maki$ mvn clean
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EpubCheck :: Validation Tool for EPUB 4.0.0-alpha9-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]