Skip to content

Commit

Permalink
Merge pull request #384 from moremoban/dev
Browse files Browse the repository at this point in the history
Release 0.7.6
  • Loading branch information
chfw authored May 22, 2020
2 parents 9e18752 + 1dcce09 commit 48febc9
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 52 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# These are supported funding model platforms

github: chfw
patreon: chfw
6 changes: 6 additions & 0 deletions .moban.cd/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: moban
organisation: moremoban
releases:
- changes:
- action: Added
details:
- "`#38`: finally be able strip the rendered content"
date: 22.5.2020
version: 0.7.6
- changes:
- action: Added
details:
Expand Down
6 changes: 3 additions & 3 deletions .moban.cd/moban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ organisation: moremoban
author: C. W.
contact: wangc_2011@hotmail.com
license: MIT
version: 0.7.5
current_version: 0.7.5
release: 0.7.5
version: 0.7.6
current_version: 0.7.6
release: 0.7.6
branch: master
master: index
command_line_interface: "moban"
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change log
================================================================================

0.7.6 - 22.5.2020
--------------------------------------------------------------------------------

**Added**

#. `#38 <https://github.com/moremoban/moban/issues/38>`_: finally be able strip
the rendered content

0.7.5 - 21.5.2020
--------------------------------------------------------------------------------

Expand Down
87 changes: 47 additions & 40 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
mó bǎn - 模板 General purpose static text generator
================================================================================

.. image:: https://raw.githubusercontent.com/pyexcel/pyexcel.github.io/master/images/patreon.png
:target: https://www.patreon.com/chfw

.. image:: https://api.travis-ci.org/moremoban/moban.svg?branch=master
:target: http://travis-ci.org/moremoban/moban

Expand All @@ -27,82 +30,75 @@ mó bǎn - 模板 General purpose static text generator
:Issues: http://github.com/moremoban/moban/issues
:License: MIT

.. image:: https://github.com/moremoban/moban/raw/dev/docs/images/moban-in-intro.gif
.. image:: https://github.com/moremoban/moban/raw/dev/docs/images/moban-in-pyexcel-demo.gif

Announcement
================================================================================

From 2020 onwards, minimum requirement is Python 3.6


For existing moban users, python 2 support has been dropped. Please stay with
versions lower than 0.7.0 if you are still using python 2.

From 2020 onwards, minimum requirement is Python 3.6

Introduction
================================================================================

**moban** started with bringing the high performance template engine (JINJA2) for web
into static text generation.

**moban** can use other python template engine: mako, handlebars, velocity,
haml, slim and tornado, can read other data format: json and yaml, and can access both
template file and configuration file in
any location: zip, git, pypi package, s3, etc.


It has been used in `pyexcel <https://github.com/pyexcel/pyexcel>`_ and
**moban** enabled **continuous templating** in `pyexcel <https://github.com/pyexcel/pyexcel>`_ and
`coala <https://github.com//coala/coala>`_ project to keep
documentation consistent across the documentations of individual libraries in the same
organisation.
organisation. Here is the primary use case of moban, as of now:

.. image:: https://github.com/moremoban/yehua/raw/dev/docs/source/_static/yehua-story.png
:width: 600px


And here is a list of other usages:

#. `Django Mobans <https://github.com/django-mobans>`_, templates for django, docker etc.
#. `Math Sheets <https://github.com/chfw/math-sheets>`_, generate custom math sheets in pdf


Vision
================================================================================

Any template, any data in any location
All use cases are documented `here <http://moban.readthedocs.org/en/latest/#tutorial>`_

Support
================================================================================

If you like moban, please support me on,
If you like moban, please support me on github,
`patreon <https://www.patreon.com/bePatron?u=5537627>`_
or `bounty source <https://salt.bountysource.com/teams/chfw-pyexcel>`_ to maintain
the project and develop it further.

With your financial support, I will be able to invest
a little bit more time in coding, documentation and writing interesting extensions.

Credit
================================================================================

`jinja2-fsloader <https://github.com/althonos/jinja2-fsloader>`_ is the key component to enable PyFilesystem2 support in moban
v0.6x. Please show your stars there too!

Installation
Vision
================================================================================
You can install it via pip:

.. code-block:: bash
Any template, any data in any location

$ pip install moban
**moban** started with bringing the high performance template engine (JINJA2) for web
into static text generation.

**moban** can use other python template engine: mako, handlebars, velocity,
haml, slim and tornado, can read other data format: json and yaml, and can access both
template file and configuration file in
any location: zip, git, pypi package, s3, etc.

or clone it and install it:

.. code-block:: bash
Credit
================================================================================

$ git clone http://github.com/moremoban/moban.git
$ cd moban
$ python setup.py install
`jinja2-fsloader <https://github.com/althonos/jinja2-fsloader>`_ is the key component to enable PyFilesystem2 support in moban
v0.6x. Please show your stars there too!


Quick start
================================================================================

.. image:: https://github.com/moremoban/moban/raw/dev/docs/images/moban-in-intro.gif


.. code-block:: bash
$ export HELLO="world"
Expand Down Expand Up @@ -153,12 +149,6 @@ moban.output will contain:
Please note that data.yml will take precedence over environment variables.

Moban in live action:

.. image:: https://github.com/moremoban/moban/raw/dev/docs/images/moban-in-pyexcel-demo.gif

All use cases are documented `here <http://moban.readthedocs.org/en/latest/#tutorial>`_


Templates and configuration files over HTTP(S)
================================================================================
Expand Down Expand Up @@ -244,6 +234,23 @@ Where the configuration sits in a s3 bucket, the output is a file in a zip. The
hello: world

Installation
================================================================================
You can install it via pip:

.. code-block:: bash
$ pip install moban
or clone it and install it:

.. code-block:: bash
$ git clone http://github.com/moremoban/moban.git
$ cd moban
$ python setup.py install
CLI documentation
================================================================================
Expand Down
2 changes: 2 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This section covers the use cases for moban. Please check them out individually.
#. `Mobanfile inheritance`_
#. `Files over http(s)`_
#. `Remove intermediate targets`_
#. `Striping the rendered content`_

.. _Jinja2 command line: level-1-jinja2-cli
.. _Template inheritance: level-2-template-inheritance
Expand All @@ -54,3 +55,4 @@ This section covers the use cases for moban. Please check them out individually.
.. _Mobanfile inheritance: level-23-inherit-organisational-moban-file
.. _Files over http(s): level-24-files-over-http
.. _Remove intermediate targets: level-25-delete-intermediate
.. _Striping the rendered content: level-26-strip-rendered-content
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
copyright = '2017-2020 Onni Software Ltd.'
author = 'C. W.'
# The short X.Y version
version = '0.7.5'
version = '0.7.6'
# The full version, including alpha/beta/rc tags
release = '0.7.5'
release = '0.7.6'

# -- General configuration ---------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ examples folder.
level-23-inherit-organisational-moban-file/README.rst
level-24-files-over-http/README.rst
level-25-delete-intermediate/README.rst
level-26-strip-rendered-content/README.rst


For more complex use case, please look at `its usage in pyexcel project <http://pyexcel.readthedocs.io/en/latest/guide.html>`_
Expand Down
4 changes: 4 additions & 0 deletions docs/level-26-strip-rendered-content/.moban.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
targets:
- intermediate.strip: content_with_lots_of_white_spaces.jj2
- final: intermediate.strip
- delete!: intermediate.strip
33 changes: 33 additions & 0 deletions docs/level-26-strip-rendered-content/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Level 26: Strip the white spaces
================================================================================

It was requested, a long time ago, to be able to strip the white spaces
before and after the rendered content. Due to these factors:

1. templating order needs to be respected first
2. intermediate targets(moban generated files) can be allowed as template
3. and delete the intermediate file

Now, all three factors are now supported. Hence, 'strip' feature can be
rolled out.

Here is the short syntax::

targets:
- final: intermediate_file.strip

Here are the full syntax::

targets:
- output: final
template: intermediate_file.what_ever
template_type: strip


Example mobanfile::

targets:
- intermediate.strip: content_with_lots_of_white_spaces.jj2
- final: intermediate.strip
- delete!: intermediate.strip
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@



a {{hello}}



1 change: 1 addition & 0 deletions docs/level-26-strip-rendered-content/data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello: world
1 change: 1 addition & 0 deletions docs/level-26-strip-rendered-content/final
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a world
2 changes: 1 addition & 1 deletion moban/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.7.5"
__version__ = "0.7.6"
__author__ = "C. W."
1 change: 1 addition & 0 deletions moban/core/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"moban.plugins.json_loader",
"moban.plugins.copy",
"moban.plugins.delete",
"moban.plugins.strip",
]


Expand Down
6 changes: 4 additions & 2 deletions moban/plugins/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
from moban.core.mobanfile.store import STORE


@PluginInfo(constants.TEMPLATE_ENGINE_EXTENSION, tags=["delete"])
class ContentForwardEngine(object):
@PluginInfo(
constants.TEMPLATE_ENGINE_EXTENSION, tags=[constants.TEMPLATE_DELETE]
)
class DeleteEngine(object):
"""
Does no templating but delete generated intermediate targets
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

NAME = "moban"
AUTHOR = "C. W."
VERSION = "0.7.5"
VERSION = "0.7.6"
EMAIL = "wangc_2011@hotmail.com"
LICENSE = "MIT"
ENTRY_POINTS = {
Expand All @@ -53,7 +53,7 @@
"General purpose static text generator"
)
URL = "https://github.com/moremoban/moban"
DOWNLOAD_URL = "%s/archive/0.7.5.tar.gz" % URL
DOWNLOAD_URL = "%s/archive/0.7.6.tar.gz" % URL
FILES = ["README.rst", "CONTRIBUTORS.rst", "CHANGELOG.rst"]
KEYWORDS = [
"python",
Expand Down Expand Up @@ -96,8 +96,8 @@
}
# You do not need to read beyond this line
PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable)
GS_COMMAND = ("gs moban v0.7.5 " +
"Find 0.7.5 in changelog for more details")
GS_COMMAND = ("gs moban v0.7.6 " +
"Find 0.7.6 in changelog for more details")
NO_GS_MESSAGE = ("Automatic github release is disabled. " +
"Please install gease to enable it.")
UPLOAD_FAILED_MSG = (
Expand Down
7 changes: 7 additions & 0 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ def test_level_25_delete_intermediate_targets(self):
assert not os.path.exists("intermediate2.jj2")
assert not os.path.exists("intermediate3.jj2")

def test_level_26_strip_intermediate_targets(self):
expected = "a world\n"

folder = "level-25-delete-intermediate-targets"
self.run_moban(["moban"], folder, [("final", expected)])
assert not os.path.exists("intermediate.strip")

def test_level_23_inherit_parent_moban_file(self):
folder = "level-23-inherit-organisational-moban-file"
self.run_moban(
Expand Down

0 comments on commit 48febc9

Please sign in to comment.