GithubHelp home page GithubHelp logo

necromuralist / beach-pig-thigh Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 2 MB

Stuff that I use to help with the nikola static site generator

Home Page: https://necromuralist.github.io/Beach-Pig-Thigh/

License: MIT License

Python 45.19% CSS 11.05% Emacs Lisp 3.59% JavaScript 1.89% Mako 38.28%
nikola

beach-pig-thigh's Introduction

Nikola Helpers Readme (if you want)

These are pieces of code that I use with Nikola. I use Nikola but haven’t really studied it so there are probably better ways to do most of these things, but this seems to work well enough. I’m converting this to a web-site with the built html here: https://necromuralist.github.io/Beach-Pig-Thigh/.

Templates

The templates are all mako templates for now. I have at least one repository that uses jinja (because why not? actually I think I just forgot which one I normally use) but I’m not updating it right at the moment. Templates go in the themes/custom/templates/ folder, assuming the theme’s name is custom, as set in the conf.py file.

math_helpers.tmpl

This an update of the built-in template for handling math in nikola. It’s what gets called when you set the has_math metadata flag with pseudocode.js added to it. It checks for a has_pseudocode entry in the metadata to decide whether to inject it or not. It doesn’t check what the value is set with has_pseudocode, as long as something is set it will put it in (so “False” is still True).

If you just want math put this in the metadata:

.. has_math: True

But if you want pseudocode use:

.. has_pseudocode: True

**Warning:**

I made the has_math flag take precedence over the has_pseudocode flag so if you put both in only the math will get set. Maybe I’ll re-think that later. For now don’t put both in.

Using the Math Helpers with Pseudocode

The math_helpers.tmpl puts the javascript in the footer, which means that pseudocode.js doesn’t load before it gets called in the body of the HTML (although MathJax does, somehow) so you need to wait for the page to load or it won’t render.

<script>
window.addEventListener('load', function () {
    pseudocode.renderElement(document.getElementById("bubblesort"));
});
</script>

Where “bubblesort” is the ID set in the LaTeX algorithm block.

Shortcodes

lancelot/

This is a shortcode plugin that is basically the same as the doc shortcode but lets me pass in alternate text to use, even though I’m using org-mode, not RST.

Image Source

beach-pig-thigh's People

Contributors

necromuralist avatar

Watchers

 avatar  avatar  avatar

beach-pig-thigh's Issues

Make Split Between "posts" and "pages" clearer

posts/ and pages/ (currently source/) need to have clearer definitions.

Perhaps:

  • posts/ are experiments and running examples
  • pages/ are the actual definitions that get tangled into the
    source files with their documentation and references

Rename source/ to pages/

The folder for the org-files that the actual files get tangled out from
is currently called source/. Change it to pages to match nikola?

Update conf.py to allow mako and jinja switching

Beach-Pig-Thigh was built with mako as the default. Change it so that
there is no default conf.py, but put conf.py.mako and conf.py.jinja
files in there and use .gitignore to checkout the conf.py for the
system to test-out.

Split Jinja and Mako Shortcodes

Currently mako shortcodes have "mako" in the file names while jinja aren't
noted - figure out a better way to split them up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.