View Issue Details

IDProjectCategoryView StatusLast Update
0002021ScribusImport / Exportpublic2006-04-20 14:47
Reportermcornils Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status acknowledgedResolutionopen 
Product Version1.3.0cvs 
Target VersionFixed in Version 
Summary0002021: enhance text filter: auto-change quotes to typographical quotes
DescriptionHi,

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 ;-)

-Malte
TagsNo tags attached.
Patch

Relationships

related to 0003400 acknowledged Support for international typographic spacing (e.g. German) 
has duplicate 0004626 closed Enhancement to text filter: convert quotes automatically during import 

Activities

ringerc

2005-05-25 03:53

reporter   ~0004768

You could probably do it with a really ookey regex text filter along the lines of (perl syntax):

s/\"(.*?)\"/“\1”/g

The problem is that such a "dumb" method won't handle passages like:

"Fred is a silly boy.
"Yes, he is.
"Really silly."

which, at least in Australian English, is correct quotation and should appear as:

“Fred is a silly boy.
“Yes, he is.
“Really silly.”

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:

   “\1”

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.

ringerc

2005-05-25 05:00

reporter   ~0004769

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.

mcornils

2005-05-25 12:58

reporter   ~0004773

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"? :-)

mcornils

2005-05-25 13:02

reporter   ~0004774

(btw, I eventually got it working with kcharselect. but still... :-))

ringerc

2005-05-25 15:30

reporter   ~0004777

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.

Issue History

Date Modified Username Field Change
2005-05-24 22:02 mcornils New Issue
2005-05-25 03:53 ringerc Note Added: 0004768
2005-05-25 03:53 ringerc Status new => acknowledged
2005-05-25 05:00 ringerc Note Added: 0004769
2005-05-25 12:58 mcornils Note Added: 0004773
2005-05-25 13:02 mcornils Note Added: 0004774
2005-05-25 15:30 ringerc Note Added: 0004777
2005-05-25 15:31 ringerc 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