Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"caps" are not replaced correctly #18

Closed
kevinmgrant opened this issue Apr 11, 2015 · 5 comments
Closed

"caps" are not replaced correctly #18

kevinmgrant opened this issue Apr 11, 2015 · 5 comments

Comments

@kevinmgrant
Copy link

The last version I used was PyTextile 2.1.4, which did not try to replace caps. Now in version 2.2.2, unexpected HTML conversions occur for text that contains capital letters.

For example, the text "CFString" in a textile file becomes "<span class="caps">CFS</span>tring" in HTML, and "TCP/IP" becomes "<span class="caps">TCP</span>/IP".

My preference is to have a way to disable this substitution entirely because it is not necessary. Still, the regular expressions could be improved by scanning text beyond an all-caps range; for instance, require all-caps ranges to be immediately followed by spaces or punctuation, and certainly not lowercase letters.

@hhsprings
Copy link

It seems redcloth has the same problem for the latter case (TCP/IP). I also believe this case must be render as <span class="caps">TCP/IP</span> (and of cource CFString must not be recognized as caps). But neither redcloth spec nor textile-spec don't explain these behaviours well.

@ikirudennis
Copy link
Member

Yeah, I see this as more of a problem for the spec than it is a problem with this project's implementation. I'd rather keep this consistent with the official version even if it is obviously wrong here.

@appli-intramuros
Copy link

How can we disable the fact that caps are replaced by a span ?

@ikirudennis
Copy link
Member

ikirudennis commented Sep 14, 2019

That's pretty easy to accomplish (if not immediately obvious):

no_span = textile.Textile()
no_span.glyph_replace[-1] = r'\1{0}:glyph:\2\3'.format(no_span.uid)
no_span.parse('text TEXT text')

That ought to output '\t<p>text TEXT text</p>'. I hope that helps.

@appli-intramuros
Copy link

@ikirudennis it works perfectly. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants