Skip to content

Commit

Permalink
initial checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed May 5, 2021
0 parents commit 3a2a0d3
Show file tree
Hide file tree
Showing 53 changed files with 30,131 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git export-ignore
.gitattributes export-ignore
.gitignore export-ignore
version.xml export-ignore
86 changes: 86 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Backup files left behind by the Emacs editor.
*~

# Lock files used by the Emacs editor.
.\#*

# emacs auto recovery files from aborted edits
\#*\#

#use ful for stashing files
*.orig
*.keep

# Temporary files used by the vim editor.
.*.swp
.swp

# A hidden file created by the Mac OS X Finder.
.DS_Store

# Image thumbnail database created by windows
Thumbs.db

# Various files created by Visual Studio
*.sln
*.suo
*.vcproj
*.user*
#*.rc
*.ncb
*.pch
*.dep
*.idb
*.exp
*.res
*.manifest
*.ilk
*.pdb
*.def
Release
Debug
BuildLog.htm

# Various files and folders created by CMake
CMakeFiles
CMakeScripts
CMakeCache.txt
*.cmake
*.dir
ALL_BUILD*

# Various Qt files
ui_*
moc_*
qrc_*

# Misc files
*.svn
*.a
*.o
*.obj
*.lib
*.exe
*.dll
*.a
*.app
*.xcodeproj
*.pbxbtree
*.pbxindex
*.build
*.smp
*.pl
*.pyc
*.pyo
*.orig
*.bak
*.rar
OpenCandy
tags
build

# Temporary build directories
ReadiumReader/

# Zip files (plugin releases)
*.zip
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
v010
- first public release of FuturePress EpubJSReader plugin for Sigil
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Epub.js Reader
================================

![Demo](http://fchasen.com/futurepress/epubjs-reader_moby-dick.png)

[Try it while reading Moby Dick](http://futurepress.github.com/epubjs-reader/)

About the Reader
-------------------------

[Epub.js](http://futurepress.github.com/epub.js/) library.


Getting Started
-------------------------

Open up [reader/index.html](http://futurepress.github.com/epubjs-reader/index.html) in a browser.

You can change the ePub it opens by passing a link to bookPath in the url:

`?bookPath=https://s3.amazonaws.com/epubjs/books/alice.epub`

Running Locally
-------------------------

Install [node.js](http://nodejs.org/)

Then install the project dependences with npm

```javascript
npm install
```

You can run the reader locally with the command

```javascript
node start
```

Builds are concatenated and minified using [gruntjs](http://gruntjs.com/getting-started)

To generate a new build run

```javascript
grunt
```

Or, to generate builds as you make changes run

```
grunt watch
```

Additional Resources
-------------------------

[Epub.js Developer Mailing List](https://groups.google.com/forum/#!forum/epubjs)

IRC Server: freenode.net Channel: #epub.js

Follow us on twitter: @Epubjs

+ http://twitter.com/#!/Epubjs

Other
-------------------------

EPUB is a registered trademark of the [IDPF](http://idpf.org/).
109 changes: 109 additions & 0 deletions buildplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab

from __future__ import unicode_literals, division, absolute_import, print_function

import os
import sys
import re
import subprocess
import shutil
import inspect
import zipfile


SCRIPT_DIR = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
PLUGIN_NAME = 'EpubJSReader'
TEMP_DIR = os.path.join(SCRIPT_DIR, PLUGIN_NAME)

# Add files/folder that should be included in the plugin here
PLUGIN_FILES = ['reader',
'reader_demo_v3.py',
'ChangeLog.txt',
'epub_js_license.txt',
'README.md',
'plugin.py',
'plugin.xml',]

def findVersion():
_version_pattern = re.compile(r'<version>([^<]*)</version>')
with open('plugin.xml', 'r') as fd:
data = fd.read()
match = re.search(_version_pattern, data)
if match is not None:
return '{}'.format(match.group(1))
return '0.X.X'


# Find version info from plugin.xml and build zip file name from it
VERS_INFO = findVersion()
ARCHIVE_NAME = os.path.join(SCRIPT_DIR, '{}_v{}.zip'.format(PLUGIN_NAME, VERS_INFO))


# recursive zip creation support routine
def zipUpDir(myzip, tdir, localname):
currentdir = tdir
if localname != "":
currentdir = os.path.join(currentdir,localname)
dir_contents = os.listdir(currentdir)
for entry in dir_contents:
afilename = entry
localfilePath = os.path.join(localname, afilename)
realfilePath = os.path.join(currentdir, entry)
if os.path.isfile(realfilePath):
myzip.write(realfilePath, localfilePath, zipfile.ZIP_DEFLATED)
elif os.path.isdir(realfilePath):
zipUpDir(myzip, tdir, localfilePath)

def removePreviousTmp(rmzip=False):
# Remove temp folder and contents if it exists
if os.path.exists(TEMP_DIR) and os.path.isdir(TEMP_DIR):
shutil.rmtree(TEMP_DIR)

if rmzip: # Remove zip file if indicated.
print('Removing any current zip file ...')
if os.path.exists(ARCHIVE_NAME):
os.remove(ARCHIVE_NAME)

def ignore_in_dirs(base, items, ignored_dirs=None):
ans = []
if ignored_dirs is None:
ignored_dirs = {'.git', '__pycache__'}
for name in items:
path = os.path.join(base, name)
if os.path.isdir(path):
if name in ignored_dirs:
ans.append(name)
else:
if name.rpartition('.')[-1] in ('pyc', 'pyo'):
ans.append(name)
return ans


if __name__ == "__main__":
print('Removing any previous build leftovers ...')
removePreviousTmp(rmzip=True)

print('Creating temp {} directory ...'.format(PLUGIN_NAME))
os.mkdir(TEMP_DIR)

print('Copying everything to temp {} directory ...'.format(PLUGIN_NAME))
for entry in PLUGIN_FILES:
entry_path = os.path.join(SCRIPT_DIR, entry)
if os.path.exists(entry_path) and os.path.isdir(entry_path):
shutil.copytree(entry_path, os.path.join(TEMP_DIR, entry), ignore=ignore_in_dirs)
elif os.path.exists(entry_path) and os.path.isfile(entry_path):
shutil.copy2(entry_path, os.path.join(TEMP_DIR, entry))
else:
sys.exit('Couldn\'t copy necessary plugin files!')

print('Creating {} ...'.format(os.path.basename(ARCHIVE_NAME)))
outzip = zipfile.ZipFile(ARCHIVE_NAME, 'w')
zipUpDir(outzip, SCRIPT_DIR, os.path.basename(TEMP_DIR))
outzip.close()

print('Plugin successfully created!')

print('Removing temp build directory ...')
removePreviousTmp()
Binary file added epub_js.pdf
Binary file not shown.
21 changes: 21 additions & 0 deletions epub_js_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 futurepress

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added epubjs-reader.pdf
Binary file not shown.
Loading

0 comments on commit 3a2a0d3

Please sign in to comment.