Skip to content

Commit 48febc9

Browse files
authored
Merge pull request #384 from moremoban/dev
Release 0.7.6
2 parents 9e18752 + 1dcce09 commit 48febc9

18 files changed

+133
-52
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# These are supported funding model platforms
22

3+
github: chfw
34
patreon: chfw

.moban.cd/changelog.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: moban
22
organisation: moremoban
33
releases:
4+
- changes:
5+
- action: Added
6+
details:
7+
- "`#38`: finally be able strip the rendered content"
8+
date: 22.5.2020
9+
version: 0.7.6
410
- changes:
511
- action: Added
612
details:

.moban.cd/moban.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ organisation: moremoban
44
author: C. W.
55
66
license: MIT
7-
version: 0.7.5
8-
current_version: 0.7.5
9-
release: 0.7.5
7+
version: 0.7.6
8+
current_version: 0.7.6
9+
release: 0.7.6
1010
branch: master
1111
master: index
1212
command_line_interface: "moban"

CHANGELOG.rst

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Change log
22
================================================================================
33

4+
0.7.6 - 22.5.2020
5+
--------------------------------------------------------------------------------
6+
7+
**Added**
8+
9+
#. `#38 <https://github.com/moremoban/moban/issues/38>`_: finally be able strip
10+
the rendered content
11+
412
0.7.5 - 21.5.2020
513
--------------------------------------------------------------------------------
614

README.rst

+47-40
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
mó bǎn - 模板 General purpose static text generator
33
================================================================================
44

5+
.. image:: https://raw.githubusercontent.com/pyexcel/pyexcel.github.io/master/images/patreon.png
6+
:target: https://www.patreon.com/chfw
7+
58
.. image:: https://api.travis-ci.org/moremoban/moban.svg?branch=master
69
:target: http://travis-ci.org/moremoban/moban
710

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

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

3235
Announcement
3336
================================================================================
3437

38+
From 2020 onwards, minimum requirement is Python 3.6
39+
40+
3541
For existing moban users, python 2 support has been dropped. Please stay with
3642
versions lower than 0.7.0 if you are still using python 2.
3743

38-
From 2020 onwards, minimum requirement is Python 3.6
3944

4045
Introduction
4146
================================================================================
4247

43-
**moban** started with bringing the high performance template engine (JINJA2) for web
44-
into static text generation.
45-
46-
**moban** can use other python template engine: mako, handlebars, velocity,
47-
haml, slim and tornado, can read other data format: json and yaml, and can access both
48-
template file and configuration file in
49-
any location: zip, git, pypi package, s3, etc.
50-
51-
52-
It has been used in `pyexcel <https://github.com/pyexcel/pyexcel>`_ and
48+
**moban** enabled **continuous templating** in `pyexcel <https://github.com/pyexcel/pyexcel>`_ and
5349
`coala <https://github.com//coala/coala>`_ project to keep
5450
documentation consistent across the documentations of individual libraries in the same
55-
organisation.
51+
organisation. Here is the primary use case of moban, as of now:
52+
53+
.. image:: https://github.com/moremoban/yehua/raw/dev/docs/source/_static/yehua-story.png
54+
:width: 600px
55+
5656

5757
And here is a list of other usages:
5858

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

62-
63-
Vision
64-
================================================================================
65-
66-
Any template, any data in any location
62+
All use cases are documented `here <http://moban.readthedocs.org/en/latest/#tutorial>`_
6763

6864
Support
6965
================================================================================
7066

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

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

79-
Credit
80-
================================================================================
81-
82-
`jinja2-fsloader <https://github.com/althonos/jinja2-fsloader>`_ is the key component to enable PyFilesystem2 support in moban
83-
v0.6x. Please show your stars there too!
84-
85-
Installation
75+
Vision
8676
================================================================================
87-
You can install it via pip:
8877

89-
.. code-block:: bash
78+
Any template, any data in any location
9079

91-
$ pip install moban
80+
**moban** started with bringing the high performance template engine (JINJA2) for web
81+
into static text generation.
9282

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

94-
or clone it and install it:
9588

96-
.. code-block:: bash
89+
Credit
90+
================================================================================
9791

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

10295

10396
Quick start
10497
================================================================================
10598

99+
.. image:: https://github.com/moremoban/moban/raw/dev/docs/images/moban-in-intro.gif
100+
101+
106102
.. code-block:: bash
107103
108104
$ export HELLO="world"
@@ -153,12 +149,6 @@ moban.output will contain:
153149
154150
Please note that data.yml will take precedence over environment variables.
155151

156-
Moban in live action:
157-
158-
.. image:: https://github.com/moremoban/moban/raw/dev/docs/images/moban-in-pyexcel-demo.gif
159-
160-
All use cases are documented `here <http://moban.readthedocs.org/en/latest/#tutorial>`_
161-
162152

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

237+
Installation
238+
================================================================================
239+
You can install it via pip:
240+
241+
.. code-block:: bash
242+
243+
$ pip install moban
244+
245+
246+
or clone it and install it:
247+
248+
.. code-block:: bash
249+
250+
$ git clone http://github.com/moremoban/moban.git
251+
$ cd moban
252+
$ python setup.py install
253+
247254
248255
CLI documentation
249256
================================================================================

docs/README.rst

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This section covers the use cases for moban. Please check them out individually.
2828
#. `Mobanfile inheritance`_
2929
#. `Files over http(s)`_
3030
#. `Remove intermediate targets`_
31+
#. `Striping the rendered content`_
3132

3233
.. _Jinja2 command line: level-1-jinja2-cli
3334
.. _Template inheritance: level-2-template-inheritance
@@ -54,3 +55,4 @@ This section covers the use cases for moban. Please check them out individually.
5455
.. _Mobanfile inheritance: level-23-inherit-organisational-moban-file
5556
.. _Files over http(s): level-24-files-over-http
5657
.. _Remove intermediate targets: level-25-delete-intermediate
58+
.. _Striping the rendered content: level-26-strip-rendered-content

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
copyright = '2017-2020 Onni Software Ltd.'
2626
author = 'C. W.'
2727
# The short X.Y version
28-
version = '0.7.5'
28+
version = '0.7.6'
2929
# The full version, including alpha/beta/rc tags
30-
release = '0.7.5'
30+
release = '0.7.6'
3131

3232
# -- General configuration ---------------------------------------------------
3333

docs/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ examples folder.
4040
level-23-inherit-organisational-moban-file/README.rst
4141
level-24-files-over-http/README.rst
4242
level-25-delete-intermediate/README.rst
43+
level-26-strip-rendered-content/README.rst
4344

4445

4546
For more complex use case, please look at `its usage in pyexcel project <http://pyexcel.readthedocs.io/en/latest/guide.html>`_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
targets:
2+
- intermediate.strip: content_with_lots_of_white_spaces.jj2
3+
- final: intermediate.strip
4+
- delete!: intermediate.strip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Level 26: Strip the white spaces
2+
================================================================================
3+
4+
It was requested, a long time ago, to be able to strip the white spaces
5+
before and after the rendered content. Due to these factors:
6+
7+
1. templating order needs to be respected first
8+
2. intermediate targets(moban generated files) can be allowed as template
9+
3. and delete the intermediate file
10+
11+
Now, all three factors are now supported. Hence, 'strip' feature can be
12+
rolled out.
13+
14+
Here is the short syntax::
15+
16+
targets:
17+
- final: intermediate_file.strip
18+
19+
Here are the full syntax::
20+
21+
targets:
22+
- output: final
23+
template: intermediate_file.what_ever
24+
template_type: strip
25+
26+
27+
Example mobanfile::
28+
29+
targets:
30+
- intermediate.strip: content_with_lots_of_white_spaces.jj2
31+
- final: intermediate.strip
32+
- delete!: intermediate.strip
33+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
4+
a {{hello}}
5+
6+
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello: world
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a world

moban/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "0.7.5"
1+
__version__ = "0.7.6"
22
__author__ = "C. W."

moban/core/plugins.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"moban.plugins.json_loader",
99
"moban.plugins.copy",
1010
"moban.plugins.delete",
11+
"moban.plugins.strip",
1112
]
1213

1314

moban/plugins/delete.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
from moban.core.mobanfile.store import STORE
66

77

8-
@PluginInfo(constants.TEMPLATE_ENGINE_EXTENSION, tags=["delete"])
9-
class ContentForwardEngine(object):
8+
@PluginInfo(
9+
constants.TEMPLATE_ENGINE_EXTENSION, tags=[constants.TEMPLATE_DELETE]
10+
)
11+
class DeleteEngine(object):
1012
"""
1113
Does no templating but delete generated intermediate targets
1214

setup.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
NAME = "moban"
4343
AUTHOR = "C. W."
44-
VERSION = "0.7.5"
44+
VERSION = "0.7.6"
4545
4646
LICENSE = "MIT"
4747
ENTRY_POINTS = {
@@ -53,7 +53,7 @@
5353
"General purpose static text generator"
5454
)
5555
URL = "https://github.com/moremoban/moban"
56-
DOWNLOAD_URL = "%s/archive/0.7.5.tar.gz" % URL
56+
DOWNLOAD_URL = "%s/archive/0.7.6.tar.gz" % URL
5757
FILES = ["README.rst", "CONTRIBUTORS.rst", "CHANGELOG.rst"]
5858
KEYWORDS = [
5959
"python",
@@ -96,8 +96,8 @@
9696
}
9797
# You do not need to read beyond this line
9898
PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable)
99-
GS_COMMAND = ("gs moban v0.7.5 " +
100-
"Find 0.7.5 in changelog for more details")
99+
GS_COMMAND = ("gs moban v0.7.6 " +
100+
"Find 0.7.6 in changelog for more details")
101101
NO_GS_MESSAGE = ("Automatic github release is disabled. " +
102102
"Please install gease to enable it.")
103103
UPLOAD_FAILED_MSG = (

tests/test_docs.py

+7
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,13 @@ def test_level_25_delete_intermediate_targets(self):
332332
assert not os.path.exists("intermediate2.jj2")
333333
assert not os.path.exists("intermediate3.jj2")
334334

335+
def test_level_26_strip_intermediate_targets(self):
336+
expected = "a world\n"
337+
338+
folder = "level-25-delete-intermediate-targets"
339+
self.run_moban(["moban"], folder, [("final", expected)])
340+
assert not os.path.exists("intermediate.strip")
341+
335342
def test_level_23_inherit_parent_moban_file(self):
336343
folder = "level-23-inherit-organisational-moban-file"
337344
self.run_moban(

0 commit comments

Comments
 (0)