lingster / django-bootstrap-studio-tools Goto Github PK
View Code? Open in Web Editor NEWA collection of scripts/tools to help export from Bootstrap Studio(BSS) to django template format
License: MIT License
A collection of scripts/tools to help export from Bootstrap Studio(BSS) to django template format
License: MIT License
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.
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.
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 + ' }}')
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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.