django-bootstrap-studio-tools icon indicating copy to clipboard operation
django-bootstrap-studio-tools copied to clipboard

dj-ref with multiple childrens

Open AbcSxyZ opened this issue 5 years ago • 0 comments

Problem is show in your example.html file:

<div dj-block="title" >
    <div dj-ref="section.title"> 
        <h1>{{ section.title }} </h1>
    </div>
</div>

is converted to :

  {% block title %}
  <div>
   <div>
    <h1>
     {{ section.title }}
    </h1>
   </div>
  </div>
  {% endblock %}

Actually, dj-ref is not used to create the {{selection.title}}, and use the string already avaible in the example (why using django tag in the example ?).

Actually, bs4 tag is setting string attribute to None when having multiple childs : https://www.crummy.com/software/BeautifulSoup/bs4/doc/#string

You're skipping change with condition:

if ref.string:
    ref.string.replace_with('{{ ' + refattr + ' }}')      

AbcSxyZ avatar Aug 08 '20 11:08 AbcSxyZ