From c536b90097d934d1e425c7756aa4e147ba622a4a Mon Sep 17 00:00:00 2001
From: pyup-bot
Date: Wed, 17 May 2017 07:52:37 +1200
Subject: [PATCH 01/12] Update sphinx from 1.5.5 to 1.6.1
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 41beef12..ddebf19e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,5 +6,5 @@ python-slugify==1.2.4
setuptools==35.0.2
# Required dependencies for building documentation
-sphinx==1.5.5
+sphinx==1.6.1
sphinx_rtd_theme==0.2.4
From f3944d1e188fee617e02289b1df397f363ffc0cc Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Mon, 22 May 2017 10:13:44 +1200
Subject: [PATCH 02/12] Remove BS4 from dependencies.
---
requirements.txt | 1 -
setup.py | 1 -
2 files changed, 2 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index ddebf19e..1251f000 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,5 @@
# Required dependencies for Verto (installed automatically in setup.py)
markdown==2.6.8
-beautifulsoup4==4.5.3
Jinja2==2.9.6
python-slugify==1.2.4
setuptools==35.0.2
diff --git a/setup.py b/setup.py
index 875892ac..30b37318 100644
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,6 @@
include_package_data=True,
install_requires=[
'markdown>=2.6.8',
- 'beautifulsoup4>=4.5.3',
'Jinja2>=2.9.6',
'python-slugify>=1.2.4'
]
From feff115912a37dd9da01afeb9761ec7888a15f27 Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Mon, 22 May 2017 13:12:57 +1200
Subject: [PATCH 03/12] Inline images feature.
---
docs/source/processors/image-inline.rst | 78 ++++++
docs/source/processors/index.rst | 1 +
verto/VertoExtension.py | 2 +
verto/html-templates/image-inline.html | 13 +
verto/processor-info.json | 36 ++-
verto/processors/ImageBlockProcessor.py | 1 -
verto/processors/ImageInlinePattern.py | 56 +++++
verto/tests/ImageInlineTest.py | 236 ++++++++++++++++++
.../tests/assets/image-inline/argument_alt.md | 1 +
.../image-inline/argument_alt_expected.html | 3 +
.../assets/image-inline/argument_caption.md | 1 +
.../argument_caption_expected.html | 4 +
.../image-inline/argument_caption_link.md | 1 +
.../argument_caption_link_expected.html | 4 +
.../image-inline/argument_hover_text.md | 1 +
.../argument_hover_text_expected.html | 3 +
.../image-inline/argument_source_link.md | 1 +
.../argument_source_link_expected.html | 4 +
.../image-inline/doc_example_basic_usage.md | 1 +
.../doc_example_basic_usage_expected.html | 3 +
.../image-inline/doc_example_override_html.md | 1 +
.../doc_example_override_html_expected.html | 3 +
.../doc_example_override_html_template.html | 3 +
.../assets/image-inline/external_image.md | 1 +
.../image-inline/external_image_expected.html | 3 +
.../assets/image-inline/internal_image.md | 1 +
.../image-inline/internal_image_expected.html | 3 +
.../image-inline/multiple_internal_images.md | 1 +
.../multiple_internal_images_expected.html | 5 +
.../assets/image-inline/numbered_list.md | 9 +
.../image-inline/numbered_list_expected.html | 21 ++
.../tests/assets/image-inline/table_embed.md | 4 +
.../image-inline/table_embed_expected.html | 26 ++
verto/tests/start_tests.py | 2 +
34 files changed, 529 insertions(+), 4 deletions(-)
create mode 100644 docs/source/processors/image-inline.rst
create mode 100644 verto/html-templates/image-inline.html
create mode 100644 verto/processors/ImageInlinePattern.py
create mode 100644 verto/tests/ImageInlineTest.py
create mode 100644 verto/tests/assets/image-inline/argument_alt.md
create mode 100644 verto/tests/assets/image-inline/argument_alt_expected.html
create mode 100644 verto/tests/assets/image-inline/argument_caption.md
create mode 100644 verto/tests/assets/image-inline/argument_caption_expected.html
create mode 100644 verto/tests/assets/image-inline/argument_caption_link.md
create mode 100644 verto/tests/assets/image-inline/argument_caption_link_expected.html
create mode 100644 verto/tests/assets/image-inline/argument_hover_text.md
create mode 100644 verto/tests/assets/image-inline/argument_hover_text_expected.html
create mode 100644 verto/tests/assets/image-inline/argument_source_link.md
create mode 100644 verto/tests/assets/image-inline/argument_source_link_expected.html
create mode 100644 verto/tests/assets/image-inline/doc_example_basic_usage.md
create mode 100644 verto/tests/assets/image-inline/doc_example_basic_usage_expected.html
create mode 100644 verto/tests/assets/image-inline/doc_example_override_html.md
create mode 100644 verto/tests/assets/image-inline/doc_example_override_html_expected.html
create mode 100644 verto/tests/assets/image-inline/doc_example_override_html_template.html
create mode 100644 verto/tests/assets/image-inline/external_image.md
create mode 100644 verto/tests/assets/image-inline/external_image_expected.html
create mode 100644 verto/tests/assets/image-inline/internal_image.md
create mode 100644 verto/tests/assets/image-inline/internal_image_expected.html
create mode 100644 verto/tests/assets/image-inline/multiple_internal_images.md
create mode 100644 verto/tests/assets/image-inline/multiple_internal_images_expected.html
create mode 100644 verto/tests/assets/image-inline/numbered_list.md
create mode 100644 verto/tests/assets/image-inline/numbered_list_expected.html
create mode 100644 verto/tests/assets/image-inline/table_embed.md
create mode 100644 verto/tests/assets/image-inline/table_embed_expected.html
diff --git a/docs/source/processors/image-inline.rst b/docs/source/processors/image-inline.rst
new file mode 100644
index 00000000..73886744
--- /dev/null
+++ b/docs/source/processors/image-inline.rst
@@ -0,0 +1,78 @@
+Inline Image
+#######################################
+
+**Processor name:** ``image-inline``
+
+.. note::
+
+ The inline image tag allows for the use of images inside tables, *etc* without causing style errors. The tag functions almost exactly the same as the ``image`` tag except for not excluding the alignment argument.
+
+You can include an inline image using the following text tag:
+
+.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_basic_usage.md
+ :language: none
+
+Required Tag Parameters
+***************************************
+
+- ``file-path`` - The path to the image.
+
+ - Each file-path provided is added to the ``images`` set in required files stored by Verto. The set of filepaths can be accessed after conversion, see :ref:`accessing_verto_data`.
+ - **Note:** If the given link is a relative (a link that doesn't start with ``http:``), the link will be rendered with a Django static command. For example, the link ``images/example.png`` would be rendered as ``{% static 'images/example.png' %}`` This can be overriden, see the override section below.
+
+Optional Tag Parameters
+***************************************
+
+- ``alt`` - Description text of the image used when an image is not displayed, or can be read when using a screen reader (for those with reading difficulties).
+- ``caption`` - Lists the given text as a caption under the image.
+- ``caption-link`` (requires caption parameter) - Converts the caption text into a link to the given caption link URL.
+- ``source`` (optional) - Adds the text 'Source' under the image with a link to the given source URL. Displays after the caption if a caption is given.
+- ``hover-text`` - Additional text to be displayed when the user hovers their cursor over the image (note this won't appear on touch devices so use sparingly).
+
+The default HTML for image is:
+
+.. literalinclude:: ../../../verto/html-templates/image-inline.html
+ :language: css+jinja
+
+Using the following example tag:
+
+.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_basic_usage.md
+ :language: none
+
+The resulting HTML would be:
+
+.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_basic_usage_expected.html
+ :language: html
+
+Overriding HTML for Images
+***************************************
+
+When overriding the HTML for images, the following Jinja2 placeholders are available:
+
+- ``{{ file_path }}`` - The location for the path to the URL.
+- ``{{ alt }}`` - The alternative text for the image.
+- ``{{ hover_text }}`` - The text to display when the user hovers over the image (see `image title attribute `_).
+- ``{{ caption }}`` - The text for the image caption.
+- ``{{ caption_link }}`` - The URL for the caption link .
+- ``{{ source_link }}`` - The URL for the source .
+
+If the ``file_path`` provided is a relative link, the link is passed through the ``relative-file-link.html`` template.
+The default HTML for relative images is:
+
+.. literalinclude:: ../../../verto/html-templates/relative-file-link.html
+ :language: css+jinja
+
+For example, providing the following HTML:
+
+.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_override_html_template.html
+ :language: css+jinja
+
+with the following tag:
+
+.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_override_html.md
+ :language: none
+
+would result in:
+
+.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_override_html_expected.html
+ :language: html
diff --git a/docs/source/processors/index.rst b/docs/source/processors/index.rst
index 9a4ace0a..ecc40ce8 100644
--- a/docs/source/processors/index.rst
+++ b/docs/source/processors/index.rst
@@ -21,6 +21,7 @@ The following pages covers how to use the available processors within Markdown t
glossary-link
heading
image
+ image-inline
interactive
panel
relative-link
diff --git a/verto/VertoExtension.py b/verto/VertoExtension.py
index 5774ce66..3d662ebb 100644
--- a/verto/VertoExtension.py
+++ b/verto/VertoExtension.py
@@ -3,6 +3,7 @@
from verto.processors.CommentPreprocessor import CommentPreprocessor
from verto.processors.VideoBlockProcessor import VideoBlockProcessor
+from verto.processors.ImageInlinePattern import ImageInlinePattern
from verto.processors.ImageBlockProcessor import ImageBlockProcessor
from verto.processors.InteractiveBlockProcessor import InteractiveBlockProcessor
from verto.processors.RelativeLinkPattern import RelativeLinkPattern
@@ -181,6 +182,7 @@ def buildProcessors(self, md, md_globals):
self.inlinepatterns = [ # A special treeprocessor
['relative-link', RelativeLinkPattern(self, md), '_begin'],
['glossary-link', GlossaryLinkPattern(self, md), '_begin'],
+ ['image-inline', ImageInlinePattern(self, md), '_begin']
]
scratch_ordering = '>inline' if 'hilite' not in self.compatibility else '
+
+{% if caption and caption_link -%}
+
diff --git a/verto/tests/assets/scratch-inline/doc_example_override_html.md b/verto/tests/assets/scratch-inline/doc_example_override_html.md
new file mode 100644
index 00000000..548e1327
--- /dev/null
+++ b/verto/tests/assets/scratch-inline/doc_example_override_html.md
@@ -0,0 +1 @@
+How about some scratch: `scratch:when flag clicked`
diff --git a/verto/tests/assets/scratch-inline/doc_example_override_html_expected.html b/verto/tests/assets/scratch-inline/doc_example_override_html_expected.html
new file mode 100644
index 00000000..969d9740
--- /dev/null
+++ b/verto/tests/assets/scratch-inline/doc_example_override_html_expected.html
@@ -0,0 +1 @@
+
How about some scratch:
diff --git a/verto/tests/assets/scratch-inline/doc_example_override_html_template.html b/verto/tests/assets/scratch-inline/doc_example_override_html_template.html
new file mode 100644
index 00000000..eede164d
--- /dev/null
+++ b/verto/tests/assets/scratch-inline/doc_example_override_html_template.html
@@ -0,0 +1 @@
+
diff --git a/verto/tests/assets/scratch-inline/mixed_codeblocks.md b/verto/tests/assets/scratch-inline/mixed_codeblocks.md
new file mode 100644
index 00000000..55144aa3
--- /dev/null
+++ b/verto/tests/assets/scratch-inline/mixed_codeblocks.md
@@ -0,0 +1 @@
+How about some scratch: `scratch:say [Hello]` which is the same as the python expression: `print('Hello')`
diff --git a/verto/tests/assets/scratch-inline/mixed_codeblocks_expected.html b/verto/tests/assets/scratch-inline/mixed_codeblocks_expected.html
new file mode 100644
index 00000000..4f8df677
--- /dev/null
+++ b/verto/tests/assets/scratch-inline/mixed_codeblocks_expected.html
@@ -0,0 +1 @@
+
How about some scratch: which is the same as the python expression: print('Hello')
diff --git a/verto/tests/assets/scratch-inline/multiple_codeblocks.md b/verto/tests/assets/scratch-inline/multiple_codeblocks.md
new file mode 100644
index 00000000..644f86c0
--- /dev/null
+++ b/verto/tests/assets/scratch-inline/multiple_codeblocks.md
@@ -0,0 +1 @@
+How about some scratch: `scratch:say [Hello] for (2) secs` which will lead into the expression `|scratch|when flag clicked` which causes the avatar to `|scratch|turn ccw (9) degrees`.
diff --git a/verto/tests/assets/scratch-inline/multiple_codeblocks_expected.html b/verto/tests/assets/scratch-inline/multiple_codeblocks_expected.html
new file mode 100644
index 00000000..fd486fa5
--- /dev/null
+++ b/verto/tests/assets/scratch-inline/multiple_codeblocks_expected.html
@@ -0,0 +1 @@
+
How about some scratch: which will lead into the expression which causes the avatar to .
diff --git a/verto/tests/start_tests.py b/verto/tests/start_tests.py
index 069dd019..3e187d31 100644
--- a/verto/tests/start_tests.py
+++ b/verto/tests/start_tests.py
@@ -20,6 +20,7 @@
from verto.tests.RemoveTitleTest import RemoveTitleTest
from verto.tests.SaveTitleTest import SaveTitleTest
from verto.tests.ScratchTest import ScratchTest
+from verto.tests.ScratchInlineTest import ScratchInlineTest
from verto.tests.StyleTest import StyleTest
from verto.tests.TableOfContentsTest import TableOfContentsTest
from verto.tests.VideoTest import VideoTest
@@ -77,6 +78,7 @@ def unit_suite():
unittest.makeSuite(PanelTest),
unittest.makeSuite(SaveTitleTest),
unittest.makeSuite(ScratchTest),
+ unittest.makeSuite(ScratchInlineTest),
unittest.makeSuite(StyleTest),
unittest.makeSuite(RelativeLinkTest),
unittest.makeSuite(RemoveTest),
From 3392e9f9699f0e81b39fc332ea766eb7d26dda21 Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Mon, 22 May 2017 16:07:27 +1200
Subject: [PATCH 06/12] Inline scratch images, implementation.
---
verto/Verto.py | 1 +
verto/VertoExtension.py | 2 +
verto/processor-info.json | 4 ++
.../processors/ScratchInlineTreeprocessor.py | 63 +++++++++++++++++++
verto/processors/ScratchTreeprocessor.py | 6 +-
verto/tests/ScratchInlineTest.py | 21 ++++---
.../doc_example_basic_usage_expected.html | 2 +-
.../doc_example_override_html_expected.html | 2 +-
.../mixed_codeblocks_expected.html | 2 +-
.../scratch-inline/multiple_codeblocks.md | 2 +-
.../multiple_codeblocks_expected.html | 2 +-
11 files changed, 91 insertions(+), 16 deletions(-)
create mode 100644 verto/processors/ScratchInlineTreeprocessor.py
diff --git a/verto/Verto.py b/verto/Verto.py
index 3cc5aa62..e72a3e0b 100644
--- a/verto/Verto.py
+++ b/verto/Verto.py
@@ -16,6 +16,7 @@
'relative-link',
'save-title',
'scratch',
+ 'scratch-inline',
'table-of-contents',
'video'
})
diff --git a/verto/VertoExtension.py b/verto/VertoExtension.py
index 5774ce66..ebc14c69 100644
--- a/verto/VertoExtension.py
+++ b/verto/VertoExtension.py
@@ -15,6 +15,7 @@
from verto.processors.JinjaPostprocessor import JinjaPostprocessor
from verto.processors.HeadingBlockProcessor import HeadingBlockProcessor
from verto.processors.ScratchTreeprocessor import ScratchTreeprocessor
+from verto.processors.ScratchInlineTreeprocessor import ScratchInlineTreeprocessor
from verto.processors.ScratchCompatibilityPreprocessor import ScratchCompatibilityPreprocessor
from verto.processors.ScratchCompatibilityPreprocessor import FENCED_BLOCK_RE_OVERRIDE
from verto.processors.GenericTagBlockProcessor import GenericTagBlockProcessor
@@ -185,6 +186,7 @@ def buildProcessors(self, md, md_globals):
scratch_ordering = '>inline' if 'hilite' not in self.compatibility else 'inline'],
]
self.postprocessors = []
self.buildGenericProcessors(md, md_globals)
diff --git a/verto/processor-info.json b/verto/processor-info.json
index d9066277..f16da6cc 100644
--- a/verto/processor-info.json
+++ b/verto/processor-info.json
@@ -232,6 +232,10 @@
"pattern": "(?P^(?:~{3,}|`{3,}))[ ]*scratch(?P(:[^:\\n$]+)*)[ ]*(hl_lines=(?P\"|')(?P.*?)(?P=quot))?[ ]*}?[ ]*\n(?P.*?)(?<=\n)(?P=fence)[ ]*$"
}
},
+ "scratch-inline": {
+ "class": "custom",
+ "pattern": "^scratch:"
+ },
"style": {
"class": "custom",
"block_pattern": "\\{{{block} ?([^\\}}]*)\\}}",
diff --git a/verto/processors/ScratchInlineTreeprocessor.py b/verto/processors/ScratchInlineTreeprocessor.py
new file mode 100644
index 00000000..7cfcfd64
--- /dev/null
+++ b/verto/processors/ScratchInlineTreeprocessor.py
@@ -0,0 +1,63 @@
+from verto.processors.ScratchTreeprocessor import ScratchTreeprocessor
+from verto.utils.HtmlParser import HtmlParser
+import re
+
+
+class ScratchInlineTreeprocessor(ScratchTreeprocessor):
+ ''' Searches a Document for codeblocks with the scratch language.
+ These are then processed into the verto result and hashed for
+ another program in the pipeline to retrieve or create into images.
+ '''
+
+ def __init__(self, ext, *args, **kwargs):
+ '''
+ Args:
+ ext: The parent node of the element tree that children will
+ reside in.
+ '''
+ super().__init__(ext, *args, **kwargs)
+ self.processor = 'scratch-inline'
+ self.pattern = re.compile(ext.processor_info[self.processor]['pattern'])
+ self.template = ext.jinja_templates[self.processor]
+ self.scratch_images = ext.required_files['scratch_images']
+ self.fenced_compatibility = 'fenced_code_block' in ext.compatibility
+
+ def run(self, root):
+ ''' Processes the html tree finding code tags outside pre tags
+ where scratch code is used and replaces with template html.
+
+ Args:
+ root: The root of the document element tree.
+ '''
+ code_elements = set()
+ pre_code_elements = set()
+ for node in root.iterfind('.//code'):
+ code_elements.add(node)
+ for node in root.iterfind('.//pre/code'):
+ pre_code_elements.add(node)
+
+ for node in (code_elements - pre_code_elements):
+ self.process_html(node)
+
+ def process_html(self, node):
+ ''' Checks if given node is a scratch code tag and replaces
+ with the given html template.
+
+ Args:
+ node: The possible pre node of a code block.
+ '''
+ content = node.text.strip()
+ match = self.pattern.match(content)
+
+ if match is not None:
+ block = content[match.end():]
+ content_hash = self.hash_content(block)
+ self.update_required_images(content_hash, block)
+
+ parser = HtmlParser()
+ html_string = self.template.render({'hash': content_hash})
+ new_node = parser.feed(html_string).close().get_root()
+
+ node.tag = 'remove'
+ node.text = ''
+ node.append(new_node)
diff --git a/verto/processors/ScratchTreeprocessor.py b/verto/processors/ScratchTreeprocessor.py
index 363b4642..a9c315e0 100644
--- a/verto/processors/ScratchTreeprocessor.py
+++ b/verto/processors/ScratchTreeprocessor.py
@@ -44,7 +44,11 @@ def run(self, root):
Args:
root: The root of the document element tree.
'''
- for node in root.iter('pre'):
+ code_elements = []
+ for node in root.iterfind('.//pre'): # A modified tree will leave the iterator undefined.
+ code_elements.append(node)
+
+ for node in code_elements:
self.process_html(node)
if self.fenced_compatibility:
diff --git a/verto/tests/ScratchInlineTest.py b/verto/tests/ScratchInlineTest.py
index 4479ad4a..3b5e3256 100644
--- a/verto/tests/ScratchInlineTest.py
+++ b/verto/tests/ScratchInlineTest.py
@@ -3,7 +3,8 @@
from collections import defaultdict
from verto.VertoExtension import VertoExtension
-from verto.processors.ScratchInlineTest import ScratchInlineTest
+from verto.processors.ScratchTreeprocessor import ScratchImageMetaData
+from verto.processors.ScratchInlineTreeprocessor import ScratchInlineTreeprocessor
from verto.tests.ProcessorTest import ProcessorTest
class ScratchInlineTest(ProcessorTest):
@@ -31,7 +32,7 @@ def test_doc_example_basic(self):
actual_scratch_images = self.verto_extension.required_files['scratch_images']
expected_scratch_images = {
ScratchImageMetaData(
- hash='',
+ hash='3dfa73663a21d295e1e5c1e5583d8d01edd68ec53ad3050597de126076c44ea5',
text='say [Hello] for (2) secs'
),
}
@@ -51,7 +52,7 @@ def test_doc_example_override_html(self):
actual_scratch_images = verto_extension.required_files['scratch_images']
expected_scratch_images = {
ScratchImageMetaData(
- hash='',
+ hash='2f3ea223b778227287b8935bc5d209e25d3e8a25ef46ff85f6c44818159601d7',
text='when flag clicked'
),
}
@@ -72,15 +73,15 @@ def test_multiple_codeblocks(self):
actual_scratch_images = self.verto_extension.required_files['scratch_images']
expected_scratch_images = {
ScratchImageMetaData(
- hash='',
+ hash='3dfa73663a21d295e1e5c1e5583d8d01edd68ec53ad3050597de126076c44ea5',
text='say [Hello] for (2) secs'
),
ScratchImageMetaData(
- hash='',
+ hash='2f3ea223b778227287b8935bc5d209e25d3e8a25ef46ff85f6c44818159601d7',
text='when flag clicked'
),
ScratchImageMetaData(
- hash='',
+ hash='1c95862744e873cc87e4cadf6174257ce6e8a237b29b5c41f241e98e0d78eb14',
text='turn ccw (9) degrees'
),
}
@@ -99,7 +100,7 @@ def test_mixed_codeblocks(self):
actual_scratch_images = verto_extension.required_files['scratch_images']
expected_scratch_images = {
ScratchImageMetaData(
- hash='',
+ hash='9dabe0bac28bc3a143cfb19c2e5d7f46aae62b3d793166a56665a789d0df5bf7',
text='say [Hello]'
)
}
@@ -119,15 +120,15 @@ def test_codeblocks_compatibility(self):
actual_scratch_images = verto_extension.required_files['scratch_images']
expected_scratch_images = {
ScratchImageMetaData(
- hash='',
+ hash='3dfa73663a21d295e1e5c1e5583d8d01edd68ec53ad3050597de126076c44ea5',
text='say [Hello] for (2) secs'
),
ScratchImageMetaData(
- hash='',
+ hash='2f3ea223b778227287b8935bc5d209e25d3e8a25ef46ff85f6c44818159601d7',
text='when flag clicked'
),
ScratchImageMetaData(
- hash='',
+ hash='1c95862744e873cc87e4cadf6174257ce6e8a237b29b5c41f241e98e0d78eb14',
text='turn ccw (9) degrees'
),
}
diff --git a/verto/tests/assets/scratch-inline/doc_example_basic_usage_expected.html b/verto/tests/assets/scratch-inline/doc_example_basic_usage_expected.html
index 5ff4a776..09960caa 100644
--- a/verto/tests/assets/scratch-inline/doc_example_basic_usage_expected.html
+++ b/verto/tests/assets/scratch-inline/doc_example_basic_usage_expected.html
@@ -1 +1 @@
-
How about some scratch: which is the same as the python expression: print('Hello')
+
How about some scratch: which is the same as the python expression: print('Hello')
diff --git a/verto/tests/assets/scratch-inline/multiple_codeblocks.md b/verto/tests/assets/scratch-inline/multiple_codeblocks.md
index 644f86c0..40c25c3a 100644
--- a/verto/tests/assets/scratch-inline/multiple_codeblocks.md
+++ b/verto/tests/assets/scratch-inline/multiple_codeblocks.md
@@ -1 +1 @@
-How about some scratch: `scratch:say [Hello] for (2) secs` which will lead into the expression `|scratch|when flag clicked` which causes the avatar to `|scratch|turn ccw (9) degrees`.
+How about some scratch: `scratch:say [Hello] for (2) secs` which will lead into the expression `scratch:when flag clicked` which causes the avatar to `scratch:turn ccw (9) degrees`.
diff --git a/verto/tests/assets/scratch-inline/multiple_codeblocks_expected.html b/verto/tests/assets/scratch-inline/multiple_codeblocks_expected.html
index fd486fa5..30f7cc1f 100644
--- a/verto/tests/assets/scratch-inline/multiple_codeblocks_expected.html
+++ b/verto/tests/assets/scratch-inline/multiple_codeblocks_expected.html
@@ -1 +1 @@
-
How about some scratch: which will lead into the expression which causes the avatar to .
+
How about some scratch: which will lead into the expression which causes the avatar to .
From 076b2fd4381aa1b30adcc26a2a9611fa9134d1f0 Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Mon, 22 May 2017 16:09:32 +1200
Subject: [PATCH 07/12] PR fixes, added image-inline to defaults.
---
docs/source/processors/image-inline.rst | 2 +-
verto/Verto.py | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/docs/source/processors/image-inline.rst b/docs/source/processors/image-inline.rst
index 73886744..a30fff53 100644
--- a/docs/source/processors/image-inline.rst
+++ b/docs/source/processors/image-inline.rst
@@ -5,7 +5,7 @@ Inline Image
.. note::
- The inline image tag allows for the use of images inside tables, *etc* without causing style errors. The tag functions almost exactly the same as the ``image`` tag except for not excluding the alignment argument.
+ The inline image tag allows for the use of images inside tables, *etc* without causing style errors. The tag functions almost exactly the same as the ``image`` tag except for the alignment argument.
You can include an inline image using the following text tag:
diff --git a/verto/Verto.py b/verto/Verto.py
index 3cc5aa62..3b3f8ef5 100644
--- a/verto/Verto.py
+++ b/verto/Verto.py
@@ -11,6 +11,7 @@
'heading',
'iframe',
'image',
+ 'image-inline',
'interactive',
'panel',
'relative-link',
From 3a2feeded83ab1cc8d8df2a60473a1817956825f Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Mon, 22 May 2017 16:17:00 +1200
Subject: [PATCH 08/12] Document that html-templates must have a single root
level node after rendering.
---
docs/source/contributing.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst
index 45336790..d0b7b0a1 100644
--- a/docs/source/contributing.rst
+++ b/docs/source/contributing.rst
@@ -104,7 +104,7 @@ The items of interest are:
- ``processors/`` - There is a different processor for each tag. A processor uses it's corresponding description loaded from ``processor-info.json`` to find matches in the text, and uses the given arguments in the matched tag to populate and output it's html template.
-- ``html-templates/`` - The html templates (using the Jinja2 template engine) with variable arguments to be populated by processors.
+- ``html-templates/`` - The html templates (using the Jinja2 template engine) with variable arguments to be populated by processors.
- ``errors/`` - Contains all the errors exposed by the Verto module. Where an Error is an exception that is caused by user input. New errors should be created in here inheriting from the base ``Error`` class.
@@ -141,7 +141,7 @@ There are two types of generic processors:
- tags (``generic_tag``): which match ``{}`` in the markdown text replacing with the given html-template.
- containers (``generic_container``): which are a pair of tags which capture the content between the tags for the html-template. A generic container's opening tag specifies the arguments, while the closing tag only has the ``end`` argument allowing for the content to contain generic containers.
-To create a new processor that uses the generic processors the processor must be added to the ``processor-info.json`` file and an associated html-template must be created.
+To create a new processor that uses the generic processors the processor must be added to the ``processor-info.json`` file and an associated html-template must be created. Where the template must only have one root level node after rendering.
How to make a JSON Definition
++++++++++++++++++++++++++++++++++++++
@@ -286,7 +286,7 @@ The logic for each processor belongs in the ``processors/`` directory, and there
- The processor's relevant information (regex pattern, required parameters etc) should be included in ``processor-info.json``.
- If it should be a default processor, it should be added to the frozenset of ``DEFAULT_PROCESSORS`` in ``Verto.py``.
- The relevant list in ``extendMarkdown()`` in ``VertoExtension.py`` (see `OrderedDict in the Markdown API docs`_ for manipulating processor order).
-- The processor's template should be added to ``html-templates`` using the Jinja2 template engine syntax for variable parameters.
+- The processor's template should be added to ``html-templates`` using the Jinja2 template engine syntax for variable parameters. A valid template will only have one root level node after rendering.
- Any errors should have appropriate classes in the ``errors\`` directory, they should be well described by their class name such that for an expert knows immediately what to do to resolve the issue, otherwise a message should be used to describe the exact causation of the error for a novice.
From 3cdb6610bbf1daafc4c117a3e4fe1f98684ea573 Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Mon, 22 May 2017 16:18:48 +1200
Subject: [PATCH 09/12] Document using remove to allow for multiple root level
nodes.
---
docs/source/contributing.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst
index d0b7b0a1..9f849392 100644
--- a/docs/source/contributing.rst
+++ b/docs/source/contributing.rst
@@ -104,7 +104,7 @@ The items of interest are:
- ``processors/`` - There is a different processor for each tag. A processor uses it's corresponding description loaded from ``processor-info.json`` to find matches in the text, and uses the given arguments in the matched tag to populate and output it's html template.
-- ``html-templates/`` - The html templates (using the Jinja2 template engine) with variable arguments to be populated by processors.
+- ``html-templates/`` - The html templates (using the Jinja2 template engine) with variable arguments to be populated by processors.
- ``errors/`` - Contains all the errors exposed by the Verto module. Where an Error is an exception that is caused by user input. New errors should be created in here inheriting from the base ``Error`` class.
@@ -286,7 +286,7 @@ The logic for each processor belongs in the ``processors/`` directory, and there
- The processor's relevant information (regex pattern, required parameters etc) should be included in ``processor-info.json``.
- If it should be a default processor, it should be added to the frozenset of ``DEFAULT_PROCESSORS`` in ``Verto.py``.
- The relevant list in ``extendMarkdown()`` in ``VertoExtension.py`` (see `OrderedDict in the Markdown API docs`_ for manipulating processor order).
-- The processor's template should be added to ``html-templates`` using the Jinja2 template engine syntax for variable parameters. A valid template will only have one root level node after rendering.
+- The processor's template should be added to ``html-templates`` using the Jinja2 template engine syntax for variable parameters. A valid template will only have one root level node after rendering, if more root nodes are necessary the remove tag can be used as the root node which will be removed later.
- Any errors should have appropriate classes in the ``errors\`` directory, they should be well described by their class name such that for an expert knows immediately what to do to resolve the issue, otherwise a message should be used to describe the exact causation of the error for a novice.
From 603fff217c33765726c0059b805c14f4035db210 Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Mon, 22 May 2017 16:22:30 +1200
Subject: [PATCH 10/12] Fix typo in documentation 'heading_root' ->
'heading_tree'.
---
docs/source/usage.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/source/usage.rst b/docs/source/usage.rst
index b6ae536b..d69f5d6f 100644
--- a/docs/source/usage.rst
+++ b/docs/source/usage.rst
@@ -86,7 +86,7 @@ The following attributes are available:
- See :ref:`accessing-scratch-image-data` for data from Scratch processor.
-- ``heading_root`` - A tuple of namedtuples which describes the tree of headings, as generated by our heading processor. Each namedtuple contains a ``title`` (string), ``title_slug`` (string), ``level`` (integer) and ``children`` (tuple of nodes).
+- ``heading_tree`` - A tuple of namedtuples which describes the tree of headings, as generated by our heading processor. Each namedtuple contains a ``title`` (string), ``title_slug`` (string), ``level`` (integer) and ``children`` (tuple of nodes).
- For example the heading root after a conversion of a file:
From 30a3983860c94bb704d31901486983a0460f310c Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Mon, 22 May 2017 16:30:38 +1200
Subject: [PATCH 11/12] PR fixes.
---
docs/source/contributing.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst
index 9f849392..49f390d1 100644
--- a/docs/source/contributing.rst
+++ b/docs/source/contributing.rst
@@ -141,7 +141,7 @@ There are two types of generic processors:
- tags (``generic_tag``): which match ``{}`` in the markdown text replacing with the given html-template.
- containers (``generic_container``): which are a pair of tags which capture the content between the tags for the html-template. A generic container's opening tag specifies the arguments, while the closing tag only has the ``end`` argument allowing for the content to contain generic containers.
-To create a new processor that uses the generic processors the processor must be added to the ``processor-info.json`` file and an associated html-template must be created. Where the template must only have one root level node after rendering.
+To create a new processor that uses the generic processors the processor must be added to the ``processor-info.json`` file and an associated html-template must be created. The template must only have one root level node after rendering.
How to make a JSON Definition
++++++++++++++++++++++++++++++++++++++
From 831481fae2f95f548f7db16d4cf52669f247b768 Mon Sep 17 00:00:00 2001
From: ravenmaster001
Date: Tue, 23 May 2017 08:38:20 +1200
Subject: [PATCH 12/12] Bump to version 0.6.0.
---
docs/source/changelog.rst | 13 +++++++++++++
verto/__init__.py | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst
index 00384398..c3a8d5d9 100644
--- a/docs/source/changelog.rst
+++ b/docs/source/changelog.rst
@@ -1,6 +1,19 @@
Changelog
#######################################
+0.6.0
+=======================================
+
+Features:
+
+ - Added :doc:`processors/image-inline` processor, intended for use in tables.
+ - Added :doc:`processors/scratch-inline` processor for inline scratch support.
+
+Fixes:
+
+ - Removed ``beautifulsoup4`` dependency.
+ - Typo in VertoResult documentation (*heading_root* -> *heading_tree*).
+
0.5.3
=======================================
diff --git a/verto/__init__.py b/verto/__init__.py
index 741c4762..7e3917ef 100644
--- a/verto/__init__.py
+++ b/verto/__init__.py
@@ -1,4 +1,4 @@
# flake8: noqa
from .Verto import Verto
-__version__ = '0.5.3'
+__version__ = '0.6.0'