Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: textbook/bulrush
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.2
Choose a base ref
...
head repository: textbook/bulrush
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 19 commits
  • 12 files changed
  • 6 contributors

Commits on Apr 29, 2019

  1. adding my website to the examples list

    added smalldata.dev to the examples list
    philshem authored and textbook committed Apr 29, 2019
    Copy the full SHA
    04f8e12 View commit details
  2. Update "In use" list

    A few of those sites have switched theme or 404 now
    textbook authored Apr 29, 2019
    Copy the full SHA
    fa3b79f View commit details

Commits on Jun 14, 2019

  1. Copy the full SHA
    83b6c8b View commit details
  2. Copy the full SHA
    d3ebc27 View commit details
  3. Bump Bulma version

    textbook committed Jun 14, 2019
    Copy the full SHA
    ef600c4 View commit details
  4. Copy the full SHA
    226a3ec View commit details

Commits on Apr 16, 2020

  1. Add my personal site that uses bulrush

    amitness authored and textbook committed Apr 16, 2020
    Copy the full SHA
    9128921 View commit details

Commits on May 10, 2020

  1. Copy the full SHA
    19738dd View commit details

Commits on Aug 27, 2020

  1. Update README.md

    I removed my personal site (https://smalldata.dev) because I've switched to Hugo.
    
    Thanks for the great theme!
    philshem authored and textbook committed Aug 27, 2020
    Copy the full SHA
    c97b328 View commit details

Commits on Nov 3, 2020

  1. Copy the full SHA
    245039f View commit details

Commits on Nov 23, 2020

  1. Add option to show only article summary (fixes #13)

    Set BULRUSH_SHOW_SUMMARY to show a summary, rather than the full article, on
    index, category and tag pages.
    textbook committed Nov 23, 2020
    Copy the full SHA
    8ecc9c2 View commit details

Commits on Mar 5, 2021

  1. page.html: include <article> as expected in CSS

    Closes #31
    thammegowda authored and textbook committed Mar 5, 2021
    Copy the full SHA
    53aa934 View commit details
  2. Cut v0.5.0 release

    textbook committed Mar 5, 2021
    Copy the full SHA
    32a08fb View commit details

Commits on May 15, 2022

  1. Import Mapping ABC from collections.abc

    The aliases for the ABCs in collections were deprecated, and have been
    removed in Python 3.10:
    
    https://docs.python.org/3/whatsnew/3.10.html#removed
    textbook committed May 15, 2022
    Copy the full SHA
    9c210fb View commit details
  2. Cut v0.5.1 release

    textbook committed May 15, 2022
    Copy the full SHA
    9fadf62 View commit details
  3. Remove requirement on jinja2.ext.with_

    The WithExtension is built-in and ext.with_ is deprecated. It was removed in 3.1.0:
    
    https://github.com/pallets/jinja/blob/main/CHANGES.rst\#version-310
    textbook committed May 15, 2022
    Copy the full SHA
    9ef3bfb View commit details
  4. Cut v0.5.2 release

    textbook committed May 15, 2022
    Copy the full SHA
    381e9eb View commit details

Commits on Apr 29, 2023

  1. Upgrade Bulma to latest

    textbook committed Apr 29, 2023
    Copy the full SHA
    ec101d4 View commit details
  2. Add Mermaid support

    textbook committed Apr 29, 2023
    Copy the full SHA
    7a2832c View commit details
Showing with 127 additions and 61 deletions.
  1. +2 −0 .gitignore
  2. +8 −3 .travis.yml
  3. +61 −26 README.md
  4. +1 −1 bulrush/__init__.py
  5. +1 −1 bulrush/license_generator.py
  6. +8 −19 bulrush/templates/base.html
  7. +6 −1 bulrush/templates/index.html
  8. +13 −0 bulrush/templates/mermaid.html
  9. +7 −5 bulrush/templates/page.html
  10. +17 −1 bulrush/templates/social.html
  11. +3 −3 setup.py
  12. +0 −1 tests/test_exports.py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -134,3 +134,5 @@ ENV/
# Rope project settings
.ropeproject

# Compiled CSS
bulrush/static/css/*.css
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
dist: xenial
language: python
python:
- '3.5'
- '3.7'
install:
- python setup.py install
- python setup.py install
- npm install -g less
script:
- python setup.py test
- python setup.py test
before_deploy:
- lessc ./bulrush/static/css/main.less ./bulrush/static/css/main.css
deploy:
- provider: pypi
user: $PYPI_USERNAME
password: $PYPI_PASSWORD
distributions: "sdist bdist_wheel"
skip_cleanup: true
on:
tags: true
87 changes: 61 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -31,6 +31,8 @@ and MailChimp.

- [x] **PyPI package available** - so it can be `pip install`-ed.

- [x] **[Mermaid][25] integration** - so you can include generated diagrams.

Installation
------------

@@ -59,16 +61,9 @@ JINJA_FILTERS = bulrush.FILTERS

### Other Requirements

The main stylesheet is provided in [Less][16] format, so you will need the Less
compiler (`lessc`). An easy way to install this is:

```bash
npm install -g less
```

You also need to make the appropriate Pelican plugin, [`assets`][15], available.
One way of achieving this is to make the `pelican-plugin` repository a submodule
of your site, then you can add to your `pelicanconf.py`:
You need to make the appropriate Pelican plugin, [`assets`][15], available. One
way of achieving this is to make the `pelican-plugin` repository a submodule of
your site, then you can add to your `pelicanconf.py`:

```python
PLUGIN_PATHS = ['pelican-plugins']
@@ -112,18 +107,20 @@ Settings
As well as the [basic settings][14], Bulrush supports the following options in
your `pelicanconf.py`:

| Setting name | What does it do? |
| --- | --- |
| `DISQUS_SITENAME` | Enables Disqus comments. Note that you should set up the full Comment Count Link, as no additional text is applied. |
| `GITHUB_URL` | Enables the "Fork me on GitHub" ribbon. |
| `GOOGLE_ANALYTICS` | Set to `‘UA-XXXX-YYYY’` to activate Google Analytics. |
| `LICENSE` | A string or dictionary describing the license for the site; see details below. |
| `LINKS` | A list of tuples `('Title', 'URL')` for links to appear in the "blogroll" section of the sidebar. |
| `MAILCHIMP` | Configure to activate a [MailChimp][20] sign-up form; see details below. |
| `MENUITEMS` | A list of tuples `('Title', 'URL')` for items to appear in the tabbed navigation. |
| `SITESUBTITLE` | A subtitle to appear in the header. |
| `SOCIAL` | A list of tuples `('Title', 'URL')` to appear in the "social" section of the sidebar. |
| `TWITTER_USERNAME` | Enables Twitter meta-tags in the article and page headers. |
| Setting name | What does it do? |
|------------------------|----------------------------------------------------------------------------------------------------------------------|
| `BULRUSH_SHOW_SUMMARY` | A boolean, whether to show a summary rather than full article on index, category and tag pages. Defaults to `False`. |
| `DISQUS_SITENAME` | Enables Disqus comments. Note that you should set up the full Comment Count Link, as no additional text is applied. |
| `GITHUB_URL` | Enables the "Fork me on GitHub" ribbon. |
| `GOOGLE_ANALYTICS` | Set to `'UA-XXXX-YYYY'` to activate Google Analytics. |
| `LICENSE` | A string or dictionary describing the license for the site; see details below. |
| `LINKS` | A list of tuples `('Title', 'URL')` for links to appear in the "blogroll" section of the sidebar. |
| `MAILCHIMP` | Configure to activate a [MailChimp][20] sign-up form; see details below. |
| `MERMAID` | Activate [Mermaid][25] diagram support; see details below. |
| `MENUITEMS` | A list of tuples `('Title', 'URL')` for items to appear in the tabbed navigation. |
| `SITESUBTITLE` | A subtitle to appear in the header. |
| `SOCIAL` | A list of tuples `('Title', 'URL')` to appear in the "social" section of the sidebar. |
| `TWITTER_USERNAME` | Enables Twitter meta-tags in the article and page headers. |

If `DISPLAY_CATEGORIES_ON_MENU` is omitted or set explicitly to `True`, the
categories are shown in the tabbed navigation with any `MENUITEMS`. If
@@ -189,6 +186,46 @@ You can provide one of two options to specify the license for your content:
The license details will be displayed at the bottom of the sidebar on every
page.

### Mermaid Configuration

Enables [Mermaid][25] diagram generation on your site, allowing diagrams to be
written in a Markdown-ish syntax. Simply wrap the code in a `pre` element
with the `mermaid` class:

```markdown
<pre class="mermaid">
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
</pre>
```

If you set `MERMAID = True`, this will simply enable Mermaid with some default
settings:

```javascript
const defaults = {
securityLevel: "loose",
theme: "default",
themeVariables: {
fontFamily: 'BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif',
},
};
```

To override these settings, or any of Mermaid's own [default configuration][26]
you can pass a _dictionary_ instead. This will be shallowly merged into the
defaults:

```python
MERMAID = dict(
securityLevel="strict",
theme="forest", # disables fontFamily override
)
```

Custom Styling
--------------

@@ -216,9 +253,6 @@ Here are few current users of Bulrush (or modified versions of it):
- [textbook](http://blog.jonrshar.pe/)
- [Simon Says](https://simonsays.neocities.org/)
- [CodeRobot](http://coderobot.downley.net/)
- [chair6.net](http://chair6.net/)
- [Just Numbers and Things](http://justnumbersandthings.com/)
- [بلاگ باهم](https://baaham.net/blog/) (in Persian!)

If you'd like to be featured here (or are and would prefer not to be), feel
free to submit a [pull request][18].
@@ -238,7 +272,6 @@ free to submit a [pull request][18].
[13]: ./screenshot-1440px.png
[14]: http://docs.getpelican.com/en/3.6.3/settings.html#basic-settings
[15]: https://github.com/getpelican/pelican-plugins/tree/master/assets
[16]: http://lesscss.org/
[17]: https://github.com/textbook/bulrush/blob/master/templates/social.html
[18]: https://help.github.com/articles/about-pull-requests/
[19]: http://kb.mailchimp.com/accounts/billing/add-or-remove-monkeyrewards
@@ -247,3 +280,5 @@ free to submit a [pull request][18].
[22]: https://pypi.python.org/pypi/bulrush
[23]: http://fontawesome.io/icon/file-text-o/
[24]: ./screenshot-social.png
[25]: https://mermaid.js.org/
[26]: https://mermaid.js.org/config/setup/modules/mermaidAPI.html#mermaidapi-configuration-defaults
2 changes: 1 addition & 1 deletion bulrush/__init__.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@


ENVIRONMENT = {
'extensions': ['webassets.ext.jinja2.AssetsExtension', 'jinja2.ext.with_'],
'extensions': ['webassets.ext.jinja2.AssetsExtension'],
}
"""The required Jinja environment for the Bulrush theme."""

2 changes: 1 addition & 1 deletion bulrush/license_generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import Mapping
from collections.abc import Mapping
import re

_HTML = '''
27 changes: 8 additions & 19 deletions bulrush/templates/base.html
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width">
<title>{% block title %}{{ SITENAME }}{% endblock %}</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
{% assets filters="less,yui_css", output="css/main.%(version)s.css", "css/main.less" %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.4/css/bulma.min.css">
{% assets output="css/main.%(version)s.css", "css/main.css" %}
<link rel="stylesheet" href="{{ SITEURL }}/{{ ASSET_URL }}">
{% endassets %}
<style media="print">.is-hidden-print{display:none !important}</style>
@@ -15,6 +15,9 @@
<link rel="stylesheet" href="{{ SITEURL }}/{{ extra_path['path'] }}">
{% endif %}
{% endfor %}
{% if MERMAID %}
{% include 'mermaid.html' %}
{% endif %}
{% block tags %}
{% endblock %}
</head>
@@ -69,7 +72,7 @@
{% if MAILCHIMP %}
{% include 'mailchimp.html' %}
{% endif %}
{% if (pages and DISPLAY_PAGES_ON_MENU) or FEED_ALL_ATOM or FEED_ALL_RSS %}
{% if pages and DISPLAY_PAGES_ON_MENU %}
<p class="menu-label">Other Pages</p>
<ul class="menu-list">
{% if DISPLAY_PAGES_ON_MENU %}
@@ -81,24 +84,10 @@
</a></li>
{% endfor %}
{% endif %}
{% if FEED_ALL_ATOM %}
<li><a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}"
type="application/atom+xml" rel="alternate">
<span class="icon is-small"><i class="fa fa-rss"></i></span>
<span class="link-text">Atom Feed</span>
</a></li>
{% endif %}
{% if FEED_ALL_RSS %}
<li><a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}"
type="application/rss+xml" rel="alternate">
<span class="icon is-small"><i class="fa fa-rss"></i></span>
<span class="link-text">RSS Feed</span>
</a></li>
{% endif %}
</ul>
{% endif %}
{% if LINKS %}
<p class="menu-label">Links</p>
<p class="menu-label">{{ LINKS_WIDGET_NAME or "Links" }}</p>
<ul class="menu-list">
{% for name, link in LINKS %}
<li><a href="{{ link }}">
@@ -108,7 +97,7 @@
{% endfor %}
</ul>
{% endif %}
{% if SOCIAL %}
{% if SOCIAL or FEED_ALL_ATOM or FEED_ALL_RSS %}
{% include 'social.html' %}
{% endif %}
{% if LICENSE %}
7 changes: 6 additions & 1 deletion bulrush/templates/index.html
Original file line number Diff line number Diff line change
@@ -10,7 +10,12 @@ <h1 class="title">
</h1>
{% include 'article_infos.html' %}
<div class="section">
{{ article.content }}
{% if BULRUSH_SHOW_SUMMARY %}
{{ article.summary }}
<p><a href="{{ SITEURL }}/{{ article.url }}">Read more...</a></p>
{% else %}
{{ article.content }}
{% endif %}
{% include 'comments.html' %}
</div>
</article>
13 changes: 13 additions & 0 deletions bulrush/templates/mermaid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script type="module">
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";

const defaults = {
securityLevel: "loose",
theme: "default",
themeVariables: {
fontFamily: 'BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif',
},
};

mermaid.initialize({ ...defaults, ...JSON.parse({{ MERMAID | tojson }}) });
</script>
12 changes: 7 additions & 5 deletions bulrush/templates/page.html
Original file line number Diff line number Diff line change
@@ -7,10 +7,12 @@
{% endblock %}
{% block content %}
<section id="content" class="body">
<h1 class="title"><a href="{{ SITEURL }}/{{ page.url }}" rel="bookmark"
title="Permalink to {{ page.title|striptags }}">{{ page.title }}</a></h1>
{% import 'translations.html' as translations with context %}
{{ translations.translations_for(page) }}
<div class="section">{{ page.content }}</div>
<article>
<h1 class="title"><a href="{{ SITEURL }}/{{ page.url }}" rel="bookmark"
title="Permalink to {{ page.title|striptags }}">{{ page.title }}</a></h1>
{% import 'translations.html' as translations with context %}
{{ translations.translations_for(page) }}
<div class="section">{{ page.content }}</div>
</article>
</section>
{% endblock %}
18 changes: 17 additions & 1 deletion bulrush/templates/social.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p class="menu-label">Social</p>
<p class="menu-label">{{ SOCIAL_WIDGET_NAME or "Social" }}</p>
<ul class="menu-list">
{% for title, link in SOCIAL %}
<li><a href="{{ link }}">
@@ -32,4 +32,20 @@
<span class="link-text">{{ title }}</span>
</a></li>
{% endfor %}

{% if FEED_ALL_ATOM %}
<li><a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}"
type="application/atom+xml" rel="alternate">
<span class="icon is-small"><i class="fa fa-rss"></i></span>
<span class="link-text">Atom Feed</span>
</a></li>
{% endif %}

{% if FEED_ALL_RSS %}
<li><a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}"
type="application/rss+xml" rel="alternate">
<span class="icon is-small"><i class="fa fa-rss"></i></span>
<span class="link-text">RSS Feed</span>
</a></li>
{% endif %}
</ul>
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -15,20 +15,20 @@
'Programming Language :: Python :: 3 :: Only',
],
description='Bulrush theme for Pelican',
install_requires=['markupsafe', 'webassets', 'yuicompressor'],
install_requires=['markupsafe', 'webassets'],
license='ISC',
long_description=long_description,
long_description_content_type='text/markdown',
name='bulrush',
package_data={
'bulrush': [
'templates/*.html',
'static/css/*.less',
'static/css/*.css',
]
},
packages=['bulrush'],
test_suite='tests',
tests_require=['pelican'],
url='https://github.com/textbook/bulrush',
version='0.2.2',
version='0.5.2',
)
1 change: 0 additions & 1 deletion tests/test_exports.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ class ExportTest(TestCase):
def test_environment(self):
extensions = bulrush.ENVIRONMENT.get('extensions', [])
self.assertIn('webassets.ext.jinja2.AssetsExtension', extensions)
self.assertIn('jinja2.ext.with_', extensions)

def test_filters(self):
self.assertIn('images', bulrush.FILTERS)