[reportlab-users] Glitch in the user guide regarding "textTransform"

Lele Gaifax lele at metapensiero.it
Sat Jun 27 12:26:12 EDT 2020


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.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.



More information about the reportlab-users mailing list