Package: ruby-gettext Version: 3.2.2-1 Severity: normal Tags: patch Hello, I noticed that rxgettext, when used with the --wrap option, wraps long message lines by breaking words.
I think this is awkward and should be avoided.
Wrapping of long message lines should be performed by searching the
nearest whitespace before the page width boundary and breaking there.
I prepared a patch to implement the desired behavior.
It is attached (file wrap-without-breaking-words.diff.gz).
My patch only changes the regular expression used to perform the
line scanning.
The new regexp consists of three alternatives:
* the first alternative deals with chunks which reach the end of
a line and whose length is less than or equal to the page width:
these chunks will not be broken any further
* the second alternative deals with the (rare) chunks which consist
of a single word whose length is greater than or equal to the page
width: these chunks will be considered as unbreakable (even though
this means that the output will include a line longer than the
page width, as a rare exception to the general wrapping rule)
* the third alternative deals with chunks ending with a whitespace
and whose length is less than or equal to the page width: these
chunks will be as large as possible (regexp repetition matching
is greedy by default) and will not be broken any further
The regexp behavior is shown in the attached little test script
(file test.rb.gz).
Please apply my patch and/or forward it upstream.
Thanks for your time!
N.B.: I am not sure my patch is creative enough to be copyrighted by
me; at any rate, I hereby release both my patch and the little
test script under the same licensing terms as the po_entry.rb
file (that is to say: Ruby or GPL-2 or LGPL-3+).
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (800, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.7.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages ruby-gettext depends on:
ii ruby 1:2.3.0+4
ii ruby-locale 2.1.2-1
ii ruby-text 1.3.0-1
ruby-gettext recommends no packages.
ruby-gettext suggests no packages.
-- no debconf information
test.rb.gz
Description: application/gzip
wrap-without-breaking-words.diff.gz
Description: application/gzip
_______________________________________________ Pkg-ruby-extras-maintainers mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ruby-extras-maintainers
