GithubHelp home page GithubHelp logo

lingster / django-bootstrap-studio-tools Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 12.0 24 KB

A collection of scripts/tools to help export from Bootstrap Studio(BSS) to django template format

License: MIT License

HTML 18.98% Python 66.70% Shell 14.32%

django-bootstrap-studio-tools's People

Contributors

cheoppy avatar dependabot[bot] avatar lingster avatar sojohnnysaid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

django-bootstrap-studio-tools's Issues

Avoid sourcing venv, create custom environment ?

For the export script, I think you should avoid this line :
source ~/venv/django-bss-tools/bin/activate

It's too specific to user environment, and it will create trouble for peoples.

I had an idea to solve this problem. Bootstrap studio do not allow passing arguments, it could have been great to specify different kind of environment.

Instead, you can create a kind of env file with some custom settings, and with for example information about the expected environment.

dj-ref with empty content

Conversion of variable reference will fail if the tag body is empty, e.g. <h1 dj-ref="blabla"></h1>.

Like #11, string will be None, so nothing will append.

If I add a space inside h1, it works.

Perhaps not so important if BSS always prettify his html.

dj-ref with multiple childrens

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 + ' }}')      

Argv usage dangerous.

You're selecting filename with infile = sys.argv[-1].

In normal usage, called by BSS, it won't create any trouble. However, if image you're using it as standalone, or if something wrong occur and no argument is given, you're going to select argv[0], the script filename.

It will rewrite the export.py file.
Some condition must be added, raise en error if there isn't the right number of arguments, whatever.

for loop mecanism

I was wondering when you are working on BSS and creating dj-for element, inside BSS you will have a single element ?

Imagine it's for single column, you create the first one with dj-for, and that's all ? You can't get multiples columns in BSS to see how it looks like ?

Seem to work like that, but would be great to have in BSS an overview of what it will look like with generate data of a loop.

export.py : Avoid conditional check in for loops

You have the same useless condition in each loop :
For exemple:

for div in soup.find_all(attrs={"dj-load": True}):
    if div:
        forline = "{% load " + div.get('dj-load') + " %}"
        div.insert_before(forline)
        del div

The if div condition make no sense, you will have a div for each loop, or won't go inside the for loop if it won't find anything.
You can remove if condition for each loop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.