Skip to content
pelican plugin that sets default bootstrap classes for rendered html
Branch: master
Clone or download
ingwinlu Merge pull request #7 from peterdesmet/master
img-responsive → img-fluid, drop table-hover as default, update README
Latest commit b2e9e93 May 7, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore init Sep 16, 2014
LICENSE init Sep 16, 2014
README.md Remove table-hover May 7, 2018
__init__.py init Sep 16, 2014
bootstrapify.py Remove table-hover May 7, 2018

README.md

bootstrapify

This pelican plugin modifies article and page html to use bootstrap's default classes. This is especially handy if you want to write tables in markdown, since the attr_list extension does not play nice with tables.

Requirements

  • Beautifulsoup4 - install via pip install beautifulsoup4

Features

  • Adds table table-striped to all <table> elements.
  • Adds img-fluid to all <img> elements.
  • Use BOOTSTRAPIFY in your Pelican configuration file to pass a {'css-selector': ['list-of-classes']} dictionary to the plugin. Bootstrapify will append list-of-classes to all tags that match css-selector. The selector can be as simple as a tag name (table or p) or as complicated as a.menu:nth-of-type(3) (see the Beautifulsoup4 documentation).

Example for md tables

  1. Write your table in markdown
| Protocol       | Contact Information
|:-------------- |:-----------------------------------------------------|
| jabber/xmpp    | [winlu@jabber.at](winlu@jabber.at)                   |
| email          | [derwinlu@gmail.com](mailto:derwinlu@gmail.com)      |
| IRC - freenode | winlu                                                |
  1. there is no step 2, the plugin adds the needed classes to the <table> node, resulting in the following output:
<table class="table table-striped table-hover">
  <thead>
    <tr>
      <th align="left">Protocol</th>
      <th align="left">Contact Information</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td align="left">jabber/xmpp</td>
      <td align="left"><a href="winlu@jabber.at">winlu@jabber.at</a></td>
    </tr>
    <tr>
      <td align="left">email</td>
      <td align="left"><a href="mailto:derwinlu@gmail.com">derwinlu@gmail.com</a></td>
    </tr>
    <tr>
      <td align="left"><span class="caps">IRC</span> - freenode</td>
      <td align="left">winlu</td>
    </tr>
  </tbody>
</table>

Known Issues

  • plugin seems not to fire for drafts
  • not enough customization possible, maybe read article,page metadata for more options
You can’t perform that action at this time.