Coder Social home page Coder Social logo

respec2epub's People

Contributors

iherman avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gitter-badger

respec2epub's Issues

Solving the file handling

The usage of os.path join and split may be a good approach to solve the current issue when producing a folder

HTTP CORS?

Hello Ivan,
first of all: cool project :)

I was playing with the demo site:
https://labs.w3.org/epub-generator/
...using this Respec URL:
http://w3c.github.io/dpub-accessibility/
(works great)

The HTTP GET URL works fine too:
https://labs.w3.org/epub-generator/cgi-bin/epub-generator.py?type=html&url=http%3A%2F%2Fw3c.github.io%2Fdpub-accessibility
...but unfortunately there are no CORS headers included in the HTTP response, so I cannot fetch the application/epub+zip payload from a web browser (that is to say, from XmlHttpRequest).

Here's the list of HTTP headers returned by a curl HEAD request:

$ curl --head "https://labs.w3.org/epub-generator/cgi-bin/epub-generator.py?type=html&url=http%3A%2F%2Fw3c.github.io%2Fdpub-accessibility"

HTTP/1.1 200 OK
Date: Thu, 10 Mar 2016 16:05:00 GMT
Server: Apache/2.2.22 (Debian)
Expires: Thu, 10 Mar 2016 16:05:00 GMT
Content-Disposition: attachment; filename=index.epub
Last-Modified: Thu, 10 Mar 2016 16:05:00 GMT
Content-Length: 145203
Content-Type: application/epub+zip
Strict-Transport-Security: max-age=15552015; preload
Public-Key-Pins: pin-sha256="cN0QSpPIkuwpT6iP2YjEo1bEwGpH/yiUn6yhdy+HNto="; pin-sha256="WGJkyYjx1QMdMe0UqlyOKXtydPDVrk7sl2fV+nNm1r4="; pin-sha256="LrKdTxZLRTvyHM4/atX2nquX9BeHRZMCxg3cf4rhc2I="; max-age=864000

So, I tried using a CORS proxy, unfortunately to no avail:
https://crossorigin.me/https://labs.w3.org/epub-generator/cgi-bin/epub-generator.py?type=html&url=http%3A%2F%2Fw3c.github.io%2Fdpub-accessibility

$ curl --head "https://crossorigin.me/https://labs.w3.org/epub-generator/cgi-bin/epub-generator.py?type=html&url=http%3A%2F%2Fw3c.github.io%2Fdpub-accessibility"

HTTP/2.0 500
server:cloudflare-nginx
date:Thu, 10 Mar 2016 16:07:56 GMT
content-type:text/html; charset=iso-8859-1
set-cookie:__cfduid=d2232775d992c99ef835d9fcfc48f8dd61457626075; expires=Fri, 10-Mar-17 16:07:55 GMT; path=/; domain=.crossorigin.me; HttpOnly
access-control-allow-origin:*
access-control-allow-credentials:false
access-control-allow-headers:Content-Type
expires:Fri, 11 Mar 2016 16:07:55 GMT
cf-ray:281805be638334fa-LHR

There are alternative CORS proxies, such as:

http://cors.io/?u=https%3A%2F%2Flabs.w3.org%2Fepub-generator%2Fcgi-bin%2Fepub-generator.py%3Ftype%3Dhtml%26url%3Dhttp%253A%252F%252Fw3c.github.io%252Fdpub-accessibility
...but unfortunately in this case the response content-type is incorrect.

So ideally, could https://labs.w3.org/epub-generator/cgi-bin/epub-generator.py itself be updated to emit CORS headers?

PS: I am just toying with the idea of using Readium to read ReSpec EPUBs directly from your HTTP URLs :)

Thanks!

Cover page and base.css

The cover page refers to base.css in Assets. That has to change to be adapted to the new set up with css files

Cannot generate EPUB for a ReSpec document

I was trying to export an EPUB version of https://w3c.github.io/jlreq/ , but got the following error:

Traceback (most recent call last):
  File "/home/ivan/htdocs/cgi-bin/epub-generator.py", line 189, in 
    Generator().process()
  File "/home/ivan/htdocs/cgi-bin/epub-generator.py", line 175, in process
    wrapper = self.generate_ebook()
  File "/home/ivan/htdocs/cgi-bin/epub-generator.py", line 163, in generate_ebook
    logger=logger
  File "/home/ivan/lib/python/rp2epub/doc2epub.py", line 84, in __init__
    session = HttpSession(CONVERTER + url if is_respec else url, raise_exception=True, is_respec=is_respec)
  File "/home/ivan/lib/python/rp2epub/utils.py", line 514, in __init__
    handle_exception("There seems to be a problem with the spec generator service ('%s' should be tested separately)" % url)
  File "/home/ivan/lib/python/rp2epub/utils.py", line 502, in handle_exception
    raise R2EError(message)
R2EError: "There seems to be a problem with the spec generator service ('https://labs.w3.org/spec-generator/?type=respec&url=https://w3c.github.io/jlreq/' should be tested separately)"

See https://labs.w3.org/epub-generator/cgi-bin/epub-generator.py?type=respec&url=https%3A%2F%2Fw3c.github.io%2Fjlreq%2F for the error.

I'm not sure it is an issue of spec generator or epub generator, so filing an issue here first.

Margin is still necessary...

The margin has disappeared with the new setup, but that may not work; it seems that iBook still needs it (like in the old days:-(

W3C manifest spec throws

Trying to gen from http://w3c.github.io/manifest/ I get:

Epub Generator Exception

Traceback (most recent call last):
  File "/home/ivan/htdocs/cgi-bin/epub-generator.py", line 176, in 
    Generator().process()
  File "/home/ivan/htdocs/cgi-bin/epub-generator.py", line 162, in process
    wrapper = self.generate_ebook()
  File "/home/ivan/htdocs/cgi-bin/epub-generator.py", line 150, in generate_ebook
    logger=logger
  File "/home/ivan/lib/python/rp2epub/doc2epub.py", line 79, in __init__
    session = HttpSession(CONVERTER + url if is_respec else url, raise_exception=True)
  File "/home/ivan/lib/python/rp2epub/utils.py", line 386, in __init__
    handle_exception("%s cannot be reached" % url)
  File "/home/ivan/lib/python/rp2epub/utils.py", line 375, in handle_exception
    raise R2EError(message)
R2EError: https://labs.w3.org/spec-generator/?type=respec&url=http://w3c.github.io/manifest/ cannot be reached

Provide option to remove document status like "Recommendation"

My Tolino ebook reader seems to be having a problem with the status of the document on the left side like "Recommendation", it either distorts the text or overlays part of it so it cannot be read anymore. It would be nice if there is an option to remove this in the epub output.

screen shot 2016-10-10 at 18 35 33

Full TOC into nav?

Maybe worth moving the full TOC to the nav file (mainly if the TOC is itself encoded in a 'nav')

Inefficient handling of CSS files

The current logic means that CSS files are retrieved twice: once when the import statements are extracted, and then again when the data is stored. This may be reduced...

strange URI ID-s created...

Look at the annotation protocol book, it contains, in the opf files, something like:

<item href="annotation-protocol/ https://w3c.github.io/test-results/annotation-protocol/all.xhtml" id="annotation-protocol- https:--w3c-github-io-test-results-annotation-protocol-all-xhtml" media-type="application/xhtml+xml"/>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.