├── plugin ├── skels │ ├── ncx_tail.xml │ ├── xhtml_tail.html │ ├── nav_tail.html │ ├── epub_epub2.epub │ ├── toc_css_skel.css │ ├── css_skel.css │ ├── xhtml_head.html │ ├── xhtml_skel.html │ ├── nav_head.html │ ├── ncx_head.xml │ └── cover.html ├── epub │ ├── utils.py │ ├── README.txt │ ├── LICENSE.txt │ ├── __init__.py │ ├── opf.py │ └── ncx.py ├── vepub_cleanup.py ├── vepub_nav.py ├── vepub_toc.py ├── vepub_css.py ├── epubdiff.py ├── vepub_metadata.py └── vim_epub.vim ├── TODO.md ├── README ├── snippets └── UltiSnips │ ├── smil.snippets │ ├── dublincore.snippets │ └── epub.snippets ├── README.md ├── doc ├── vim-epub.txt └── vim-epub.frx └── LICENSE /plugin/skels/ncx_tail.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /plugin/skels/xhtml_tail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /plugin/skels/nav_tail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /plugin/skels/epub_epub2.epub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vim-scripts/Vim-EPUB/HEAD/plugin/skels/epub_epub2.epub -------------------------------------------------------------------------------- /plugin/skels/toc_css_skel.css: -------------------------------------------------------------------------------- 1 | p {text-align:left;} 2 | 3 | .tlevel_1 {} 4 | .tlevel_2 {} 5 | .tlevel_3 {} 6 | .tlevel_4 {} 7 | .tlevel_5 {} 8 | .tlevel_6 {} 9 | -------------------------------------------------------------------------------- /plugin/skels/css_skel.css: -------------------------------------------------------------------------------- 1 | /* Structure */ 2 | 3 | h1 {page-break-before: always;} 4 | 5 | /* Content */ 6 | 7 | body {} 8 | p {} 9 | 10 | sup {font-size: 67%;vertical-align: 33%;} 11 | 12 | /* IDs */ 13 | /* Classes */ 14 | /* Fonts */ 15 | 16 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # Todo 2 | 3 | ## General 4 | 5 | 1. *Use unicode in all the user inputs* 6 | 2. Improve _AddMedia_ command. 7 | 8 | ## EPUB 2 Support 9 | 10 | ## EPUB 3 Support 11 | 12 | ## Extras 13 | 14 | 1. Snippets for _Media Overlay_ (EPUB3) [smile](http://www.w3.org/ns/SMIL) files. 15 | -------------------------------------------------------------------------------- /plugin/skels/xhtml_head.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /plugin/skels/xhtml_skel.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /plugin/skels/nav_head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BookName 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /plugin/skels/ncx_head.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /plugin/skels/cover.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is a mirror of http://www.vim.org/scripts/script.php?script_id=5006 2 | 3 | Github page: https://github.com/etnadji/vim-epub 4 | 5 | With Vim, you can already edit an epub file with the builtin zip.vim. 6 | But it's only a RO opening. If you want to add or remove files, you need to extract and recompress the EPUB. That's boring. 7 | 8 | With Vim-EPUB, you can: 9 | 10 | − Add an empty page (XHTML). 11 | − Add an empty CSS stylesheet. 12 | − Add a Table of contents page. 13 | − Add medias (images, etc.). 14 | − Make your OS open the EPUB with its selected reader. 15 | − Provide a menu to easily link XHTML and CSS contents. 16 | 17 | See https://github.com/etnadji/vim-epub/wiki/Features for a complete list. 18 | -------------------------------------------------------------------------------- /plugin/epub/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | 5 | def get_node_text(node): 6 | """ 7 | Return the text content of an xml.dom Element Node. 8 | 9 | If node does not have content, this function return an empty string. 10 | """ 11 | text = '' 12 | 13 | node.normalize() 14 | if node.firstChild and node.firstChild.data: 15 | text = node.firstChild.data.strip() 16 | 17 | return text 18 | 19 | 20 | def get_urlpath_part(urlpath): 21 | """ 22 | Return a path without url fragment (something like `#frag` at the end). 23 | 24 | This function allow to use path from references and NCX file to read 25 | item from Manifest with a correct href (without losing the fragment part). 26 | 27 | eg.: 28 | 29 | url = 'text/chapter1.xhtml#part2' 30 | href, fragment = get_urlpath_part(url) 31 | print href # 'text/chapter1.xhtml' 32 | print fragment # '#part2' 33 | """ 34 | href = urlpath 35 | fragment = None 36 | if urlpath.count('#'): 37 | href, fragment = urlpath.split('#') 38 | return (href, fragment) 39 | -------------------------------------------------------------------------------- /snippets/UltiSnips/smil.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | ########################################################################### 4 | # SMIL XML Snippets # 5 | # # 6 | # By etnadji, for vim-epub # 7 | ########################################################################### 8 | 9 | snippet smil "SMIL: smil body" b 10 | 11 | 12 | $0 13 | 14 | 15 | endsnippet 16 | 17 | snippet par "SMIL: par(allel)" b 18 | $0 19 | endsnippet 20 | 21 | snippet audio "SMIL: audio clip" b 22 |