View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002021||Scribus||Import / Export||public||2005-05-24 22:02||2006-04-20 14:47|
|Target Version||Fixed in Version|
|Summary||0002021: enhance text filter: auto-change quotes to typographical quotes|
I'm looking for a way to automatically change quotes (", ') to typographical quotes (unicode 201c/201e etc.). Would be great if I could use the text filters to do something like: "replace every other occurence of " with unicode 201e, the rest with 201c"
After that, one could eventually try to find nice heuristics for state-based nested conversion ;-)
|Tags||No tags attached.|
You could probably do it with a really ookey regex text filter along the lines of (perl syntax):
The problem is that such a "dumb" method won't handle passages like:
"Fred is a silly boy.
"Yes, he is.
which, at least in Australian English, is correct quotation and should appear as:
“Fred is a silly boy.
“Yes, he is.
Additionally, the regex support in the text filters is currently a little problematic. It should probably do minimal matches at least by default, but does not - so applying the match rule:
with replace rule:
replaces the first and last quote in the /whole document/ :-( . I'll see if I can tweak this shortly.
After exams I'll see if I can hack up some Python to try to do it more correctly... but we really need built-in auto-quoting.
Last edited: 2005-05-25 15:31
TextFilter in 1.3cvs as of five minutes ago does minimal matches by default, so if you only need to replace quotes in a passage that always has reliably paired quotes the regexp described above will do the job well.
It might even be possible to use look-ahead and look-behind assertions to handle open quoting, but I haven't looked at that yet. If you're feeling brave, check out http://doc.trolltech.com/3.3/qregexp.html, which describes the Qt regexp syntax.
Unfortunately, while "\1" works, putting the actual typographic characters there does not. The input field in the regexp editor does not accept F12-201c. Setting a keyboard shortcut for e.g. "double low" and pressing that short cut in the regexp editor does not work either.
(btw, cut and paste from kcharselect did not work terribly well either, but that's a different story)
So, how am I supposed to put ,,\1'' there instead of "\1"? :-)
||(btw, I eventually got it working with kcharselect. but still... :-))|
I copied and pasted the chars from a character map. They didn't show up (nfi why and I don't have time to look at it - probably my user interface font lacking those glyphs) but worked fine.
We should probably tweak the input controls Scribus uses to accept the same input method as the canvas. It'd be 1.3 only, so it may as well wait until we can use ALT-nnnn for unicode input, though, as that's what the standard is.
|2005-05-24 22:02||mcornils||New Issue|
||Note Added: 0004768|
||Status||new => acknowledged|
||Note Added: 0004769|
|2005-05-25 12:58||mcornils||Note Added: 0004773|
|2005-05-25 13:02||mcornils||Note Added: 0004774|
||Note Added: 0004777|
||Note Edited: 0004769|
|2006-04-20 14:47||mhanski||Relationship added||related to 0003400|
|2010-04-21 04:12||christoph_s||Relationship added||has duplicate 0004626|