Skip to content

dj-ref Attributes are not converted #5

@NiclasWil

Description

@NiclasWil

When I'm adding dj-ref Attributes to my HTML in Bootstrap Studio then theses references are never processed.
They remain in HTML Tag as attributes
Input File

<div class="ms-3">
    <h4 class="w-auto" dj-ref="conversationname">$$Conversation Name$$</h4>
    <p dj-ref="conversation.last_message">$$Nullam id dolor id nibh ultricies vehicula ut id elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus.$$</p>
</div>

Output File

<div class="ms-3">
      <h4 class="w-auto" dj-ref="conversationname">
              $$Conversation Name$$
       </h4>
       <p dj-ref="conversation.last_message">
              $$Nullam id dolor id nibh ultricies vehicula ut id elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus.$$
       </p>
</div>

All other tags i used so far instead of dj-ref are working fine. The problem seems to be TagConverter.convert() since replace_ref is never called

def convert(self):
      with open(self._filename, encoding='utf8') as htmlstream:
         self._bs = BeautifulSoup(htmlstream.read(), 'html.parser')
         
      self.remove_for_data()
      self.replace_include_tag()
      
      for tag in self.ENCLOSED_TAG:
         self.extend_tag(tag, before=True, after=True)
   
      for tag in self.REPLACE_TAG:
         self.extend_tag(tag)
   
      for tag in self.TAG_LINK:
         self.replace_links(tag)      

      content = self.replace_background_img(self.beautiful_soup.prettify())
      content = html.unescape(content)
      
      if self._loadStatic:
         content = f"{{% load static %}}\n\n{content}"
         
      self._bs = None
            
      return content

I could check the issue and create a PR for this. But not sure if this is the main issue (not tested yet)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions