Skip to content

Commit

Permalink
Merge branch 'release-3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Tessaro committed Mar 31, 2019
2 parents 52a7d78 + 1093efc commit 4abf56c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 11 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: python

python:
- 2.7
- 3.3
- 3.4
- 3.5
- 3.6
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
# Changelog

## 3.0.0 (2019-03-31)

### New

* Allow percent sign in width and height options. [Mathias Lüdtke]

### Fix

* Renamed module to `plantuml_markdown` (fixes #23) [Michele Tessaro]

Renamed module from `plantuml-markdown` to `plantuml_markdown` to allow
importing module in other python sources.
Thi breaks compatibility: plugin configuration in `markdown_py` must be
renamed too.


## 2.0.2 (2019-03-16)

### New

* Added test to verify utf-8 character handling. [Michele Tessaro]

### Changes

* Updated documentation for new release. [Michele Tessaro]

### Fix

* Fixed handling of unicode characters in svg_inline (refs #21) [Szymon Wilkołazki]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ To use the plugin with [Python-Markdown][] you have three choices:

After installed, you can use this plugin by activating it in the `markdown_py` command. For example:

markdown_py -x plantuml-markdown mydoc.md > out.html
markdown_py -x plantuml_markdown mydoc.md > out.html

### Using a PlantUML server

Expand All @@ -114,7 +114,7 @@ container, or you can run it as a [docker container](https://hub.docker.com/r/pl
In either cases you need to specify the URL of the server in a configuration file like:

```yaml
plantuml-markdown:
plantuml_markdown:
server: http://www.plantuml.com/plantuml # PlantUML server, for remote rendering
# other global options
format: png # default diagram image format
Expand All @@ -125,7 +125,7 @@ plantuml-markdown:
Then you need to specify the configuration file on the command line:
markdown_py -x plantuml-markdown -c myconfig.yml mydoc.md > out.html
markdown_py -x plantuml_markdown -c myconfig.yml mydoc.md > out.html
Running tests
-------------
Expand Down
8 changes: 4 additions & 4 deletions plantuml-markdown.py → plantuml_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class PlantUMLPreprocessor(markdown.preprocessors.Preprocessor):
\s*(classes=(?P<quot1>"|')(?P<classes>[\w\s]+)(?P=quot1))?
\s*(alt=(?P<quot2>"|')(?P<alt>[\w\s"']+)(?P=quot2))?
\s*(title=(?P<quot3>"|')(?P<title>[\w\s"']+)(?P=quot3))?
\s*(width=(?P<quot4>"|')(?P<width>[\w\s"']+)(?P=quot4))?
\s*(height=(?P<quot5>"|')(?P<height>[\w\s"']+)(?P=quot5))?
\s*(width=(?P<quot4>"|')(?P<width>[\w\s"']+%?)(?P=quot4))?
\s*(height=(?P<quot5>"|')(?P<height>[\w\s"']+%?)(?P=quot5))?
\s*\n
(?P<code>.*?)(?<=\n)
::end-uml::[ ]*$
Expand All @@ -94,8 +94,8 @@ class PlantUMLPreprocessor(markdown.preprocessors.Preprocessor):
\s*(classes=(?P<quot1>"|')(?P<classes>[\w\s]+)(?P=quot1))?
\s*(alt=(?P<quot2>"|')(?P<alt>[\w\s"']+)(?P=quot2))?
\s*(title=(?P<quot3>"|')(?P<title>[\w\s"']+)(?P=quot3))?
\s*(width=(?P<quot4>"|')(?P<width>[\w\s"']+)(?P=quot4))?
\s*(height=(?P<quot5>"|')(?P<height>[\w\s"']+)(?P=quot5))?
\s*(width=(?P<quot4>"|')(?P<width>[\w\s"']+%?)(?P=quot4))?
\s*(height=(?P<quot5>"|')(?P<height>[\w\s"']+%?)(?P=quot5))?
[ ]*
}?[ ]*\n # Optional closing }
(?P<code>.*?)(?<=\n)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setuptools.setup(
name="plantuml-markdown",
version="2.0.2",
version="3.0.0",
author="Michele Tessaro",
author_email="[email protected]",
description="A PlantUML plugin for Markdown",
Expand All @@ -24,7 +24,7 @@
keywords=['Markdown', 'typesetting', 'include', 'plugin', 'extension'],
url="https://github.com/mikitex70/plantuml-markdown",
#packages=setuptools.find_packages(exclude=['test']),
py_modules=['plantuml-markdown'],
py_modules=['plantuml_markdown'],
install_requires=install_requirements,
tests_require=test_requirements,
classifiers=[
Expand Down
20 changes: 19 additions & 1 deletion test/test_plantuml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setUpClass(cls):
super(PlantumlTest, cls).setUpClass()

def setUp(self):
self.md = markdown.Markdown(extensions=['markdown.extensions.fenced_code', 'plantuml-markdown'])
self.md = markdown.Markdown(extensions=['markdown.extensions.fenced_code', 'plantuml_markdown'])
self.text_builder = None

def _load_file(self, filename):
Expand Down Expand Up @@ -160,6 +160,15 @@ def test_arg_width(self):
'<p><img alt="uml diagram" class="uml" src="data:image/png;base64,%s" style="max-width:120px" title="" width="100%%" /></p>' % self.FAKE_IMAGE,
self._stripImageData(self.md.convert(text)))

def test_arg_with_percent(self):
"""
Test for the correct parsing of the width argument
"""
text = self.text_builder.diagram("A --> B").width("70%").build()
self.assertEqual(
'<p><img alt="uml diagram" class="uml" src="data:image/png;base64,%s" style="max-width:70%%" title="" width="100%%" /></p>' % self.FAKE_IMAGE,
self._stripImageData(self.md.convert(text)))

def test_arg_height(self):
"""
Test for the correct parsing of the width argument
Expand All @@ -169,6 +178,15 @@ def test_arg_height(self):
'<p><img alt="uml diagram" class="uml" src="data:image/png;base64,%s" style="max-height:120px" title="" width="100%%" /></p>' % self.FAKE_IMAGE,
self._stripImageData(self.md.convert(text)))

def test_arg_height_percent(self):
"""
Test for the correct parsing of the width argument
"""
text = self.text_builder.diagram("A --> B").height("50%").build()
self.assertEqual(
'<p><img alt="uml diagram" class="uml" src="data:image/png;base64,%s" style="max-height:50%%" title="" width="100%%" /></p>' % self.FAKE_IMAGE,
self._stripImageData(self.md.convert(text)))

def test_arg_width_and_height(self):
"""
Test for the correct parsing of the width and height arguments
Expand Down

0 comments on commit 4abf56c

Please sign in to comment.