Glitch in the user guide regarding "textTransform"

Lele Gaifax <[email protected]> Sat, 27 Jun 2020 18:26:12 +0200
Newsgroups gmane.comp.python.reportlab.user
Organization Nautilus Entertainments
Message-ID <[email protected]>
Hi,

I noticed a discrepancy between what the user guide says about "textTransform"
in the paragraph's settings and the actual code.

The guide talk about "upper" and "lower", but the code actually wants
"uppercase" or "lowercase" or "capitalize" (the latter is not mentioned in the
guide).

The text in docs/userguide/ch5_paragraphs.py says:

  disc("""The $textTransform$ attribute can be <b><i>None</i></b>, <i>'upper'</i> or <i>'lower'</i> to get the obvious result.""")

while the related code in src/reportlab/platypus/paragraph.py is:

    def textTransformFrags(frags,style):
        tt = style.textTransform
        if tt:
            tt=tt.lower()
            if tt=='lowercase':
                tt = unicodeT.lower
            elif tt=='uppercase':
                tt = unicodeT.upper
            elif  tt=='capitalize':
                tt = unicodeT.title
            elif tt=='none':
                return
            else:
                raise ValueError('ParaStyle.textTransform value %r is invalid' % style.textTransform)

I'm not sure if it is actually used or not, but also in
src/reportlab/platypus/paraparser.py there is:

    def _textTransformConv(s):
        s = s.lower().strip()
        if not s: return None
        if s not in ('uppercase','lowercase','capitalize','none'):
            raise ValueError('cannot convert wordWrap=%r' % s)
        return s

where apparently also the exception message wrongly refers to "wordWrap"
instead of "textTransform".

All the best,
bye, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
[email protected]  |                 -- Fortunato Depero, 1929.

_______________________________________________
reportlab-users mailing list
[email protected]
https://pairlist2.pair.net/mailman/listinfo/reportlab-users