[scribus] Converting hyphens to en and em dashes

Gregory Pittman gpittman at iglou.com
Sun Apr 27 02:45:48 UTC 2014


On 04/26/2014 10:32 PM, Gregory Pittman wrote:
> Here is a script that accomplishes something simpler than Autoquote.py:
>
> http://wiki.scribus.net/canvas/En%2Bemdash.py
>
> It's actually a step-child of Autoquote,py, in that I started with 
> that script, then stripped out the insides and gave it a different 
> task, this time turning a 2-hyphen sequence into an en dash, and a 
> 3-hyphen sequence into an em dash.
>
> The trickiness of the scripting job is to detect hyphens, but then 
> save the memory of them until you're sure whether you have 1, 2, or 3 
> in a row. Meanwhile, you have to manage the counting that goes on with 
> the text manipulation of the frame.
>
> I hope you can find uses for this.
>
A word of warning:

The script (so far) doesn't handle situations where there is more than 
one  Paragraph Style in the frame -- the style moves around. Also, 
Character Styles may get lost.
So run the script before you apply styles for the best results.

Greg



More information about the scribus mailing list