Git Product home page Git Product logo

rfc2kindle's People

Contributors

hrqiang avatar

Watchers

 avatar

rfc2kindle's Issues

(Fix/patch included) Newlines in <blockquote> tags disappear in .mobi output

What steps will reproduce the problem?
1. Invoke rfc2kindle/rfc2mobi to convert any RFC that would result in a 
<blockquote> tag being created in its HTML output.
2. View the resulting .mobi output.
3. Newlines in text inside <blockquote> tags are missing.

What is the expected output? What do you see instead?
Using an example from RFC 4462...

Here's the raw the RFC text:
           byte        SSH_MSG_USERAUTH_REQUEST
           string      user name
           string      service
           string      "gssapi-keyex"
           string      MIC

Here's the HTML that rfc2mobi generates:
<blockquote>
           byte      SSH_MSG_USERAUTH_REQUEST
           string    user name (in ISO-10646 UTF-8 encoding)
           string    service name (in US-ASCII)
           string    "gssapi-with-mic" (US-ASCII method name)
           uint32    n, the number of mechanism OIDs client supports
           string[n] mechanism OIDs
</blockquote>

In the .mobi file, newlines are not preserved, so that text looks like:
    byte SSH_MSG_USERAUTH_REQUEST string user name (in ISO-10646 UTF-8 encoding) string service name (in US-ASCII) string "gssapi-with-mic" (US-ASCII method name) uint32 n, the number of mechanism OIDs client supports string[n] mechanism OIDs

But I would expect it to look like:
    byte      SSH_MSG_USERAUTH_REQUEST
    string    user name (in ISO-10646 UTF-8 encoding)
    string    service name (in US-ASCII)
    string    "gssapi-with-mic" (US-ASCII method name)
    uint32    n, the number of mechanism OIDs client supports
    string[n] mechanism OIDs

What version of the product are you using? On what operating system?
(same as in Issue 1 and Issue 2)

Please provide any additional information below.
Here's a simple fix, with code. When generating a <blockquote> tag, just 
replace newlines with <br /> tags. I tested this and it works:
In html.py, inside of outputTextBlock(self), replace:
 self.output.write("%s\n" %(i))
with:
 self.output.write("%s<br/>" %(i))

Other possible fixes:
1. Use the <pre> tag instead of using <blockquote>. The output is not as pretty 
(in my opinion) because spaces are preserved, but it works. Removing extra 
spaces and using <pre> would look better.

2. Create a figure instead of using <blockquote>. I have not tested this but it 
would probably not look as nice as (1).

Original issue reported on code.google.com by [email protected] on 14 Feb 2012 at 6:58

Hardcoded font does not exist

What steps will reproduce the problem?
1. start the program, it crashes.

What is the expected output? What do you see instead?
There is the following font hardcoded that does not exist on my system (:
/usr/share/cups/fonts/Courier-Bold

Having the font discovered would be great.
Changing it to "Monospace-Bold" worked. But have to test this first on the 
kindle to see how it looks.


What version of the product are you using? On what operating system?
Fedora 17

Please provide any additional information below.
Traceback (most recent call last):
  File "./rfc2mobi", line 21, in <module>
    from html import Html
  File "/home/baboo/programs/rfc2kindle-read-only/html.py", line 3, in <module>
    from image import createImage
  File "/home/baboo/programs/rfc2kindle-read-only/image.py", line 6, in <module>
    _default_font = ImageFont.truetype('/usr/share/cups/fonts/Courier-Bold', 18)
  File "/usr/lib64/python2.7/site-packages/PIL/ImageFont.py", line 218, in truetype
    return FreeTypeFont(filename, size, index, encoding)
  File "/usr/lib64/python2.7/site-packages/PIL/ImageFont.py", line 134, in __init__
    self.font = core.getfont(file, size, index, encoding)
IOError: cannot open resource

Original issue reported on code.google.com by [email protected] on 8 Jan 2013 at 1:21

Some RFC text incorrectly converted to figures

What steps will reproduce the problem?
1. Invoke rfc2kindle/rfc2mobi to convert RFC 4462 (and presumably others)
2. ls ./rfc4462 # includes two JPEGs other than auths.jpg even though there are 
no figures in the RFC. The images contain text, and don't flow/resize with the 
rest of the text in the document.

What is the expected output? What do you see instead?
Expected: Only one HTML file (rfc4462.html) and one authors page image 
(auths.jpg).
Seen instead: One HTML file (rfc4462.html), two images containing text rather 
than figures (img1.jpg, img2.jpg), and one authors page image (auths.jpg).

What version of the product are you using? On what operating system?
OS: Fedora Linux 16 x86_64
rfc2kindle: Latest available via SVN as on 12 February 2012

Please provide any additional information below.
I don't have a patch for this one, but I think the culprit may be the logic in 
html.py, line 218 (isFigureLine = lambda i:....), which is confused in one spot 
in RFC 4462 by the page break formatting, and in another spot because of the 
text:
'1.  C sends "min || n || max" to S, indicating the minimal acceptable'

Original issue reported on code.google.com by [email protected] on 13 Feb 2012 at 6:09

(Patch/fix included) Special characters in RFC text not converted to HTML, causing kindlegen to fail

What steps will reproduce the problem?
1. Invoke rfc2kindle/rfc2mobi to get RFC 4462 or any other RFC containing "<", 
or ">" (e.g. "./rfc2mobi rfc4462")
2. rfc2mobi successfully pulls rfc4462.txt and generates ./rfc4622/auths.png 
and ./rfc4622/rfc4622.html
3. rfc2mobi calls kindlegen. kindlegen reports a parse warning and a parse 
error (detailed below).
4. No .mobi created due to parse errors.

What is the expected output? What do you see instead?
Expected output: a .mobi file.
:Begin actual output:
[bar@testvm1 foo]$ ./rfc2mobi rfc4462
link = http://www.ietf.org/rfc/rfc4462.txt, doc = rfc4462

**************************************************
* Amazon.com kindlegen(Linux) V2.3 build 36043   *
* A command line e-book compiler                 *
* Copyright Amazon.com 2011                      *
**************************************************

Info(prcgen):I1047: Added metadata dc:Title        "RFC4462 - Generic Security 
Service Application Program Interface (GSS-API) Authentication and Key Exchange 
for the Secure Shell (SSH) Protocol"
Info(prcgen):I1002: Parsing files  0000002
Error(parsing):E3001: Requested XML node does not exist in memory.
Warning(inputpreprocessor):W29001: unescaped & which should be written as &amp;
      in file: /tmp/foo/rfc4462/rfc4462.html     line: 0001644
Info(cssparser):I10005: CSS file not found "/tmp/foo/css/rfc.css"
Error(prcgen):E21018: Enhanced Mobi building failure, while parsing content in 
the file. Content: <2. C calls GSS_Init_> in file: 
/tmp/foo/rfc4462/rfc4462.html line: 175
Successfully converted rfc4462 into rfc4462 directory.
:End actual output:

What version of the product are you using? On what operating system?
OS: Fedora Linux 16, x86_64
rfc2kindle: latest available via svn as of 12 Feb. 2012
kindlegen: 2.3 build 36043
python: 2.7.2

Please provide any additional information below.
Inserting the following code in html.py above all the regex matching logic 
inside def writeContent(self, line) resolves the issue:

# Sanitize &, <, and >
line=re.sub('&','&amp;',line)
line=re.sub('<','&lt;',line)
line=re.sub('>','&gt;',line)

Original issue reported on code.google.com by [email protected] on 13 Feb 2012 at 5:48

rfc2328 converted with some text as images and some tables just as text losing table form

What steps will reproduce the problem?
1. Convert rfc2328
2.
3.

What is the expected output? What do you see instead?
Text should be text and tables should be pictures

What version of the product are you using? On what operating system?
Code date:
Created on May 31, 2011
@author: rhuang

OS:
CentOS release 6.6 (Final)

Please provide any additional information below.
Zip File attached with all the files in it.

Original issue reported on code.google.com by [email protected] on 19 Dec 2014 at 11:50

Attachments:

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.