diff --git a/examples/README.rst b/examples/README.rst index 2000dc01..8348d8c6 100644 --- a/examples/README.rst +++ b/examples/README.rst @@ -30,3 +30,20 @@ Live demos of the latest release are: - `Examples with Bootstrap 4 `_ - `Examples with Bootstrap 5 `_ + +Overview of icons +----------------- + +The example applications contain a page called icons which gives an overview +of all icons supported by this version of Bootstrap-Flask. This overview can be +used for testing purposes but is also offline documentation on the icons +available. + +When Bootstrap-Flask updates the icon file, the overview page can be upgraded +with: + + +.. code-block:: bash + + $ python3 update-icons.py + diff --git a/examples/bootstrap4/app.py b/examples/bootstrap4/app.py index 62143dff..74f75247 100644 --- a/examples/bootstrap4/app.py +++ b/examples/bootstrap4/app.py @@ -230,5 +230,10 @@ def test_icon(): return render_template('icon.html') +@app.route('/icons') +def test_icons(): + return render_template('icons.html') + + if __name__ == '__main__': app.run(debug=True) diff --git a/examples/bootstrap4/templates/base.html b/examples/bootstrap4/templates/base.html index 34387dd0..079b2779 100644 --- a/examples/bootstrap4/templates/base.html +++ b/examples/bootstrap4/templates/base.html @@ -36,6 +36,7 @@ {{ render_nav_item('test_flash', 'Flash Messages', use_li=True) }} {{ render_nav_item('test_table', 'Table', use_li=True) }} {{ render_nav_item('test_icon', 'Icon', use_li=True) }} + {{ render_nav_item('test_icons', 'Icons', use_li=True) }} diff --git a/examples/bootstrap4/templates/icons.html b/examples/bootstrap4/templates/icons.html new file mode 100644 index 00000000..f8ac4cde --- /dev/null +++ b/examples/bootstrap4/templates/icons.html @@ -0,0 +1,15230 @@ + +{% extends 'base.html' %} +{% from 'bootstrap4/utils.html' import render_icon %} + +{% block content %} +

Icons

+

These are all the icons which are currently supported by Bootstrap-Flask.

+ +{% endblock %} diff --git a/examples/bootstrap4/templates/index.html b/examples/bootstrap4/templates/index.html index b49c1f89..ccef8c5b 100644 --- a/examples/bootstrap4/templates/index.html +++ b/examples/bootstrap4/templates/index.html @@ -10,5 +10,6 @@

Bootstrap-Flask Demo Application

  • Flash Messages
  • Table
  • Icon
  • +
  • Icons
  • {% endblock %} diff --git a/examples/bootstrap5/app.py b/examples/bootstrap5/app.py index 40658365..21a9dc65 100644 --- a/examples/bootstrap5/app.py +++ b/examples/bootstrap5/app.py @@ -230,5 +230,10 @@ def test_icon(): return render_template('icon.html') +@app.route('/icons') +def test_icons(): + return render_template('icons.html') + + if __name__ == '__main__': app.run(debug=True) diff --git a/examples/bootstrap5/templates/base.html b/examples/bootstrap5/templates/base.html index 3cf31268..8c5c5530 100644 --- a/examples/bootstrap5/templates/base.html +++ b/examples/bootstrap5/templates/base.html @@ -37,6 +37,7 @@ {{ render_nav_item('test_flash', 'Flash Messages', use_li=True) }} {{ render_nav_item('test_table', 'Table', use_li=True) }} {{ render_nav_item('test_icon', 'Icon', use_li=True) }} + {{ render_nav_item('test_icons', 'Icons', use_li=True) }} diff --git a/examples/bootstrap5/templates/icons.html b/examples/bootstrap5/templates/icons.html new file mode 100644 index 00000000..ba9cb72d --- /dev/null +++ b/examples/bootstrap5/templates/icons.html @@ -0,0 +1,15230 @@ + +{% extends 'base.html' %} +{% from 'bootstrap5/utils.html' import render_icon %} + +{% block content %} +

    Icons

    +

    These are all the icons which are currently supported by Bootstrap-Flask.

    + +{% endblock %} diff --git a/examples/bootstrap5/templates/index.html b/examples/bootstrap5/templates/index.html index a9dcdead..35718984 100644 --- a/examples/bootstrap5/templates/index.html +++ b/examples/bootstrap5/templates/index.html @@ -10,5 +10,6 @@

    Bootstrap-Flask Demo Application

  • Flash Messages
  • Table
  • Icon
  • +
  • Icons
  • {% endblock %} diff --git a/examples/update-icons.py b/examples/update-icons.py new file mode 100644 index 00000000..370621c4 --- /dev/null +++ b/examples/update-icons.py @@ -0,0 +1,47 @@ +'''Generate example page with overview of all icons.''' + +from lxml import etree + +def parse(filename): + '''Parse SVG file containing icons.''' + symbols = set() + data = etree.parse(filename) + svg = data.getroot() + for symbol in svg: + symbols.add(symbol.attrib['id']) + return sorted(symbols) + +def generate(version): + '''Write the HTML template file.''' + head = f''' +{{% extends 'base.html' %}} +{{% from 'bootstrap{version}/utils.html' import render_icon %}} + +{{% block content %}} +

    Icons

    +

    These are all the icons which are currently supported by Bootstrap-Flask.

    + +{% endblock %} +''' + file.write(tail) + +for value in (4, 5): + generate(value)