{ "info": { "author": "British Antarctic Survey", "author_email": "webapps@bas.ac.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: Other/Proprietary License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# BAS Style Kit Jinja Templates\n\nA set of [Jinja2](http://jinja.pocoo.org) templates implementing the [BAS Style Kit](https://style-kit.web.bas.ac.uk).\n\n## Installation\n\n### Pip package\n\nThe recommended way to get these templates is installing its PyPi package, \n[`bas-style-kit-jekyll-templates`](https://pypi.org/project/bas-style-kit-jinja-templates/).\n\n## Usage\n\n### Quickstart\n\nFor a typical Flask application add this wherever your Flask application is defined:\n\n```python\nfrom flask import Flask, render_template\nfrom jinja2 import PrefixLoader, PackageLoader, FileSystemLoader\n\nfrom bas_style_kit_jinja_templates import BskTemplates\n\napp = Flask(__name__)\napp.jinja_loader = PrefixLoader({\n 'app': FileSystemLoader('templates'),\n 'bas_style_kit': PackageLoader('bas_style_kit_jinja_templates'),\n})\napp.config['bsk_templates'] = BskTemplates()\n\n# Required/recommended settings\napp.config['bsk_templates'].site_title = 'Example service'\napp.config['bsk_templates'].site_description = 'Service to act as an example'\napp.config['bsk_templates'].bsk_site_nav_brand_text = 'Example service'\napp.config['bsk_templates'].bsk_site_development_phase = 'beta'\napp.config['bsk_templates'].bsk_site_feedback_href = '/feedback'\napp.config['bsk_templates'].bsk_site_footer_policies_cookies_href = '/legal/cookies'\napp.config['bsk_templates'].bsk_site_footer_policies_copyright_href = '/legal/copyright'\napp.config['bsk_templates'].bsk_site_footer_policies_privacy_href = '/legal/privacy'\n\n# Optional - add a custom CSS file with a relative URL\napp.config['bsk_templates'].site_styles.append({'href': '/css/app.css'})\n# Optional - add a custom JS file with a SRI value\napp.config['bsk_templates'].site_scripts.append({'href': 'https://example.com/js/example.js', 'integrity': 'abc123'})\n# Optional - enable Google Analytics\napp.config['bsk_templates'].site_analytics['id'] = '1234'\n# Optional - choose between the `bsk-container` (used by default) and `bsk-container-fluid` layout container\napp.config['bsk_templates'].bsk_container_classes = ['bsk-container']\n# Optional - add navigation menu items\napp.config['bsk_templates'].bsk_site_nav_primary.append({'value': 'Item', 'href': '#'})\napp.config['bsk_templates'].bsk_site_nav_secondary.append({\n 'value': 'Dropdown', \n 'items': [\n {'value': 'Sub-item 1', 'href': '#', 'target': '_blank'}\n ]\n})\napp.config['bsk_templates'].bsk_site_nav_launcher.append({'value': 'Related service', 'href': 'https://example.com'})\n\n\n@app.route('/')\ndef index():\n # noinspection PyUnresolvedReferences\n return render_template(f\"app/index.j2\")\n```\n\nWhere `app/index.j2` is a template located in `templates/index.j2` which extends an application layout:\n\n```jinja2\n{% extends 'app/layouts/app.j2' %}\n{% block main_content %}\n

Index view content...

\n{% endblock %}\n```\n\nWhere `app/layouts/app.j2` is a template located in `templates/layouts/app.j2` which extends a layout provided by these\ntemplates:\n\n```jinja2\n{% exnteds 'bas_style_kit/layouts/bsk_standard.j2' %}\n```\n\n### Using a page pattern\n\nTo create a page in an application based on a [page pattern](#page-patterns), such as the \n[page not found](https://style-kit.web.bas.ac.uk/patterns/page-not-found/) pattern, create a template (e.g. \n`templates/errors/404.j2`) with the following:\n\n```jinja2\n{% extends 'bas_style_kit/patterns/bsk_page-not-found.j2' %}\n```\n\nTo use this template as the 404 error handler in a Flask application:\n\n```python\n@app.errorhandler(404)\ndef page_not_found(e):\n # note that we set the 404 status explicitly\n return render_template('app/errors/404.j2'), 404\n\n```\n\n### Using custom CSS/JS\n\nNon-Style Kit CSS an/or JavaScript resources can be included either as references to files, or as inline content.\n\n**Note:** This won't work if you are using the [Blank layout](#layouts).\n\n* CSS resources are outputted in the [styles block](#blocks), at the end of the `` element\n* JS resources are outputted in the [scripts block](#blocks), at the end of the `` element\n\n#### Using custom CSS/JS files\n\n* CSS files are added as a resource object to the `site_styles` property of the `BskTemplates` class instance\n* JS files are added as a resource object to the `site_scripts` property of the `BskTemplates` class instance\n\nFiles will be included after the Style Kit's own resources (where a Style Kit layout is used) to ensure they have \npriority.\n\nEach file reference consists of an object with these properties:\n\n| Property | Data Type | Required | Allowed Values | Example Value |\n| ----------- | --------- | -------- | -------------- | ----------------------------------------------------- |\n| `href` | String | Yes | Any URL | */css/app.css* / *https://example.com/js/app.js* |\n| `integrity` | String | No | Any SRI value | *sha256-ClILH8AIH4CkAybtlKhzqqQUYR4eSDiNTK5LIWfF4qQ=* |\n\nFor example (using a Flask application with a `css/app.css` file with the default \n[static files route](http://flask.pocoo.org/docs/1.0/tutorial/static/)):\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].site_styles.append({'href': '/static/css/app.css'})\n```\n\nThe `integrity` property is used to specify a \n[Subresource Integrity (SRI)](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) value for \na resource. If specified an `integrity` attribute and will be added to the generated markup. A `crossorigin` \nattribute will also be added for \n[Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) support with a \nhard-coded, anonymous, value.\n\n#### Using custom CSS/JS inline content\n\n* CSS content should be appended to the [styles block](#blocks)\n* JS content should be appended to the [scripts block](#blocks)\n* inline content will be added after any files to ensure they have priority\n\n**Note:** To append to a block use `{{ super() }}`, rather than replacing the contents of a block.\n\nFor example (using a Jinja template):\n\n```jinja2\n{% block scripts %}\n {{ super() }}\n console.log('jQuery version: ' + jQuery.fn.jquery);\n{% endblock %}\n```\n\n### Navigation menu items\n\nWhen using the [bsk_standard layout](#layouts), a [navbar](https://style-kit.web.bas.ac.uk/components/navbar/) is \nincluded as part of the 'standard header', which consists of a cookie banner, navbar and site development phase banner.\n\nThis navbar consists of three menus (and other elements, documented elsewhere):\n\n* a primary navigation menu - aligned left, after [brand elements](#navbar-branding)\n* a secondary navigation menu - aligned right, before the launcher menu\n* a navigation launcher menu - aligned right, after the secondary navigation menu\n\nThe navigation launcher is a restricted menu, used to link to other BAS websites and applications. By default it \ncontains links to the [BAS public website](https://www.bas.ac.uk) and the [BAS data catalogue](https://data.bas.ac.uk). \nOther websites and applications can be added as well where relevant.\n\n* primary navigation menu items should be added to the `BskTemplates.bsk_site_nav_primary` variable\n* secondary navigation menu items should be added to the `BskTemplates.bsk_site_nav_secondary` variable\n* navigation launcher menu items should be added to the `BskTemplates.bsk_site_nav_launcher` variable\n\nThe primary and secondary navigation menu's support:\n\n* [navbar items](https://style-kit.web.bas.ac.uk/components/navbar/#item)\n* [navbar drop-down menus](https://style-kit.web.bas.ac.uk/components/navbar/#drop-down-menus)\n* [navbar drop-down menu items](https://style-kit.web.bas.ac.uk/components/navbar/#drop-down-menus)\n\nThe navigation launcher menu, which is implemented as a drop-down menu, supports:\n\n* [navbar drop-down menu items](https://style-kit.web.bas.ac.uk/components/navbar/#drop-down-menus)\n\nMenu item objects have the following properties:\n\n| Property | Data Type | Required | Allowed Values | Example Value | Notes |\n| ----------- | --------- | -------- | -------------------------- | ------------------------------------------ | ------------------------------------- |\n| `value` | String | Yes | Any string | *About* | - |\n| `href` | String | Yes | Any URL | */about* / *https://www.example.com/about* | Ignored if `items` set |\n| `items` | Array | No | Array of menu item objects | - | Ignored for navigation launcher items |\n| *Any* | String | No | As per attribute | - | Arbitrary attribute/value key/values |\n\n**Note:** The `items` property is only recursed once, deeper objects will be ignored.\n\nFor example (using a Flask application):\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_nav_primary.push({'value': 'Item', 'href': '/about'})\napp.config['bsk_templates'].bsk_site_nav_primary.push({'value': 'Another Item', 'href': '#', 'target': '_blank'})\n```\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_nav_secondary.push({\n 'value': 'Dropdown', \n 'items': [\n {'value': 'Sub-item 1', 'href': 'https://www.example.com'}\n ]\n})\n```\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_nav_launcher.push({'value': 'Related service', 'href': 'https://example.com'})\n```\n\n#### Active navigation items\n\nThese templates will automatically add the `.bsk-active` class to the relevant navigation item, and if relevant, \nsub-item, where its `href` attribute exactly matches the current URL given by `{{ request.path }}`.\n\nFor example for a navigation item `{'value': 'About', 'href': '/about'}`, when visiting `https://www.example/about`,\nthe about navigation item will be made active, as the current path `/about` matches the `href` attribute.\n\nThis support doesn't support URL patterns, such as `/foo/{id}` where `{id}` is a dynamic value. In these cases the \n`active_nav_item` variable can be set to the `href` value of a navigation item to make it active explicitly.\n\nFor example (using flask application):\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_nav_primary.push({'value': 'Foo', 'href': '/foo'})\n\n@app.route('/foo/')\ndef foo_details(foo_id: str):\n foo = get_foo(foo_id)\n\n return render_template(f\"app/views/foo-details.j2\", foo=foo, active_nav_item='/foo')\n```\n\n### Navbar branding\n\nNavbars are used to display the name/identity of a website or application, to remind users where they are. These \nelements are referred to as 'brand' elements within the Style Kit.\n\nSupported brand elements:\n\n* [brand text](https://style-kit.web.bas.ac.uk/components/navbar/#brand-text) - set using the \n`BskTemplates.bsk_site_nav_brand_text` property\n* [brand image](https://style-kit.web.bas.ac.uk/components/navbar/#brand-image) - set using the \n`BskTemplates.bsk_site_nav_brand_img_href` property\n\nBrand elements can be used together or individually, with fix classes applied automatically as needed.\n\nBrand elements are linked to a location specified by the `bsk_attributes.site_nav_brand_href` variable, which should be,\nand is by default, the index of each website or application (i.e. `/`).\n\nFor example (using a Flask application):\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_nav_brand_text = 'Example service'\n```\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_nav_brand_img_href = '/assets/img/navbar-brand-img.png'\n```\n\n### Site development phase\n\nThe site development phase indicates the stage of development for a website or application, e.g. alpha or live.\nConventional phases are described in the \n[Style Kit documentation](https://style-kit.web.bas.ac.uk/core/colours/#development-phase-colours).\n\nFor websites or applications that are not firmly in the 'live' phase, a banner should be shown to inform users and \nrequest feedback. This forms part of the 'standard header' of cookie banner, navbar and site development phase banner.\n\nIn these templates, the `BskTemplates.bsk_site_development_phase` property is used to specify the current phase for a\nwebsite or application. When using the [bsk_standard layout](#layouts) the banner will be shown automatically.\n\nTo disable this banner, use the `live-stable`. Strictly speaking this isn't a real phase but is recommended by these \ntemplates to distinguish between a newly released or mature and well-established website or application.\n\nFor example (using a Flask application):\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_development_phase = 'beta'\n```\n\n#### Experimental site phase\n\nWhere a website or application is in a staging environment, or otherwise used for development/testing activities, the \nsite phase can be set to `experimental` to use the conventional \n[experimental phase](https://style-kit.web.bas.ac.uk/core/colours/#variants).\n\nFor example (using a Flask application):\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_development_phase = 'experimental'\n```\n\n### Google analytics\n\nTo include the Google Analytics universal tracking library (gtag), set the `BskTemplates.bsk_site_analytics['id']` \nproperty to relevant Google Analytics property ID.\n\n**Note:** When used the anonymise IP option in Google Analytics is enabled by default.\n\nFor example (using a Flask application):\n\n```python\napp.config['bsk_templates'] = BskTemplates()\napp.config['bsk_templates'].bsk_site_analytics['id'] = 'UA-12345678'\n```\n\n### Footer content\n\nAdd custom footer content to the `footer_content` block. It will be shown between the \n[divider](https://style-kit.web.bas.ac.uk/components/footer/#divider) and \n[Governance](https://style-kit.web.bas.ac.uk/components/footer/#governance) footer components.\n\nIt is recommended to include a [spacer](https://style-kit.web.bas.ac.uk/components/footer/#spacer) component after any\nfooter content to balance the whitespace within the footer.\n\nFor example:\n\n```jinja2\n{% block footer_content %}\n
Footer content
\n\n{% endblock %}\n```\n\nYou can also set custom classes on the footer element by appending to the `bsk_footer_classes` list, or replacing all \nclasses by overriding the list.\n\n## Components\n\nAll components are located in the `bas_style_kit_jinja_templates` package. Variables are \ndefined in `bas_style_kit_jinja_templates/__init__.py`, with all other components defined in \n`bas_style_kit_jinja_templates//templates/`.\n\nComponents that are specific to the Style Kit are prefixed with `bsk--` or `bsk_`.\n\n### Jinja setup\n\nThese templates requiring a *PrefixLoader* and *PackageLoader* \n[Jinja loader](http://jinja.pocoo.org/docs/2.10/api/#loaders).\n\n```python\nloader = PrefixLoader({\n 'bas_style_kit': PackageLoader('bas-style-kit-jekyll-templates')\n})\n```\n\nTypically your application with have its own templates as well, which can be loaded under a different prefix (such as \n`app`) using a relevant loader, such as the default *FileSystemloader*.\n\n```python\nloader = PrefixLoader({\n 'app': FileSystemLoader('templates'),\n 'bas_style_kit': PackageLoader('bas-style-kit-jekyll-templates')\n})\n```\n\nIn addition, a `BskTemplates` class instance is needed to define [Variable](#variables) values. This instance should be\navailable in the Jinja environment as `config.bsk_templates`. For Flask applications this will occur automatically by\nadding the class instance to `app.config`, otherwise this instance will need to be passed manually.\n\nFor example (using a Flask application):\n\n```python\napp.config['bsk_templates'] = BskTemplates()\n```\n\nWhere a *PrefixeLoader* is used, references to resources should include a prefix and a deliminator (`/` by default).\n\nFor example an application layout would change from:\n\n```jinja2\n{% extends \"layouts/base.j2\" %}\n```\n\nTo:\n\n```jinja2\n{% extends \"app/layouts/base.j2\" %}\n```\n\nTo use a layout from these templates:\n\n```jinja2\n{% extends \"bas_style_kit/layouts/bsk_base.j2\" %}\n```\n\n### Layouts\n\nLayouts are 'base' templates from which views or other layouts inherit. Layouts in these templates are hierarchical,\nwith each layout extending the last in this order:\n\n1. `blank.j2`: lowest level layout, intentionally as minimal as possible and not intended for direct use, unless \n non-HTML output is needed\n2. `html.j2`: defines a minimal, accessible, HTML5 structure with some recommended best practices for cross-platform \n compatibility\n3. `bsk_base.j2`: intentionally implements the BAS Style Kit as minimally as possible and not intended for direct use,\n unless the `bsk_standard.j2` layout is unsuitable\n4. `bsk_standard.j2`: defines an opinionated, conventional, page layout with a 'standard' header/footer, recommended as\n a base for application/website layouts\n\nLayouts can be used using the `extend` keyword and defining content in the relevant block:\n\n| Layout | Content Block |\n| ----------------- | -------------- |\n| `blank.j2` | `content` |\n| `html.j2` | `main_content` |\n| `bsk_base.j2` | `main_content` |\n| `bsk_standard.j2` | `main_content` |\n\nFor example:\n\n```jinja2\n{% extends 'bas_style_kit/layouts/bsk_standard.j2' %}\n\n{% block main_content %}\nLayout content\n{% endblock %}\n```\n\n### Blocks\n\n[Blocks](http://jinja.pocoo.org/docs/2.10/templates/#template-inheritance) are used for template inheritance and provide \na logical structure/hierarchy.\n\nBlocks are defined in [Layouts](#layouts), typically with default content using [Includes](#includes). Some blocks are \nempty, designed for user content or extensibility.\n\nTo implement or override a block, redefine it in a template or view:\n\n```jinja2\n{% block example_block %}\ncontent ...\n{% endblock %}\n```\n\nTo append to a block, without overriding its existing content, use the special `{{ super() }}` variable:\n\n```jinja2\n{% block example_block %}\n{{ super() }}\ncontent ...\n{% endblock %}\n```\n\n### Includes\n\n[Includes](http://jinja.pocoo.org/docs/2.10/templates/#include) are used for organising content, to make management \neasier, and to allow common elements to be used in multiple places, typically in [Blocks](#blocks).\n\nFor example the content needed for [using Google Analytics](#google-analytics) is encapsulated in the \n`body--analytics-script.j2` include.\n\n### Macros\n\n[Macros](http://jinja.pocoo.org/docs/2.10/templates/#macros) are used to provide configurable, reusable, functionality.\n\nFor example, primary and secondary [navigation menus](#navigation-menu-items) process navigation items the same way, \nusing the `bsk--nav.j2` macro.\n\n### Variables\n\nVarious elements in these templates are configurable, such as the name of the application or website, or the CSS/JS \nresources to include. A Python class `BskTemplates` is used to configure these elements and which should be passed to \nthe [Jinja environment](#jinja-setup).\n\nThese variables should be changed or set for each website or application:\n\n`site_title`\n: Name of the application or website\n\n`site_description`\n: Description of the application or website\n\n`site_analytics.id`\n: Google Analytics property ID\n\n`bsk_site_nav_brand_text`\n: Name of the application or website\n\n`bsk_site_nav_primary`\n: [Primary navigation menu items](#navigation-menu-items)\n\n`bsk_site_development_phase`\n: [Site development phase](#site-development-phase)\n\n`bsk_site_feedback_href`\n: URL or `mailto:` value for application or website feedback\n\n`bsk_site_footer_policies_cookies_href`\n: URL to application or website cookies policy\n\n`bsk_site_footer_policies_copyright_href`\n: URL to application or website copyright notice\n\n`bsk_site_footer_policies_privacy_href`\n: URL to application or website privacy policy\n\nThese variables may, but don't need to be, changed or set for each website or application:\n\n`site_styles`\n: Array of additional CSS files\n\n`site_scripts`\n: Array of additional JS files\n\n`container_classes`\n: Array of non-Style Kit classes which set the layout of content, including main content and headers/footers which \n should align the same way\n\n`main_content_classes`\n: Array of non-Style Kit classes which should only be applied to main page content\n\n`bsk_container_classes`\n: Array of Style Kit classes which should set the layout of content, including main content and headers/footers which \n should align the same way\n\n`bsk_main_content_classes`\n: Array of Style Kit classes which should only be applied to main page content\n\n`bsk_footer_classes`\n: Array of Style Kit classes which should be applied to the standard footer element\n\n`bsk_site_favicon`\n: Name of the [Favicon](https://style-kit.web.bas.ac.uk/core/favicon) to include (valid options: [`default`])\n\n`bsk_site_nav_secondary`\n: [Secondary navigation menu items](#navigation-menu-items)\n\n`bsk_site_nav_brand_img_href`\n: URL to [Navbar brand image](#navbar-branding)\n\n`bsk_site_nav_brand_href`\n: URL for [Navbar brand elements](#navbar-branding), which should be the index or home of the application or website\n\n`bsk_site_nav_launcher`\n: [Navigation launcher items](#navigation-menu-items)\n\nThese variables do not normally, and should not, need to be changed or set:\n\n`site_back_to_top_target_id`\n: ID of the anchor element representing the top of the current page/view\n\n`site_main_content_target_id`\n: ID of the element representing the main content in a page/view (i.e. skipping navigation elements)\n\n`bsk_site_footer_ogl_symbol_a_href`\n: URL to the Open Government Licence symbol\n\n`bsk_site_footer_ogl_text_href`\n: URL to the Open Government Licence text (i.e. the actual licence)\n\n`bsk_site_footer_ogl_text_version`\n: Version of the Open Government Licence used\n\nThese variables must not be changed and should be treated as read only:\n\n`templates_version`\n: Version of these templates\n\n`bsk_version`\n: Version of the Style Kit used by these templates\n\n### Patterns\n\n[Patterns](https://style-kit.web.bas.ac.uk/patterns/) demonstrate preferred ways to ask information from, or \nprovide information to, end users for various tasks. \n\n#### Page patterns\n\nPage patterns define content for common pages such as [*Page not found* (404) pages](#using-a-page-pattern).\n\nThese templates implement page patterns as layouts/views, typically without the need to provide additional information.\nWhere additional information is available, such as contact instructions or details about current maintenance etc., the\n`pattern_content` block can be used.\n\nFor example:\n\n```jinja2\n{% extends 'bas_style_kit/patterns/bsk_service-unavailable.j2' %}\n\n{% block pattern_content %}\nAdditional information clarifying details or circumstances.\n{% endblock %}\n```\n\nSome patterns support multiple variants, or can be configured, using variables and blocks described here.\n\n##### Service unavailable\n\nVariables:\n\n`availability`\n: Set to `replaced` for the [replaced](https://style-kit.web.bas.ac.uk/patterns/service-unavailable/#replaced) variant.\n Set to `closed` for the [closed](https://style-kit.web.bas.ac.uk/patterns/service-unavailable/#closed) variant.\n\nFor example:\n\n(basic variant)\n\n```jinja2\n{% extends 'bas_style_kit/patterns/bsk_service-unavailable.j2' %}\n\n{% block pattern_content %}\nContact the BAS IT Service Desk for more information.\n{% endblock %}\n```\n\n(closed variant)\n\n```jinja2\n{% extends 'bas_style_kit/patterns/bsk_service-unavailable.j2' %}\n\n{% set availability = 'closed' %}\n\n{% block pattern_content %}\nContact the BAS IT Service Desk for more information.\n{% endblock %}\n```\n\n##### Start\n\nVariables:\n\n`call_to_action_url`\n: Set to the href the call to action button should go to\n\n`call_to_action_variant`\n: Set to `default` for a standard 'start now' call to action button\n Set to `sign-in-microsoft` for a combined 'sign-in to continue' and 'start now' button\n\nBlocks:\n\n`pattern_content_uses`\n: Set to an unordered list of items for the 'use this service to:' list\n\n`pattern_content`\n: Additional, optional, content such as 'before you begin' or 'more information' sections\n\nFor example:\n\n(basic variant)\n\n```jinja2\n{% extends 'bas_style_kit/patterns/bsk_start.j2' %}\n\n{% set call_to_action_url = '#' %}\n\n{% block pattern_content_uses %}\n\n{% endblock %}\n```\n\n(more information variant)\n\n```jinja2\n{% extends 'bas_style_kit/patterns/bsk_start.j2' %}\n\n{% set call_to_action_url = '#' %}\n{% set call_to_action_variant = 'sign-in-microsoft' %}\n\n{% block pattern_content_uses %}\n \n{% endblock %}\n\n{% block pattern_content %}\n
\n

Before you start

\n

Before you start information

\n
\n
\n

More information

\n

More information

\n
\n{% endblock %}\n```\n\n##### Sign-in (Microsoft)\n\nVariables:\n\n`call_to_action_url`\n: Set to the href the call to action button should go to\n\nBlocks:\n\n`pattern_content`\n: Additional, optional, content such as 'before you begin' or 'more information' sections\n\nFor example:\n\n(basic variant)\n\n```jinja2\n{% extends 'bas_style_kit/patterns/bsk_sign-in-microsoft.j2' %}\n\n{% set call_to_action_url = '#' %}\n```\n\n## Development\n\nA docker container ran through Docker Compose is used as a development environment for this project. It includes \ndevelopment only dependencies listed in `requirements.txt` and a local Flask application in `app.py`.\n\nEnsure classes and methods are defined within the `bas_style_kit_jinja_templates` package.\n\nIf you have access to the BAS GitLab instance, you pull the Docker image from the BAS Docker Registry:\n\n```shell\n$ docker login docker-registry.data.bas.ac.uk\n$ docker-compose pull\n\n# To run the local Flask application using the Flask development server\n$ docker-compose up\n\n# To start a shell\n$ docker-compose run app ash\n```\n\n### Code Style\n\nPEP-8 style and formatting guidelines must be used for this project, with the exception of the 80 character line limit.\n\n[Flake8](http://flake8.pycqa.org/) is used to ensure compliance, and is ran on each commit through \n[Continuous Integration](#continuous-integration). \n\nTo check compliance locally:\n\n```shell\n$ docker-compose run app flake8 . --ignore=E501\n```\n\n### Dependencies\n\nDevelopment Python dependencies should be declared in `requirements.txt` to be included in the development environment.\n\nRuntime Python dependencies should be declared in `requirements.txt` and `setup.py` to also be installed as dependencies \nof this package in other applications.\n\nAll dependencies should be periodically reviewed and update as new versions are released.\n\n```shell\n$ docker-compose run app ash\n$ pip install [dependency]==\n# this will display a list of available versions, add the latest to `requirements.txt` and or `setup.py`\n$ exit\n$ docker-compose down\n$ docker-compose build\n```\n\nIf you have access to the BAS GitLab instance, push the Docker image to the BAS Docker Registry:\n\n```shell\n$ docker login docker-registry.data.bas.ac.uk\n$ docker-compose push\n```\n\n#### Dependency vulnerability scanning\n\nTo ensure the security of this API, all dependencies are checked against \n[Snyk](https://app.snyk.io/org/antarctica/project/2c147086-c928-4f0b-9639-2b865db91a60) for vulnerabilities.\n\n**Warning:** Snyk relies on known vulnerabilities and can't check for issues that are not in it's database. \nAs with all security tools, Snyk is an aid for spotting common mistakes, not a guarantee of secure code.\n\nSome vulnerabilities have been ignored in this project, see `.snyk` for definitions and the \n[Dependency exceptions](#dependency-vulnerability-exceptions) section for more information.\n\nThrough [Continuous Integration](#continuous-integration), on each commit current dependencies are tested and a \nsnapshot uploaded to Snyk. This snapshot is then monitored for vulnerabilities.\n\n#### Dependency vulnerability exceptions\n\nThis project contains known vulnerabilities that have been ignored for a specific reason.\n\n* [Py-Yaml `yaml.load()` function allows Arbitrary Code Execution](https://snyk.io/vuln/SNYK-PYTHON-PYYAML-42159)\n * currently no known or planned resolution\n * indirect dependency, required through the `bandit` package\n * severity is rated *high*\n * risk judged to be *low* as we don't use the Yaml module in this application\n * ignored for 1 year for re-review\n\n#### Static security scanning\n\nTo ensure the security of this API, source code is checked against Bandit for issues such as not sanitising user inputs \nor using weak cryptography.\n\n**Warning:** Bandit is a static analysis tool and can't check for issues that are only be detectable when running the \napplication. As with all security tools, Bandit is an aid for spotting common mistakes, not a guarantee of secure code.\n\nThrough [Continuous Integration](#continuous-integration), each commit is tested.\n\nTo check locally:\n\n```shell\n$ docker-compose run app bandit -r .\n```\n\n## Testing\n\n### Continuous Integration\n\nAll commits will trigger a Continuous Integration process using GitLab's CI/CD platform, configured in `.gitlab-ci.yml`.\n\nPip dependencies are also [checked and monitored for vulnerabilities](#dependency-vulnerability-scanning).\n\n## Distribution\n\nBoth source and binary versions of the package are build using [SetupTools](https://setuptools.readthedocs.io/), which \ncan then be published to the [Python package index](https://pypi.org/project/bas-style-kit-jinja-templates/) for use in \nother applications. Package settings are defined in `setup.py`.\n\nThis project is built and published to PyPi automatically through [Continuous Deployment](#continuous-deployment).\n\nTo build the source and binary artefacts for this project manually:\n\n```shell\n$ docker-compose run app ash\n# build package to /build, /dist and /bas_style_kit_jinja_templates.egg-info\n$ python setup.py sdist bdist_wheel\n$ exit\n$ docker-compose down\n```\n\nTo publish built artefacts for this project manually to [PyPi testing](https://test.pypi.org/):\n\n```shell\n$ docker-compose run app ash\n$ python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*\n# project then available at: https://test.pypi.org/project/bas-style-kit-jinja-templates/\n$ exit\n$ docker-compose down\n```\n\nTo publish manually to [PyPi](https://pypi.org/):\n\n```shell\n$ docker-compose run app ash\n$ python -m twine upload --repository-url https://pypi.org/legacy/ dist/*\n# project then available at: https://pypi.org/project/bas-style-kit-jinja-templates/\n$ exit\n$ docker-compose down\n```\n\n### Continuous Deployment\n\nA Continuous Deployment process using GitLab's CI/CD platform is configured in `.gitlab-ci.yml`. This will:\n\n* build the source and binary artefacts for this project\n* publish built artefacts for this project to the relevant PyPi repository\n\nThis process will deploy changes to [PyPi testing](https://test.pypi.org/) on all commits to the master branch.\n\nThis process will deploy changes to [PyPi](https://pypi.org/) on all tagged commits.\n\n## Release procedure\n\n### At release:\n\n1. create a `release` branch\n2. close release in CHANGELOG.md\n3. push changes, merge the `release` branch into `master` and tag with version\n\nThe project will be built and published to PyPi automatically through [Continuous Deployment](#continuous-deployment).\n\n### After release:\n\n1. create a `next-release` branch\n2. bump `templates_version` variable in `bas_style_kit_jinja_templates/__init__.py`\n2. push changes and merge the `next-release` branch into `master`\n\n## Feedback\n\nThe maintainer of this project is the BAS Web & Applications Team, they can be contacted at: \n[servicedesk@bas.ac.uk](mailto:servicedesk@bas.ac.uk).\n\n## Issue tracking\n\nThis project uses issue tracking, see the \n[Issue tracker](https://gitlab.data.bas.ac.uk/web-apps/bsk/bas-style-kit-jinja2-templates/issues) for more information.\n\n**Note:** Read & write access to this issue tracker is restricted. Contact the project maintainer to request access.\n\n## License\n\n\u00a9 UK Research and Innovation (UKRI), 2019, British Antarctic Survey.\n\nYou may use and re-use this software and associated documentation files free of charge in any format or medium, under \nthe terms of the Open Government Licence v3.0.\n\nYou may obtain a copy of the Open Government Licence at\n[http://www.nationalarchives.gov.uk/doc/open-government-licence/](http://www.nationalarchives.gov.uk/doc/open-government-licence/)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/antarctica/bas-style-kit-jinja-templates", "keywords": "", "license": "Open Government Licence v3.0", "maintainer": "", "maintainer_email": "", "name": "bas-style-kit-jinja-templates", "package_url": "https://pypi.org/project/bas-style-kit-jinja-templates/", "platform": "", "project_url": "https://pypi.org/project/bas-style-kit-jinja-templates/", "project_urls": { "Homepage": "https://github.com/antarctica/bas-style-kit-jinja-templates" }, "release_url": "https://pypi.org/project/bas-style-kit-jinja-templates/0.4.0/", "requires_dist": null, "requires_python": "", "summary": "A set of Jinja2 templates implementing the BAS Style Kit", "version": "0.4.0" }, "last_serial": 5477223, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6f722fe8c024784e70be40670a35617b", "sha256": "232917a6e0d3cd50e402a7eca7b5d6d47073dd4de76aef92e521cf4f52111b0a" }, "downloads": -1, "filename": "bas_style_kit_jinja_templates-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6f722fe8c024784e70be40670a35617b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22172, "upload_time": "2019-04-10T21:27:41", "url": "https://files.pythonhosted.org/packages/44/79/b97fbc7eb96358459de7279ce4bbdaae67f60efcbf513f0ea2acb55c7970/bas_style_kit_jinja_templates-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "594395c44541a3fdb3d7a9d9a9b258d4", "sha256": "6a8afad899f96dd94b7b82f8fd466db9f970aec22364f4454143dc1cd5b015ba" }, "downloads": -1, "filename": "bas-style-kit-jinja-templates-0.1.0.tar.gz", "has_sig": false, "md5_digest": "594395c44541a3fdb3d7a9d9a9b258d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30165, "upload_time": "2019-04-10T21:27:44", "url": "https://files.pythonhosted.org/packages/ba/41/edfa13af9c3829ff88b5228466d8ea27ef4fff3211e3e9df2a5fd5acb43b/bas-style-kit-jinja-templates-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "fe339cefe6be2f44bf15cfae8726f754", "sha256": "72b6326a8eec7dac38904da23be6dca7fe8efd354a2e9cc81ba699bbc2108710" }, "downloads": -1, "filename": "bas_style_kit_jinja_templates-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "fe339cefe6be2f44bf15cfae8726f754", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23592, "upload_time": "2019-04-26T08:24:09", "url": "https://files.pythonhosted.org/packages/ce/6a/cf59d31d74460c9ed59efec7fdfadfa3b403f3b9763dfc284b933a91b41e/bas_style_kit_jinja_templates-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a1442cf6f3f575a1a222c7f1f588d308", "sha256": "2083b29d76ced184c60e2a5f7cf5ed1513be5bef6aa5ef59aff896a20dd58806" }, "downloads": -1, "filename": "bas-style-kit-jinja-templates-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a1442cf6f3f575a1a222c7f1f588d308", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31314, "upload_time": "2019-04-26T08:24:11", "url": "https://files.pythonhosted.org/packages/df/fc/bc6900a77d4d487a1856676734f0dbc3d7ee20fdf1c52ec68426ef7db823/bas-style-kit-jinja-templates-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "09fb15f7fc13cf8f00f87949900af11a", "sha256": "6042ea6198eab650b48f84bd4d69fd1a4cefe3026e495bde4387b8aac960e5df" }, "downloads": -1, "filename": "bas_style_kit_jinja_templates-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "09fb15f7fc13cf8f00f87949900af11a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24126, "upload_time": "2019-05-03T08:23:22", "url": "https://files.pythonhosted.org/packages/bc/71/560bb81f4e4b5d60d2d6983a0d2f1f8a00698836e682d2fc5d3bf646ad70/bas_style_kit_jinja_templates-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "362cbba133c302ad21ca342f2debef7f", "sha256": "5136206aaf936c4d19f201c3670fca68edd19fb3b59765b2708b55c3e8db262d" }, "downloads": -1, "filename": "bas-style-kit-jinja-templates-0.3.0.tar.gz", "has_sig": false, "md5_digest": "362cbba133c302ad21ca342f2debef7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32579, "upload_time": "2019-05-03T08:23:24", "url": "https://files.pythonhosted.org/packages/80/04/0ce4eac449edd114bb9c90ac0632b5968ce01547a1b47b999594e55fe2c9/bas-style-kit-jinja-templates-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "6d0e3ebd86c41c55d4edbe102a789690", "sha256": "a9d2d9209dcc1ff9ef8adfccca67fa0962f6ff71b81bca5cb7a7411b459a16ab" }, "downloads": -1, "filename": "bas_style_kit_jinja_templates-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6d0e3ebd86c41c55d4edbe102a789690", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26181, "upload_time": "2019-07-02T15:01:13", "url": "https://files.pythonhosted.org/packages/a5/84/4a9ba2d6882c8f27ab1600ec1600ea939ab4c05b8eacf552788118047799/bas_style_kit_jinja_templates-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd24ff42053a9d0b2e7dc3821bf8a742", "sha256": "5916ef6ffbcfe010429da93d2b823fd555bdcd97039e7f47bd7c2c7e6f49aad7" }, "downloads": -1, "filename": "bas-style-kit-jinja-templates-0.4.0.tar.gz", "has_sig": false, "md5_digest": "fd24ff42053a9d0b2e7dc3821bf8a742", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34654, "upload_time": "2019-07-02T15:01:15", "url": "https://files.pythonhosted.org/packages/33/99/44fb507caa84d407435c98f6b78e2c4e6a690c9fd11a549e80e75b41ccd5/bas-style-kit-jinja-templates-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6d0e3ebd86c41c55d4edbe102a789690", "sha256": "a9d2d9209dcc1ff9ef8adfccca67fa0962f6ff71b81bca5cb7a7411b459a16ab" }, "downloads": -1, "filename": "bas_style_kit_jinja_templates-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6d0e3ebd86c41c55d4edbe102a789690", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26181, "upload_time": "2019-07-02T15:01:13", "url": "https://files.pythonhosted.org/packages/a5/84/4a9ba2d6882c8f27ab1600ec1600ea939ab4c05b8eacf552788118047799/bas_style_kit_jinja_templates-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd24ff42053a9d0b2e7dc3821bf8a742", "sha256": "5916ef6ffbcfe010429da93d2b823fd555bdcd97039e7f47bd7c2c7e6f49aad7" }, "downloads": -1, "filename": "bas-style-kit-jinja-templates-0.4.0.tar.gz", "has_sig": false, "md5_digest": "fd24ff42053a9d0b2e7dc3821bf8a742", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34654, "upload_time": "2019-07-02T15:01:15", "url": "https://files.pythonhosted.org/packages/33/99/44fb507caa84d407435c98f6b78e2c4e6a690c9fd11a549e80e75b41ccd5/bas-style-kit-jinja-templates-0.4.0.tar.gz" } ] }