jsamsa / python-textile Goto Github PK
View Code? Open in Web Editor NEWThis project forked from sebix/python-textile
A Python port of Textile, A humane web text generator
Home Page: http://loopcore.com/python-textile
This project forked from sebix/python-textile
A Python port of Textile, A humane web text generator
Home Page: http://loopcore.com/python-textile
Hi!
The implementation proposed in this webpage:
http://www.textism.com/tools/textile/index.php
Precisely states that " and ' should not be touched inside the
.
When processing text files with python-textile, this is not the case,
and they are replace by html special characters.
It would be really nice if it was possible to have URLs in the input string turned into links:
>>> from textile import textile
>>> textile('http://www.google.co.uk/")
'<a href="http://www.google.co.uk">http://www.google.co.uk</a>'
looks like the classid regex's forward-looking condition doesn't like the alt tag in parentheses on images.
Example: !(myclass)/assets/photo.png(cool stuff)!
(_text_)
should return:
(text)
It currently returns:
(_text_)
t = Textile()
t.footnoteRef('текст[1] ')
won't work, but it will work if i change the function to
def footnoteRef(self, text):
ptrn = re.compile(r'\b\[([0-9]+)\](\s)?', re.UNICODE)
return ptrn.sub(self.footnoteID, text)
>>> import textile
This is OK:
>>> textile.textile("Ala ma kota[1]")
'\t<p>Ala ma kota<sup class="footnote"><a href="#fn217a423d-2aca-4b3b-b18d-65cfc5cf4022">1</a></sup></p>'
But this is not:
>>> textile.textile("Ala ma kota”[1]")
'\t<p>Ala ma kota\xe2\x80\x9d[1]</p>'
>>> textile.textile("Ala ma kota\"[1]")
'\t<p>Ala ma kota”[1]</p>'
>>> textile.textile("Blah,[3] blah, blah")
'\t<p>Blah,[3] blah, blah</p>'
In general it looks like [no] markers must be put after letter to be handled properly. In real texts I often see them after quotes or punctuation.
Tested on textile 2.1.4 (as present in Ubuntu 10.04)
This currently doesn't work on the latest released version: _italic_word_
. The textism site renders it correctly leading me to believe this project should too. :)
In Textile 2.0 (http://textile.thresholdstate.com/) this is valid:
H[2]O
Putting brackets allow you get around having white space before modifers. This did not seem to work in Python Textile.
In [5]: from textile import textile
In [7]: textile('http://en.wikipedia.org/wiki/Game_(rapper)')
Out[7]: '<p><a href="http://en.wikipedia.org/wiki/Game_">http://en.wikipedia.org/wiki/Game_</a>(rapper)</p>'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.