smart-on-fhir / client-py

Python SMART on FHIR client
http://docs.smarthealthit.org
Other
589 stars 210 forks source link

Jinja wordwrap wraps each character instead of word #57

Closed nerdoc closed 3 months ago

nerdoc commented 6 years ago

I just tried client-py on Arch linux (python 3.7 - I don't know what's the culprit...). The model output seems completely unreadable, because all the docstrings are "vertical" - the parser creates a wordwrap after each character, instead of after each 75 characters. This only breaks for the docstring, everything else seems to be ok.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#  Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Account) on 2018-09-22.
#  2018, SMART Health IT.

from . import domainresource

class Account(domainresource.DomainResource):
    """ 
    T
    r
    a
    c
    k
    s
    b
    a
    l
    a
    n
    c
    e
    ,
    c
    h
    a
    r
    g
    e
    s
    ,
    f
    o
    r
    p

# AND SO ON

I can only remove this behaviour if I remove the whole |wordwrap(width=75) part of the corresponding code lines here, line 18 and here, line 21 in the resource template.

pip freeze:

bumpversion==0.5.3
certifi==2018.8.24
chardet==3.0.4
colorlog==2.10.0
Django==2.1.1
idna==2.7
isodate==0.6.0
Jinja2==2.10
MarkupSafe==0.23
pytz==2018.5
requests==2.19.1
six==1.11.0
urllib3==1.23

I really don't know why this happens. Maybe it's a Jinja2 problem?

p2 commented 6 years ago

Interesting. There is a word-wrap workaround implemented here, can you play around with that code and see if the issue resides there?

nerdoc commented 6 years ago

ok, give me some time, plenty of work ATM.

mikix commented 3 months ago

I'm assuming this is not a problem anymore. Certainly the current generated models don't have this kind of wrapping issue.