Adding optional img size to creole2html and html2creole#30
Adding optional img size to creole2html and html2creole#30jedie merged 5 commits intojedie:masterfrom
Conversation
Add parameter to creole2html. Modify image_emit to look for image dimensions.
|
There were 11 fails in the Travis CI tests. They all seem to be from the 'rest2html' checks. It appears that one of the RST libraries is now adding: to exported html tables. I could certainly make the current lib output match the test; but I'm not an RST expert to know if that is a correct thing to do. It is unlikely that my changes caused this per se, I suspect that the change is from an external library being updated. I encountered something similar with the |
|
It appears that On a related topic, I see a role quandry with this extension to The html5 spec, which is not the only destination for creole, only allows width/height in pixels. But, supplying pixels kind of breaks the role of Supplying a pixel size makes the wiki user change the "look-and-feel" of the final page. (Though one could argue that the image itself also does that.) So, using pixels breaks the wiki user's role. An alternative would be for the size to be in units of "em" (the width of the letter M in the current font). That would make it more abstract. But the only way to pass an So, it is a catch-22, as both options are bad. But, IMO, using "pixels" as it does now is less bad. The web programmer can always override images with CSS/Javascript etc. I bring this up for your thoughts on it. |
Codecov Report
@@ Coverage Diff @@
## master #30 +/- ##
========================================
Coverage ? 89.6%
========================================
Files ? 23
Lines ? 1684
Branches ? 218
========================================
Hits ? 1509
Misses ? 133
Partials ? 42
Continue to review full report at Codecov.
|
|
All checks out now! |
|
@jedie does it look good to you? I'm looking forward to using when it reaches pypi. |
README.creole
Outdated
| {{{ | ||
| >>> from creole import creole2html | ||
| >>> creole2html("This is **creole //markup//**") | ||
| >>> creole2html(u"This is **creole //markup//**") |
There was a problem hiding this comment.
Why add this? Makes only sense with Python v2
There was a problem hiding this comment.
It makes it consistent with the rest of the file's documentation that prefix the strings with u. I've confirmed that the example fails in Python 2 without it. Having the prefix does no harm in Python 3.
But I'm happy to take it back out. We might also want to remove it from the other code snippets as well. And then document in the text that the routines are expecting unicode strings.
Or, I could modify the routines themselves to convert non-unicode into unicode strings automatically. That might be a really good idea.
Just let me know.
|
Sorry for the late response.
Sounds reasonable to me. |
|
@jedie, the readme has been changed back. Let me know if you would like anything else done. Just FYI, the reason I seem to be pressing for this to reach PyPI is that the public app utility (fondum) I'm writing generates docker containers. As such, the way to see libraries in the containers is via pip. (I could, in theory, cut&paste your library, but such a crude "fork" isn't appropriate and I'd have to undo my mess later.) Anyway, let me know if you would like to see anything else updated. |
|
Do you see the other two pending comments? |
|
Oddly, I seem to have missed them. I'll start hunting around for them. [...] This is somewhat embarrassing, but I seem to be unable to find them. Are the comments attached to lines in the code review? |
|
@jedie Mind cutting and pasting the two pending comments (and reference lines) into a response here? Github does not appear to be showing them to me. Sorry about that. |
|
Oddly, no, I still don't see them. But now that you have posted the screencaps; I'll followup with that. Thanks! |
|
re: Good catch. Removing the debugging print line. |
|
re: I've fixed it to the more intuitive: adding |
|
Great! Thanks for contribution. I will create a new release soon. |
|
New v1.3.2 is on PyPi and contains your contribution ;) |

I dropped the
allow_image_sizeas suggested, but was still concerned about users who would expect a strict interpretation of creole. So, instead, I added a genericstrict=False. So, the routines will default to allowing this (and possibly other future) extensions. But users wanting a strict interpretation can purposely pass that as a parameter.But, I'm happy to remove
strictif you really don't want it.Additions to test have been made. I also updated to the
<<code>>macro test to reflectpygmentslibrary's current behavior.If and after a pull is made, I'll update the wiki doc to reflect the new parameter and the extension to img.