diff --git a/README.rst b/README.rst index 0fcacbae..15d0f2e0 100644 --- a/README.rst +++ b/README.rst @@ -19,7 +19,9 @@ markdown: Example Paragraph - {panel type="example" title="Example Panel"} + {panel type="example"} + + # Example Panel {image file-path="http://placehold.it/350x150" caption="Example Image"} diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 99a4f52d..9d3c693f 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,6 +1,31 @@ Changelog ####################################### +0.8.0 +======================================= + +- Modify :doc:`processors/interactive` processor for translating text, by required text between start and end tags for whole page interactives. +- Modify Verto parameters available on creation to allow modification of default required parameters for each processor. +- Dependency updates: + + - Update ``setuptools`` to 40.2.0. + - Update ``sphinx`` to 1.7.7. + - Update ``sphinx_rtx_theme`` to 0.4.1. + +0.7.4 +======================================= + +- Modify :doc:`processors/interactive` processor to use ``slug`` rather than ``name`` to identify interactives +- Modify :doc:`processors/video` processor template for youtube videos +- Modify :doc:`processors/boxed-text` processor to have optional type parameter +- Update style error message to inclue line numbers +- Dependency updates: + + - Update ``python-slugify`` to 1.2.5. + - Update ``setuptools`` to 39.1.0. + - Update ``sphinx`` to 1.6.6. + - Update ``sphinx_rtx_theme`` to 0.3.0. + 0.7.3 ======================================= diff --git a/docs/source/processors/interactive.rst b/docs/source/processors/interactive.rst index 2b331b0a..77ad59d3 100644 --- a/docs/source/processors/interactive.rst +++ b/docs/source/processors/interactive.rst @@ -18,13 +18,14 @@ interactive as requested. You can include an interactive using the following text tag: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_in_page_usage.md +.. literalinclude:: ../../../verto/tests/assets/interactive-tag/doc_example_in_page_usage.md :language: none Required Tag Parameters *************************************** -- ``name`` - The name to the interactive to include/link to. +- ``slug`` - The slug to the interactive to include/link to. + This slug is added to the list of interactives in ``required_files``. - ``type`` - Sets the way the interactive is included in the page. Must be set to one of the following values: @@ -33,27 +34,33 @@ Required Tag Parameters page). - ``whole-page`` - Creates a link to the interactive displayed on a separate page (this is the preferred method for including an interactive - on a separate page). The link shows a thumbnail of the interactive with - text (the text is set using the ``text`` parameter). + on a separate page). + The link shows a thumbnail of the interactive with text (the text is set using the + ``text`` parameter). By default, the thumbnail should be a ``thumbnail.png`` file found within the interactive's img folder. - ``iframe`` - The interactive is included in the page by embedding using - an iframe. This is used if the interactive is included multiple times on + an iframe. + This is used if the interactive is included multiple times on the page to avoid conflicts in JavaScript/CSS. Optional Tag Parameters *************************************** -- ``text`` (used with ``whole-page`` value) - Sets the text for the interactive - link. If no text is given, the link uses the text ``Click to load - {{ name }}``. +- ``text`` - Boolean flag to indicate whether the interactive has custom text to dispaly. + + - If given as ``true``, the the subtitle is the first block of text with the interactive block. + - This is only use with the ``whole-page`` value. + - If no text is given, the link uses the text ``Click to load {{ slug }}``. + - ``parameters`` (used with ``whole-page`` and ``iframe`` values) - Adds the parameters - to interactive link. For example: ``digits=5&start=BBBBB``. Do not include - the ``?`` at the start, as this is already included in the output. + to interactive link. + For example: ``digits=5&start=BBBBB``. + Do not include the ``?`` at the start, as this is already included in the output. - ``thumbnail`` (optional - used with ``whole-page`` value) - Displays an alternative thumbnail for the interactive. When not provided, it defaults to - ``interactives/interactive-name/img/thumbnail.png``, where ``interactive-name`` is the - value given for the ``name`` tag parameter (see above). + ``interactives/interactive-slug/img/thumbnail.png``, where ``interactive-slug`` is the + value given for the ``slug`` tag parameter (see above). - If the ``thumbnail`` value provided is a relative link (a link that doesn't start with ``http:``), the link will be rendered with a Django @@ -86,36 +93,36 @@ Examples Using the following example tag: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_in_page_usage.md +.. literalinclude:: ../../../verto/tests/assets/interactive-tag/doc_example_in_page_usage.md :language: none The resulting HTML would be: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_in_page_usage_expected.html +.. literalinclude:: ../../../verto/tests/assets/interactive-tag/doc_example_in_page_usage_expected.html :language: html **whole-page example** Using the following example tag: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_whole_page_usage.md +.. literalinclude:: ../../../verto/tests/assets/interactive-container/doc_example_whole_page_usage.md :language: none The resulting HTML would be: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_whole_page_usage_expected.html +.. literalinclude:: ../../../verto/tests/assets/interactive-container/doc_example_whole_page_usage_expected.html :language: html **iframe example** Using the following example tag: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_iframe_usage.md +.. literalinclude:: ../../../verto/tests/assets/interactive-tag/doc_example_iframe_usage.md :language: none The resulting HTML would be: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_iframe_usage_expected.html +.. literalinclude:: ../../../verto/tests/assets/interactive-tag/doc_example_iframe_usage_expected.html :language: html Overriding HTML for Interactives @@ -124,7 +131,7 @@ Overriding HTML for Interactives When overriding the HTML for interactives, the following Jinja2 placeholders are available: - ``{{ type }}`` - The type of the interactive. -- ``{{ name }}`` - The slug name of the interactive to include/link to. +- ``{{ slug }}`` - The slug of the interactive to include/link to. - ``{{ text }}`` - The text to to display to a link to a ``whole-page`` interactive. - ``{{ parameters }}`` - GET parameters to append to the interactive link. @@ -138,17 +145,17 @@ thumbnail. For example, providing the following HTML: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_override_html_template.html +.. literalinclude:: ../../../verto/tests/assets/interactive-container/doc_example_override_html_template.html :language: css+jinja with the following tag: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_override_html.md +.. literalinclude:: ../../../verto/tests/assets/interactive-container/doc_example_override_html.md :language: none would result in: -.. literalinclude:: ../../../verto/tests/assets/interactive/doc_example_override_html_expected.html +.. literalinclude:: ../../../verto/tests/assets/interactive-container/doc_example_override_html_expected.html :language: html diff --git a/docs/source/usage.rst b/docs/source/usage.rst index d69f5d6f..c215f36b 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -51,6 +51,19 @@ Once the module is imported, you can create a Verto converter creating an Verto - ``extensions`` - A list of extra Markdown extensions to run in the converter. Details on how to use this parameter can be found on the :doc:`extensions` page. +- ``custom_argument_rules`` - A dictionary to modify the default argument rules for each tag. The default rules can found by reading the documentation for each tag. + + - *For example:* By default, the ``image-inline`` tag requires alt text to be given, to change this, the following custom argument rules file would be used: + + .. code-block:: python + + { + "image-inline": { + "alt": false + } + } + + Step 3: Convert Markdown with converter ======================================= diff --git a/requirements.txt b/requirements.txt index 144f6b15..9888d27a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ # Required dependencies for Verto (installed automatically in setup.py) markdown==2.6.11 Jinja2==2.10 -python-slugify==1.2.4 -setuptools==38.4.0 +python-slugify==1.2.5 +setuptools==40.2.0 # Required dependencies for building documentation -sphinx==1.6.6 -sphinx_rtd_theme==0.2.4 +sphinx==1.7.7 +sphinx_rtd_theme==0.4.1 diff --git a/verto/Verto.py b/verto/Verto.py index 1f572dec..43c9f051 100644 --- a/verto/Verto.py +++ b/verto/Verto.py @@ -13,7 +13,8 @@ 'image-container', 'image-tag', 'image-inline', - 'interactive', + 'interactive-tag', + 'interactive-container', 'panel', 'relative-link', 'save-title', @@ -29,7 +30,7 @@ class Verto(object): to HTML. ''' - def __init__(self, processors=DEFAULT_PROCESSORS, html_templates={}, extensions=[]): + def __init__(self, processors=DEFAULT_PROCESSORS, html_templates={}, extensions=[], custom_argument_rules={}): '''Creates a Verto object. Args: @@ -43,10 +44,13 @@ def __init__(self, processors=DEFAULT_PROCESSORS, html_templates={}, extensions= eg: {'image': ''} extensions: A list of extra extensions to run on the markdown package. + custom_argument_rules: A dictionary of rules for the processors to + override default processor rules. ''' self.processors = set(processors) self.html_templates = dict(html_templates) self.extensions = list(extensions) + self.custom_argument_rules = custom_argument_rules self.create_converter() def create_converter(self): @@ -54,7 +58,8 @@ def create_converter(self): self.verto_extension = VertoExtension( processors=self.processors, html_templates=self.html_templates, - extensions=self.extensions + extensions=self.extensions, + custom_argument_rules=self.custom_argument_rules, ) all_extensions = self.extensions + [self.verto_extension] self.converter = markdown.Markdown(extensions=all_extensions) diff --git a/verto/VertoExtension.py b/verto/VertoExtension.py index 9241d422..815cd61e 100644 --- a/verto/VertoExtension.py +++ b/verto/VertoExtension.py @@ -6,7 +6,8 @@ from verto.processors.ImageInlinePattern import ImageInlinePattern from verto.processors.ImageTagBlockProcessor import ImageTagBlockProcessor from verto.processors.ImageContainerBlockProcessor import ImageContainerBlockProcessor -from verto.processors.InteractiveBlockProcessor import InteractiveBlockProcessor +from verto.processors.InteractiveTagBlockProcessor import InteractiveTagBlockProcessor +from verto.processors.InteractiveContainerBlockProcessor import InteractiveContainerBlockProcessor from verto.processors.RelativeLinkPattern import RelativeLinkPattern from verto.processors.RemoveTitlePreprocessor import RemoveTitlePreprocessor from verto.processors.SaveTitlePreprocessor import SaveTitlePreprocessor @@ -30,6 +31,8 @@ from verto.utils.overrides import OListProcessor from verto.utils.overrides import UListProcessor +from verto.errors.CustomArgumentRulesError import CustomArgumentRulesError + from collections import defaultdict, OrderedDict from os import listdir import os.path @@ -46,7 +49,7 @@ class VertoExtension(Extension): the Verto converter. ''' - def __init__(self, processors=[], html_templates={}, extensions=[], *args, **kwargs): + def __init__(self, processors=[], html_templates={}, extensions=[], custom_argument_rules={}, *args, **kwargs): ''' Args: processors: A set of processor names given as strings for which @@ -61,8 +64,9 @@ def __init__(self, processors=[], html_templates={}, extensions=[], *args, **kwa ''' super().__init__(*args, **kwargs) self.jinja_templates = self.loadJinjaTemplates(html_templates) - self.processor_info = self.loadProcessorInfo() self.processors = processors + self.custom_argument_rules = custom_argument_rules + self.processor_info = self.loadProcessorInfo() self.title = None self.heading_tree = None self.custom_slugify = UniqueSlugify() @@ -144,9 +148,9 @@ def loadJinjaTemplates(self, custom_templates): ''' templates = {} env = Environment( - loader=PackageLoader('verto', 'html-templates'), - autoescape=select_autoescape(['html']) - ) + loader=PackageLoader('verto', 'html-templates'), + autoescape=select_autoescape(['html']) + ) for file in listdir(os.path.join(os.path.dirname(__file__), 'html-templates')): html_file = re.search(r'(.*?).html$', file) if html_file: @@ -174,7 +178,8 @@ def buildProcessors(self, md, md_globals): # Markdown overrides ['heading', HeadingBlockProcessor(self, md.parser), ' +
{% autoescape false -%} {{ text }} {% endautoescape -%} diff --git a/verto/html-templates/interactive.html b/verto/html-templates/interactive.html index dd1f00fa..627a1eea 100644 --- a/verto/html-templates/interactive.html +++ b/verto/html-templates/interactive.html @@ -1,14 +1,14 @@ {%- if type == 'in-page' -%} -{{ "{% include 'interactive/" }}{{ name }}{{ "/index.html' %}" }} +{{ "{% include 'interactive/" }}{{ slug }}{{ "/index.html' %}" }} {% elif type == 'iframe' -%} - {% elif type == 'whole-page' -%} diff --git a/verto/html-templates/video-youtube.html b/verto/html-templates/video-youtube.html index 805ebfbc..aee17c27 100644 --- a/verto/html-templates/video-youtube.html +++ b/verto/html-templates/video-youtube.html @@ -1 +1 @@ -https://www.youtube.com/embed/{{ identifier }}?rel=0 +https://www.youtube.com/embed/{{ identifier }} diff --git a/verto/processor-info.json b/verto/processor-info.json index 3a14f5bc..bf35e8a7 100644 --- a/verto/processor-info.json +++ b/verto/processor-info.json @@ -6,6 +6,10 @@ "required": false, "dependencies": [], "values": ["yes", "no"] + }, + "type": { + "required": false, + "dependencies": [] } }, "template_name": "boxed-text", @@ -17,6 +21,10 @@ "text": { "argument": "content", "transform": null + }, + "type": { + "argument": "type", + "transform": "str.lower" } } }, @@ -131,7 +139,7 @@ "dependencies": [] }, "alt": { - "required": false, + "required": true, "dependencies": [] }, "caption": { @@ -207,7 +215,7 @@ "dependencies": [] }, "alt": { - "required": false, + "required": true, "dependencies": [] }, "caption": { @@ -281,7 +289,7 @@ "dependencies": [] }, "alt": { - "required": false, + "required": true, "dependencies": [] }, "caption": { @@ -302,10 +310,13 @@ } } }, - "interactive": { + "interactive-tag": { "class": "custom", + "tag_argument": "interactive", + "pattern": "(^|\\n) *\\{interactive (?P[^\\}]*)?(?Ptext=\"true\")(?P[^\\}]*)?\\} *(\\n|$)", + "template_name": "interactive", "arguments": { - "name": { + "slug": { "required": true, "dependencies": [] }, @@ -314,10 +325,56 @@ "dependencies": [], "values": ["in-page", "whole-page", "iframe"] }, - "text": { + "parameters": { "required": false, "dependencies": [] }, + "thumbnail": { + "required": false, + "dependencies": [] + } + }, + "template_parameters": { + "type": { + "argument": "type" + }, + "slug": { + "argument": "slug" + }, + "text": { + "argument": "text" + }, + "parameters": { + "argument": "parameters" + }, + "thumbnail_file_path": { + "argument": "thumbnail_file_path" + }, + "thumbnail_file_relative": { + "argument": "thumbnail_file_relative" + } + } + }, + "interactive-container": { + "class": "custom", + "pattern": "(^|\\n) *\\{interactive (?P[^\\}]*)?(?Ptext=\"true\")(?P[^\\}]*)?\\} *(\\n|$)", + "tag_argument": "interactive", + "template_name": "interactive", + "arguments": { + "slug": { + "required": true, + "dependencies": [] + }, + "type": { + "required": true, + "dependencies": [], + "values": ["whole-page"] + }, + "text": { + "required": true, + "dependencies": [], + "values": ["true", "false"] + }, "parameters": { "required": false, "dependencies": [] @@ -331,8 +388,8 @@ "type": { "argument": "type" }, - "name": { - "argument": "name" + "slug": { + "argument": "slug" }, "text": { "argument": "text" diff --git a/verto/processors/ConditionalProcessor.py b/verto/processors/ConditionalProcessor.py index 38b13199..f4cac837 100644 --- a/verto/processors/ConditionalProcessor.py +++ b/verto/processors/ConditionalProcessor.py @@ -1,6 +1,6 @@ from markdown.blockprocessors import BlockProcessor from verto.errors.TagNotMatchedError import TagNotMatchedError -from verto.processors.utils import etree, parse_arguments, parse_flag, blocks_to_string +from verto.processors.utils import etree, parse_arguments, blocks_to_string from verto.utils.HtmlParser import HtmlParser from verto.utils.HtmlSerializer import HtmlSerializer from collections import OrderedDict @@ -57,14 +57,20 @@ def run(self, parent, blocks): context = dict() start_tag = self.pattern.search(block) - is_if = parse_flag('if', start_tag.group('args')) + is_if = tag_starts_with('if', start_tag.group('args')) # elif or else before an if conditional if not is_if: - is_elif = parse_flag('elif', start_tag.group('args')) - is_else = parse_flag('else', start_tag.group('args')) - is_end = parse_flag('end', start_tag.group('args')) - string = 'elif' if is_elif else 'else' if is_else else 'end' if is_end else 'unrecognised' + string = '' + if tag_starts_with('elif', start_tag.group('args')): + string = 'elif' + elif tag_starts_with('else', start_tag.group('args')): + string = 'else' + elif tag_starts_with('end', start_tag.group('args')): + 'end' + else: + string = 'unrecognised' + msg = '{} conditional found before if'.format(string) raise TagNotMatchedError(self.processor, block, msg) @@ -85,7 +91,7 @@ def run(self, parent, blocks): # Process elif statements elifs = OrderedDict() - while next_tag is not None and parse_flag('elif', next_tag.group('args')): + while next_tag is not None and tag_starts_with('elif', next_tag.group('args')): argument_values = parse_arguments(self.processor, next_tag.group('args'), self.arguments) elif_expression = argument_values['condition'] next_tag, block, content_blocks = self.get_content(blocks) @@ -94,7 +100,7 @@ def run(self, parent, blocks): context['elifs'] = elifs # Process else statement - has_else = next_tag is not None and parse_flag('else', next_tag.group('args')) + has_else = next_tag is not None and tag_starts_with('else', next_tag.group('args')) else_content = '' if has_else: argument_values = parse_arguments(self.processor, next_tag.group('args'), self.arguments) @@ -103,7 +109,7 @@ def run(self, parent, blocks): context['has_else'] = has_else context['else_content'] = else_content - if (next_tag is None or (next_tag is not None and not parse_flag('end', next_tag.group('args')))): + if (next_tag is None or (next_tag is not None and not tag_starts_with('end', next_tag.group('args')))): msg = 'end conditional not found' raise TagNotMatchedError(self.processor, block, msg) @@ -143,10 +149,10 @@ def get_content(self, blocks): # Do we have either a start or end tag next_tag = self.pattern.search(block) - is_if = next_tag is not None and parse_flag('if', next_tag.group('args')) - is_elif = next_tag is not None and parse_flag('elif', next_tag.group('args')) - is_else = next_tag is not None and parse_flag('else', next_tag.group('args')) - is_end = next_tag is not None and parse_flag('end', next_tag.group('args')) + is_if = next_tag is not None and tag_starts_with('if', next_tag.group('args')) + is_elif = next_tag is not None and tag_starts_with('elif', next_tag.group('args')) + is_else = next_tag is not None and tag_starts_with('else', next_tag.group('args')) + is_end = next_tag is not None and tag_starts_with('end', next_tag.group('args')) # Keep track of how many inner boxed-text start tags we have seen if is_if: @@ -189,3 +195,21 @@ def parse_blocks(self, blocks): for child in content_tree: content += HtmlSerializer.tostring(child) return content + + +def tag_starts_with(argument_key, arguments, default=False): + '''Search for the given argument in a string of all arguments, + treating the argument as a flag only. + + Args: + argument_key: the name of the argument. + arguments: a string of the argument inputs. + default: the default value if not found. + Returns: + True if argument is found, otherwise None. + ''' + result = re.search(r'(^|\s+){}($|\s)'.format(argument_key), arguments) + if result: + return True + else: + return default diff --git a/verto/processors/InteractiveContainerBlockProcessor.py b/verto/processors/InteractiveContainerBlockProcessor.py new file mode 100644 index 00000000..2451f4f8 --- /dev/null +++ b/verto/processors/InteractiveContainerBlockProcessor.py @@ -0,0 +1,90 @@ +from verto.processors.GenericContainerBlockProcessor import GenericContainerBlockProcessor +from verto.errors.InteractiveTextContainsInteractiveError import InteractiveTextContainsInteractiveError +from verto.errors.InteractiveMissingTextError import InteractiveMissingTextError + +import re + + +class InteractiveContainerBlockProcessor(GenericContainerBlockProcessor): + ''' Searches a Document for interactive tags e.g. + {interactive slug='example' type='in-page'}. + These are then replaced with the html template. + ''' + + def __init__(self, ext, *args, **kwargs): + ''' + Args: + ext: The parent node of the element tree that children will + reside in. + ''' + self.processor = 'interactive-container' + super().__init__(self.processor, ext, *args, **kwargs) + self.pattern = re.compile(ext.processor_info[self.processor]['pattern']) + + self.scripts = ext.required_files['page_scripts'] + self.required_interactives = ext.required_files['interactives'] + self.required_images = ext.required_files['images'] + + def test(self, parent, block): + ''' Tests a block to see if the run method should be applied. + + Args: + parent: The parent node of the element tree that children + will reside in. + block: The block to be tested. + + Returns: + True if there are any start or end tags within the block. + ''' + return self.pattern.search(block) is not None or self.p_end.search(block) is not None + + def custom_parsing(self, content_blocks, argument_values): + ''' + Extracts the text of an interactive block. + + Args: + content_blocks (list): List of strings to either be parsed or inserted as caption in template. + argument_values (dict): Dictionary of arguments and values provided in tag block. + Returns: + Tuple containing blocks (list) and extra_args (dict) to update the content_blocks list and + agument_values dict. + Raises: + + ''' + for block in content_blocks: + if self.p_start.search(block): + raise InteractiveTextContainsInteractiveError(self.processor) + + extra_args = {} + + argument = 'text' + if len(content_blocks) == 0 or content_blocks[0] == '': + raise InteractiveMissingTextError(self.processor, argument) + extra_args[argument] = content_blocks[0] + + interactive_type = argument_values['type'] + slug = argument_values['slug'] + + # add to list of interactives + self.required_interactives.add(slug) + + if interactive_type == 'whole-page': + argument = 'thumbnail' + thumbnail_file_path = argument_values.get(argument, None) + + if thumbnail_file_path is not None: + del argument_values[argument] + else: + thumbnail_file_path = 'interactives/{}/img/thumbnail.png'.format(slug) + + external_path_match = re.search(r'^http', thumbnail_file_path) + if external_path_match is None: # internal image + thumbnail_file_relative = True + self.required_images.add(thumbnail_file_path) + else: + thumbnail_file_relative = False + + extra_args['thumbnail_file_path'] = thumbnail_file_path + extra_args['thumbnail_file_relative'] = thumbnail_file_relative + + return (content_blocks, extra_args) diff --git a/verto/processors/InteractiveBlockProcessor.py b/verto/processors/InteractiveTagBlockProcessor.py similarity index 70% rename from verto/processors/InteractiveBlockProcessor.py rename to verto/processors/InteractiveTagBlockProcessor.py index 2055ab22..e17fecc3 100644 --- a/verto/processors/InteractiveBlockProcessor.py +++ b/verto/processors/InteractiveTagBlockProcessor.py @@ -2,9 +2,9 @@ import re -class InteractiveBlockProcessor(GenericTagBlockProcessor): +class InteractiveTagBlockProcessor(GenericTagBlockProcessor): '''Searches a Document for interactive tags: - e.g. {interactive name='example' type='in-page'} + e.g. {interactive slug='example' type='in-page'} These are then replaced with the html template. ''' @@ -13,11 +13,25 @@ def __init__(self, ext, *args, **kwargs): Args: ext: An instance of the Verto Extension. ''' - self.processor = 'interactive' + self.processor = 'interactive-tag' super().__init__(self.processor, ext, *args, **kwargs) self.scripts = ext.required_files['page_scripts'] self.required_interactives = ext.required_files['interactives'] self.required_images = ext.required_files['images'] + self.text_pattern = re.compile(ext.processor_info[self.processor]['pattern']) + + def test(self, parent, block): + ''' Tests a block to see if the run method should be applied. + + Args: + parent: The parent node of the element tree that children + will reside in. + block: The block to be tested. + + Returns: + True if there are any start or end tags within the block. + ''' + return self.text_pattern.search(block) is None and self.pattern.search(block) is not None def custom_parsing(self, argument_values): '''Determines the file path to use for an interactive's thumbnail. @@ -29,13 +43,13 @@ def custom_parsing(self, argument_values): ''' extra_args = {} interactive_type = argument_values['type'] - name = argument_values['name'] + slug = argument_values['slug'] # add to list of interactives - self.required_interactives.add(name) + self.required_interactives.add(slug) if interactive_type == 'in-page': - self.scripts.add('interactive/{}/scripts.html'.format(name)) + self.scripts.add('interactive/{}/scripts.html'.format(slug)) elif interactive_type == 'whole-page': argument = 'thumbnail' thumbnail_file_path = argument_values.get(argument, None) @@ -43,7 +57,7 @@ def custom_parsing(self, argument_values): if thumbnail_file_path is not None: del argument_values[argument] else: - thumbnail_file_path = 'interactives/{}/img/thumbnail.png'.format(name) + thumbnail_file_path = 'interactives/{}/img/thumbnail.png'.format(slug) external_path_match = re.search(r'^http', thumbnail_file_path) if external_path_match is None: # internal image diff --git a/verto/processors/utils.py b/verto/processors/utils.py index dc948999..347c0341 100644 --- a/verto/processors/utils.py +++ b/verto/processors/utils.py @@ -28,9 +28,9 @@ def parse_argument(argument_key, arguments, default=None): if result: argument_value = result.group(2).replace(r'\"', r'"') + return argument_value else: - argument_value = default - return argument_value + return default def parse_flag(argument_key, arguments, default=False): @@ -44,12 +44,11 @@ def parse_flag(argument_key, arguments, default=False): Returns: True if argument is found, otherwise None. ''' - result = re.search(r'(^|\s+){}($|\s)'.format(argument_key), arguments) + result = re.search(r'(^|\s+){}(.+?".*?")'.format(argument_key), arguments) if result: - argument_value = True + return True else: - argument_value = default - return argument_value + return default def parse_arguments(processor, inputs, arguments): @@ -69,12 +68,11 @@ def parse_arguments(processor, inputs, arguments): argument_values = defaultdict(None) for argument, argument_info in arguments.items(): is_required = argument_info['required'] - is_arg = parse_argument(argument, inputs, None) is not None - is_flag = parse_flag(argument, inputs) + is_arg = parse_argument(argument, inputs, None) is not None # True if in line - if is_required and not (is_arg or is_flag): + if is_required and not is_arg: # required argument and not in line raise ArgumentMissingError(processor, argument, '{} is a required argument.'.format(argument)) - elif not is_required and (is_arg or is_flag): + elif not is_required and is_arg: dependencies = argument_info.get('dependencies', []) for other_argument in dependencies: if (parse_argument(other_argument, inputs, None) is None and @@ -82,9 +80,7 @@ def parse_arguments(processor, inputs, arguments): message = '{} is a required argument because {} exists.'.format(other_argument, argument) raise ArgumentMissingError(processor, argument, message) - if is_flag: - argument_values[argument] = True - elif is_arg: + if is_arg: value = parse_argument(argument, inputs, None) if value and value.strip() == '': message = '{} cannot be blank.'.format(argument) diff --git a/verto/tests/BoxedTextTest.py b/verto/tests/BoxedTextTest.py index b59a16ca..258afebc 100644 --- a/verto/tests/BoxedTextTest.py +++ b/verto/tests/BoxedTextTest.py @@ -3,6 +3,7 @@ from verto.VertoExtension import VertoExtension from verto.processors.GenericContainerBlockProcessor import GenericContainerBlockProcessor +from verto.errors.ArgumentMissingError import ArgumentMissingError from verto.tests.ProcessorTest import ProcessorTest @@ -24,8 +25,7 @@ def __init__(self, *args, **kwargs): self.block_processor = GenericContainerBlockProcessor(self.processor_name, self.ext, Mock()) def test_no_boxed_text(self): - '''Tests that the text containing the processor name is - not matched. + '''Tests that the text containing the processor name is not matched. ''' test_string = self.read_test_file(self.processor_name, 'no_boxed_text.md') blocks = self.to_blocks(test_string) @@ -37,8 +37,7 @@ def test_no_boxed_text(self): self.assertEqual(expected_string, converted_test_string) def test_single_boxed_text(self): - '''Tests that the most generic case of a single match is found - with generic content contained within. + '''Tests that the most generic case of a single match is found with generic content contained within. ''' test_string = self.read_test_file(self.processor_name, 'single_boxed_text.md') blocks = self.to_blocks(test_string) @@ -49,6 +48,18 @@ def test_single_boxed_text(self): expected_string = self.read_test_file(self.processor_name, 'single_boxed_text_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) + def test_boxed_text_type(self): + '''Tests that, when specified, type is added to class + ''' + test_string = self.read_test_file(self.processor_name, 'boxed_text_type.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'boxed_text_type_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + def test_indented_boxed_text(self): '''Tests that the indented argument works as appropriate. ''' @@ -61,9 +72,20 @@ def test_indented_boxed_text(self): expected_string = self.read_test_file(self.processor_name, 'indented_boxed_text_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) + def test_indented_and_type_boxed_text(self): + '''Tests that the indented and type arguments work as expected when both used. + ''' + test_string = self.read_test_file(self.processor_name, 'indented_type_boxed_text.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'indented_type_boxed_text_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + def test_multiple_boxed_text(self): - '''Tests that multiple different matches (that are not - within others) are matched and processed correctly. + '''Tests that multiple different matches (that are not within others) are matched and processed correctly. ''' test_string = self.read_test_file(self.processor_name, 'multiple_boxed_text.md') blocks = self.to_blocks(test_string) @@ -75,9 +97,7 @@ def test_multiple_boxed_text(self): self.assertEqual(expected_string, converted_test_string) def test_recursive_boxed_text(self): - '''Tests that multiple different matches (that are - contained as content of eachother) are matched and - processed correctly. + '''Tests that multiple different matches (that are contained as content of eachother) are matched and processed correctly. ''' test_string = self.read_test_file(self.processor_name, 'recursive_boxed_text.md') blocks = self.to_blocks(test_string) @@ -88,13 +108,133 @@ def test_recursive_boxed_text(self): expected_string = self.read_test_file(self.processor_name, 'recursive_boxed_text_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) - #~ + def test_indented_value_no(self): + '''Tests that indented class not added if indent value is "no". + ''' + test_string = self.read_test_file(self.processor_name, 'indented_value_no.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'indented_value_no_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_indented_required(self): + '''Tests to ensure that boxed text tag is rendered correctly when indented argument is required. + ''' + custom_argument_rules = { + "boxed-text": { + "indented": True + } + } + + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'indented_required.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [GenericContainerBlockProcessor(self.processor_name, self.ext, Mock()).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'indented_required_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_type_required(self): + '''Tests to ensure that boxed text tag is rendered correctly when type argument is required. + ''' + custom_argument_rules = { + "boxed-text": { + "type": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'type_required.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [GenericContainerBlockProcessor(self.processor_name, self.ext, Mock()).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'type_required_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_indented_and_type_required(self): + '''Tests to ensure that boxed text tag is rendered correctly when both indented and type arguments are required. + ''' + custom_argument_rules = { + "boxed-text": { + "indented": True, + "type": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'indented_and_type_required.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [GenericContainerBlockProcessor(self.processor_name, self.ext, Mock()).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'indented_and_type_required_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_indented_required_not_provided(self): + '''Tests to ensure that error is raised when indented argument is required and not given. + ''' + custom_argument_rules = { + "boxed-text": { + "indented": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'indented_required_not_provided.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [GenericContainerBlockProcessor(self.processor_name, self.ext, Mock()).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) + + def test_custom_arguments_indented_and_type_required_type_not_provided(self): + '''Tests to ensure that error is raised when indented and type arguments are required and type is not given. + ''' + custom_argument_rules = { + "boxed-text": { + "indented": True, + "type": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'indented_and_type_required_type_not_provided.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [GenericContainerBlockProcessor(self.processor_name, self.ext, Mock()).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) + + # ~ # Doc Tests - #~ + # ~ def test_doc_example_basic(self): - '''Tests that the most generic case of a single match is found - with generic content contained within. + '''Tests that the most generic case of a single match is found with generic content contained within. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_basic_usage.md') blocks = self.to_blocks(test_string) @@ -106,8 +246,7 @@ def test_doc_example_basic(self): self.assertEqual(expected_string, converted_test_string) def test_doc_example_override_html(self): - '''Tests and shows example of overriding the html of the - processor. + '''Tests and shows example of overriding the html of the processor. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_override_html.md') blocks = self.to_blocks(test_string) diff --git a/verto/tests/ButtonLinkTest.py b/verto/tests/ButtonLinkTest.py index 0cf0af8f..dd465541 100644 --- a/verto/tests/ButtonLinkTest.py +++ b/verto/tests/ButtonLinkTest.py @@ -3,6 +3,7 @@ from verto.VertoExtension import VertoExtension from verto.processors.GenericTagBlockProcessor import GenericTagBlockProcessor +from verto.errors.ArgumentMissingError import ArgumentMissingError from verto.tests.ProcessorTest import ProcessorTest @@ -13,8 +14,7 @@ class ButtonLinkTest(ProcessorTest): ''' def __init__(self, *args, **kwargs): - '''Sets up a generic tag to test that the matches are - occuring appropriately. + '''Sets up a generic tag to test that the matches are occuring appropriately. ''' ProcessorTest.__init__(self, *args, **kwargs) self.processor_name = 'button-link' @@ -24,8 +24,7 @@ def __init__(self, *args, **kwargs): self.block_processor = GenericTagBlockProcessor(self.processor_name, self.ext, Mock()) def test_no_button(self): - '''Tests that the text containing the processor name is - not matched. + '''Tests that the text containing the processor name is not matched. ''' test_string = self.read_test_file(self.processor_name, 'no_button.md') blocks = self.to_blocks(test_string) @@ -36,8 +35,7 @@ def test_no_button(self): self.assertEqual(expected_string, converted_test_string) def test_contains_button(self): - '''Tests that the most generic case of a single match is found - with generic content contained within. + '''Tests that the most generic case of a single match is found with generic content contained within. ''' test_string = self.read_test_file(self.processor_name, 'contains_button.md') blocks = self.to_blocks(test_string) @@ -66,7 +64,7 @@ def test_contains_multiple_buttons(self): test_string = self.read_test_file(self.processor_name, 'contains_multiple_buttons.md') blocks = self.to_blocks(test_string) - self.assertListEqual([False, True, False, False, True, False, False, True, False, False , True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([False, True, False, False, True, False, False, True, False, False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) @@ -74,8 +72,7 @@ def test_contains_multiple_buttons(self): self.assertEqual(expected_string, converted_test_string) def test_contains_file_link_button(self): - '''Tests that the file argument works are expected, - internally linking to a file. + '''Tests that the file argument works are expected, internally linking to a file. ''' test_string = self.read_test_file(self.processor_name, 'contains_file_link_button.md') blocks = self.to_blocks(test_string) @@ -87,9 +84,119 @@ def test_contains_file_link_button(self): expected_string = self.read_test_file(self.processor_name, 'contains_file_link_button_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) - #~ +# link text file + def test_custom_arguments_link_false(self): + '''Tests to ensure that button link tag is rendered correctly when link argument is required. + ''' + custom_argument_rules = { + "button-link": { + "link": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'link_false.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'link_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_text_false(self): + '''Tests to ensure that button link tag is rendered correctly when text argument is false. + ''' + custom_argument_rules = { + "button-link": { + "text": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'text_false.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'text_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_file_true(self): + '''Tests to ensure that button link tag is rendered correctly when file argument is true. + ''' + custom_argument_rules = { + "button-link": { + "file": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'file_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'file_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_text_false_file_true(self): + '''Tests to ensure that button link tag is rendered correctly when text argument is false and file argument is true. + ''' + custom_argument_rules = { + "button-link": { + "file": True, + "text": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'text_false_file_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'text_false_file_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_file_true_not_provided(self): + '''Tests to ensure that error is raised when file argument is required and not given. + ''' + custom_argument_rules = { + "button-link": { + "file": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'file_true_not_provided.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) + + # ~ # Doc Tests - #~ + # ~ def test_doc_example_basic(self): '''Tests that the most generic case of a single match is found diff --git a/verto/tests/ConditionalTest.py b/verto/tests/ConditionalTest.py index 36d491ea..598474d5 100644 --- a/verto/tests/ConditionalTest.py +++ b/verto/tests/ConditionalTest.py @@ -10,6 +10,11 @@ class ConditionalTest(ProcessorTest): '''Conditionals expect complex output and need to match many possible conditions. + + Note: + - No tests for custom argument rules because it doesn't + make sense to require one or more of these arguments + to be given. ''' def __init__(self, *args, **kwargs): diff --git a/verto/tests/ConfigurationTest.py b/verto/tests/ConfigurationTest.py index 10bf8e72..e5b7639a 100644 --- a/verto/tests/ConfigurationTest.py +++ b/verto/tests/ConfigurationTest.py @@ -1,10 +1,13 @@ -import unittest +import markdown + from verto.Verto import Verto, VertoResult +from verto.VertoExtension import VertoExtension from verto.processors.ScratchTreeprocessor import ScratchImageMetaData from verto.utils.HeadingNode import HeadingNode -import jinja2 from verto.tests.BaseTest import BaseTest -from collections import defaultdict +from verto.errors.ArgumentMissingError import ArgumentMissingError +from verto.errors.CustomArgumentRulesError import CustomArgumentRulesError + class ConfigurationTest(BaseTest): '''Test configuration methods of Verto @@ -25,108 +28,109 @@ def __init__(self, *args, **kwargs): self.test_name = 'configuration' self.maxDiff = None self.custom_templates = { - 'image': '', - 'boxed-text': '
{% autoescape false %}{{ text }}{% endautoescape %}
' + 'image': '\'test\'', + 'boxed-text': '
{% autoescape false %}{{ text }}{% endautoescape %}
', + 'video-youtube': 'https://www.youtube.com/embed/{{ identifier }}?rel=0' } def test_multiple_calls(self): '''Checks all fields of VertoResult are correct for multiple Verto calls. ''' - test_cases = [ - ('all_processors.md', - VertoResult( - html_string=self.read_test_file(self.test_name, 'all_processors_expected.html', strip=True), - title='Example Title', - required_files={ - 'interactives': { - 'binary-cards' - }, - 'images': set(), - 'page_scripts': set(), - 'scratch_images': { - ScratchImageMetaData( - hash='a0f8fcad796864abfacac8bda6e0719813833fd1fca348700abbd040557c1576', - text='when flag clicked\nclear\nforever\npen down\nif < and > then\nswitch costume to [button v]\nelse\nadd (x position) to [list v]\nend\nmove (foo) steps\nturn ccw (9) degrees' - ), - } + test_cases = [( + 'all_processors.md', + VertoResult( + html_string=self.read_test_file(self.test_name, 'all_processors_expected.html', strip=True), + title='Example Title', + required_files={ + 'interactives': { + 'binary-cards' }, - heading_tree=(HeadingNode( - title='Example Title', - title_slug='example-title', - level=1, - children=(), - ), - HeadingNode( - title='Example Title 2', - title_slug='example-title-2', - level=1, - children=() + 'images': set(), + 'page_scripts': set(), + 'scratch_images': { + ScratchImageMetaData( + hash='a0f8fcad796864abfacac8bda6e0719813833fd1fca348700abbd040557c1576', + text='when flag clicked\nclear\nforever\npen down\nif < and > then\nswitch costume to [button v]\nelse\nadd (x position) to [list v]\nend\nmove (foo) steps\nturn ccw (9) degrees' ), - ), - required_glossary_terms={ - 'algorithm': [] } - ) - ), - ('some_processors.md', - VertoResult( - html_string=self.read_test_file(self.test_name, 'some_processors_expected.html', strip=True), - title='Another Example Title', - required_files={ - 'interactives': set(), - 'images': {'totally-legit-image.png'}, - 'page_scripts': set(), - 'scratch_images': set() - }, - heading_tree=(HeadingNode( - title='Another Example Title', - title_slug='another-example-title', - level=1, - children=(HeadingNode( - title='This is an H2', - title_slug='this-is-an-h2', - level=2, - children=() - ),), - ),), - required_glossary_terms={ - 'chomsky-hierarchy': - [('Formal languages', 'glossary-chomsky-hierarchy')] - } - ) - ), - ('some_processors_2.md', - VertoResult( - html_string=self.read_test_file(self.test_name, 'some_processors_2_expected.html', strip=True), - title='Another Example Title', - required_files={ - 'interactives': set(), - 'images': { - 'totally-legit-image.png', - 'finite-state-automata-no-trap-example.png', - 'finite-state-automata-trap-added-example.png', - 'finite-state-automata-trap-added-extreme-example.png', - }, - 'page_scripts': set(), - 'scratch_images': set() - }, - heading_tree=(HeadingNode( - title='Another Example Title', - title_slug='another-example-title', + }, + heading_tree=( + HeadingNode( + title='Example Title', + title_slug='example-title', level=1, children=(), + ), + HeadingNode( + title='Example Title 2', + title_slug='example-title-2', + level=1, + children=() + ), + ), + required_glossary_terms={ + 'algorithm': [] + } + ) + ), ( + 'some_processors.md', + VertoResult( + html_string=self.read_test_file(self.test_name, 'some_processors_expected.html', strip=True), + title='Another Example Title', + required_files={ + 'interactives': set(), + 'images': {'totally-legit-image.png'}, + 'page_scripts': set(), + 'scratch_images': set() + }, + heading_tree=(HeadingNode( + title='Another Example Title', + title_slug='another-example-title', + level=1, + children=(HeadingNode( + title='This is an H2', + title_slug='this-is-an-h2', + level=2, + children=() ),), - required_glossary_terms={ - 'hello': [], - 'algorithm': - [('computer program', 'glossary-algorithm'), - ('algorithm cost', 'glossary-algorithm-2'), - ('searching algorithms', 'glossary-algorithm-3'), - ('sorting algorithms', 'glossary-algorithm-4')] - } - ) + ),), + required_glossary_terms={ + 'chomsky-hierarchy': + [('Formal languages', 'glossary-chomsky-hierarchy')] + } ) - ] + ), ( + 'some_processors_2.md', + VertoResult( + html_string=self.read_test_file(self.test_name, 'some_processors_2_expected.html', strip=True), + title='Another Example Title', + required_files={ + 'interactives': set(), + 'images': { + 'totally-legit-image.png', + 'finite-state-automata-no-trap-example.png', + 'finite-state-automata-trap-added-example.png', + 'finite-state-automata-trap-added-extreme-example.png', + }, + 'page_scripts': set(), + 'scratch_images': set() + }, + heading_tree=(HeadingNode( + title='Another Example Title', + title_slug='another-example-title', + level=1, + children=(), + ),), + required_glossary_terms={ + 'hello': [], + 'algorithm': + [('computer program', 'glossary-algorithm'), + ('algorithm cost', 'glossary-algorithm-2'), + ('searching algorithms', 'glossary-algorithm-3'), + ('sorting algorithms', 'glossary-algorithm-4')] + } + ) + )] verto = Verto() for filename, expected_result in test_cases: @@ -145,71 +149,72 @@ def test_multiple_calls_without_clearing(self): filename = 'all_processors.md' other_filename = 'otherfile.md' expected_result = VertoResult( - html_string=self.read_test_file(self.test_name, 'all_processors_expected.html', strip=True), - title='Example Title', - required_files={ - 'interactives': { - 'binary-cards' - }, - 'images': set(), - 'page_scripts': set(), - 'scratch_images': { - ScratchImageMetaData( - hash='a0f8fcad796864abfacac8bda6e0719813833fd1fca348700abbd040557c1576', - text='when flag clicked\nclear\nforever\npen down\nif < and > then\nswitch costume to [button v]\nelse\nadd (x position) to [list v]\nend\nmove (foo) steps\nturn ccw (9) degrees' - ), - } - }, - heading_tree=(HeadingNode( - title='Example Title', - title_slug='example-title', - level=1, - children=(), - ), - HeadingNode( - title='Example Title 2', - title_slug='example-title-2', - level=1, - children=() - ), - ), - required_glossary_terms={ - 'algorithm': [] - } - ) + html_string=self.read_test_file(self.test_name, 'all_processors_expected.html', strip=True), + title='Example Title', + required_files={ + 'interactives': { + 'binary-cards' + }, + 'images': set(), + 'page_scripts': set(), + 'scratch_images': { + ScratchImageMetaData( + hash='a0f8fcad796864abfacac8bda6e0719813833fd1fca348700abbd040557c1576', + text='when flag clicked\nclear\nforever\npen down\nif < and > then\nswitch costume to [button v]\nelse\nadd (x position) to [list v]\nend\nmove (foo) steps\nturn ccw (9) degrees' + ), + } + }, + heading_tree=( + HeadingNode( + title='Example Title', + title_slug='example-title', + level=1, + children=(), + ), + HeadingNode( + title='Example Title 2', + title_slug='example-title-2', + level=1, + children=() + ), + ), + required_glossary_terms={ + 'algorithm': [] + } + ) expected_otherfile_result = VertoResult( - html_string=self.read_test_file(self.test_name, 'otherfile_expected.html', strip=True), - title='Example Title', - required_files={ - 'interactives': { - 'binary-cards' - }, - 'images': { - 'pixel-diamond.png' - }, - 'page_scripts': set(), - 'scratch_images': { - ScratchImageMetaData( - hash='a0f8fcad796864abfacac8bda6e0719813833fd1fca348700abbd040557c1576', - text='when flag clicked\nclear\nforever\npen down\nif < and > then\nswitch costume to [button v]\nelse\nadd (x position) to [list v]\nend\nmove (foo) steps\nturn ccw (9) degrees' - ), - ScratchImageMetaData( - hash='b78bff524e54a18116e1e898a93e360827f874a8b0b508e1edc47d21516495ad', - text='never\ngoing\nto\ngive\nyou\nup' - ), - } - }, - heading_tree=(HeadingNode( - title='Example Title', - title_slug='example-title-3', - level=1, - children=(), - ), - ), - required_glossary_terms={ - 'algorithm': [] - } - ) + html_string=self.read_test_file(self.test_name, 'otherfile_expected.html', strip=True), + title='Example Title', + required_files={ + 'interactives': { + 'binary-cards' + }, + 'images': { + 'pixel-diamond.png' + }, + 'page_scripts': set(), + 'scratch_images': { + ScratchImageMetaData( + hash='a0f8fcad796864abfacac8bda6e0719813833fd1fca348700abbd040557c1576', + text='when flag clicked\nclear\nforever\npen down\nif < and > then\nswitch costume to [button v]\nelse\nadd (x position) to [list v]\nend\nmove (foo) steps\nturn ccw (9) degrees' + ), + ScratchImageMetaData( + hash='b78bff524e54a18116e1e898a93e360827f874a8b0b508e1edc47d21516495ad', + text='never\ngoing\nto\ngive\nyou\nup' + ), + } + }, + heading_tree=(HeadingNode( + title='Example Title', + title_slug='example-title-3', + level=1, + children=(), + ), + ), + required_glossary_terms={ + 'algorithm': [] + } + ) verto = Verto() # First file @@ -360,3 +365,79 @@ def test_multiline_custom_templates(self): converted_test_string = verto.convert(test_string).html_string expected_string = self.read_test_file(self.test_name, 'multiline_templates_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_rules_on_creation(self): + '''Checks if tag arguments are updated. + ''' + custom_argument_rules = { + "image-tag": { + "alt": False + } + } + verto = Verto(custom_argument_rules=custom_argument_rules) + self.assertEqual(verto.verto_extension.custom_argument_rules, dict(custom_argument_rules)) + + def test_custom_argument_rules_for_multiple_tags(self): + '''Checks that md file is correctly parsed when multiple tags have custom argument rules. + ''' + custom_argument_rules = { + "image-tag": { + "alt": False + }, + "panel": { + "subtitle": True + } + } + verto = Verto(custom_argument_rules=custom_argument_rules) + self.assertEqual(verto.verto_extension.custom_argument_rules, dict(custom_argument_rules)) + test_string = self.read_test_file(self.test_name, 'all_processors.md') + converted_test_string = verto.convert(test_string).html_string + expected_string = self.read_test_file(self.test_name, 'all_processors_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_argument_rules_for_multiple_tags_error(self): + '''Checks that error is raised when a tag's custom argument rules are not followed. + ''' + custom_argument_rules = { + "panel": { + "subtitle": True + }, + "image-tag": { + "alt": False + } + } + processors = {'image-tag', 'panel', 'comment'} + verto = VertoExtension(processors=processors, custom_argument_rules=custom_argument_rules) + + test_string = self.read_test_file(self.test_name, 'custom_argument_rules_multiple_tags_error.md') + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto]), test_string) + + def test_custom_argument_rules_incorrect_processor_error(self): + '''Checks that error is raised when a processor given in custom argument rules does not exist. + ''' + custom_argument_rules = { + "panel": { + "totallyrealargument": True + }, + "image-tag": { + "alt": False + } + } + processors = {'image-tag', 'panel', 'comment'} + + self.assertRaises(CustomArgumentRulesError, lambda: VertoExtension(processors=processors, custom_argument_rules=custom_argument_rules)) + + def test_custom_argument_rules_incorrect_processor_argument_error(self): + '''Checks that error is raised when a processor given in custom argument rules does not exist. + ''' + custom_argument_rules = { + "panl": { + "subtitle": True + }, + "image-tag": { + "alt": False + } + } + processors = {'image-tag', 'panel', 'comment'} + + self.assertRaises(CustomArgumentRulesError, lambda: VertoExtension(processors=processors, custom_argument_rules=custom_argument_rules)) diff --git a/verto/tests/FrameTest.py b/verto/tests/FrameTest.py index 79fefb0c..68aa2839 100644 --- a/verto/tests/FrameTest.py +++ b/verto/tests/FrameTest.py @@ -7,6 +7,7 @@ from verto.errors.ArgumentDefinitionError import ArgumentDefinitionError from verto.tests.ProcessorTest import ProcessorTest + class FrameTest(ProcessorTest): '''The iframe processor inherits from the generic tag procesor. The tests contained here test that arguments and the output @@ -47,6 +48,28 @@ def test_example_single_quote_argument_error(self): with self.assertRaises(ArgumentDefinitionError): converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + def test_custom_argument_rules_link_false(self): + '''Tests to ensure that iframe tag is rendered correctly when link argument is not required. + ''' + custom_argument_rules = { + "iframe": { + "link": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'link_false.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'link_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + #~ # Doc Tests #~ diff --git a/verto/tests/GlossaryLinkTest.py b/verto/tests/GlossaryLinkTest.py index c1a92672..0e1100a9 100644 --- a/verto/tests/GlossaryLinkTest.py +++ b/verto/tests/GlossaryLinkTest.py @@ -1,8 +1,10 @@ import markdown import re from unittest.mock import Mock + from verto.VertoExtension import VertoExtension from verto.processors.GlossaryLinkPattern import GlossaryLinkPattern +from verto.errors.ArgumentMissingError import ArgumentMissingError from verto.tests.ProcessorTest import ProcessorTest @@ -22,8 +24,7 @@ def __init__(self, *args, **kwargs): self.ext.jinja_templates = {self.processor_name: ProcessorTest.loadJinjaTemplate(self, self.processor_name)} def test_single_word_term(self): - '''Tests that a single glossary link functions - as expected. + '''Tests that a single glossary link functions as expected. ''' test_string = self.read_test_file(self.processor_name, 'single_word_term.md') @@ -59,8 +60,7 @@ def test_multiple_word_term(self): self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_reference_text_given(self): - '''Tests that the reference argument is processed - and that details are stored in the final result. + '''Tests that the reference argument is processed and that details are stored in the final result. ''' test_string = self.read_test_file(self.processor_name, 'reference_text_given.md') @@ -79,8 +79,7 @@ def test_reference_text_given(self): self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_leading_inline_text(self): - '''Tests that glossary links are matched and processed - even when there is text before the tag. + '''Tests that glossary links are matched and processed even when there is text before the tag. ''' test_string = self.read_test_file(self.processor_name, 'leading_inline_text.md') @@ -98,8 +97,7 @@ def test_leading_inline_text(self): self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_trailing_inline_text(self): - '''Tests that glossary links are matched and processed - even when there is text after the tag. + '''Tests that glossary links are matched and processed even when there is text after the tag. ''' test_string = self.read_test_file(self.processor_name, 'trailing_inline_text.md') @@ -117,8 +115,7 @@ def test_trailing_inline_text(self): self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_leading_and_trailing_inline_text(self): - '''Tests that glossary links are matched and processed - even when there is text before and after the tag. + '''Tests that glossary links are matched and processed even when there is text before and after the tag. ''' test_string = self.read_test_file(self.processor_name, 'leading_and_trailing_inline_text.md') @@ -136,9 +133,7 @@ def test_leading_and_trailing_inline_text(self): self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_multiple_terms(self): - '''Tests that multiple glossary tags are matched and - that tags with the reference argument store information - for the final result. + '''Tests that multiple glossary tags are matched and that tags with the reference argument store information for the final result. ''' test_string = self.read_test_file(self.processor_name, 'multiple_terms.md') @@ -159,9 +154,7 @@ def test_multiple_terms(self): self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_multiple_reference_text(self): - '''Tests that when the reference argument is used in - multiple tags that all references are stored for the - final verto result. + '''Tests that when the reference argument is used in multiple tags that all references are stored for the final verto result. ''' test_string = self.read_test_file(self.processor_name, 'multiple_reference_text.md') @@ -183,9 +176,47 @@ def test_multiple_reference_text(self): } self.assertDictEqual(expected_glossary_terms, glossary_terms) - #~ + def test_custom_arguments_reference_text_true(self): + '''Tests that glossary tag is rendered correctly when reference text is required. + ''' + test_string = self.read_test_file(self.processor_name, 'reference_text_true.md') + + processor = GlossaryLinkPattern(self.ext, self.md.parser) + self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'reference_text_true_expected.html', strip=True).strip() + self.assertEqual(expected_string, converted_test_string) + + glossary_terms = self.verto_extension.glossary_terms + expected_glossary_terms = { + 'chomsky-hierarchy': + [('Formal languages', 'glossary-chomsky-hierarchy')] + } + self.assertDictEqual(expected_glossary_terms, glossary_terms) + + def test_custom_arguments_reference_text_true_not_provided(self): + '''Tests to ensure that correct error is raised when reference text is required and not provided. + ''' + custom_argument_rules = { + "glossary-link": { + "reference-text": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'reference_text_true_not_provided.md') + processor = GlossaryLinkPattern(self.ext, self.md.parser) + self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) + + # ~ # Doc Tests - #~ + # ~ def test_doc_example_basic(self): '''A basic example of common useage. diff --git a/verto/tests/HeadingTest.py b/verto/tests/HeadingTest.py index a77bcbbd..7bfcb5f6 100644 --- a/verto/tests/HeadingTest.py +++ b/verto/tests/HeadingTest.py @@ -1,4 +1,3 @@ -import unittest import markdown from unittest.mock import Mock @@ -7,6 +6,7 @@ from verto.tests.ProcessorTest import ProcessorTest from verto.utils.HeadingNode import HeadingNode + class HeadingTest(ProcessorTest): '''The heading processor is a unique processor that replaces the functionality of the default markdown (#) heading. We allow for @@ -157,9 +157,9 @@ def test_multiple_roots_zero_level(self): ) self.assertTupleEqual(tree, expected_tree) - #~ + # ~ # Doc Tests - #~ + # ~ def test_doc_example_basic(self): '''An example of simplistic usage. diff --git a/verto/tests/ImageContainerTest.py b/verto/tests/ImageContainerTest.py index f6db09d0..e3e3cecc 100644 --- a/verto/tests/ImageContainerTest.py +++ b/verto/tests/ImageContainerTest.py @@ -6,8 +6,8 @@ from verto.processors.ImageContainerBlockProcessor import ImageContainerBlockProcessor from verto.errors.ImageMissingCaptionError import ImageMissingCaptionError from verto.errors.ImageCaptionContainsImageError import ImageCaptionContainsImageError -from verto.errors.ArgumentMissingError import ArgumentMissingError from verto.errors.ArgumentValueError import ArgumentValueError +from verto.errors.ArgumentMissingError import ArgumentMissingError from verto.errors.TagNotMatchedError import TagNotMatchedError from verto.tests.ProcessorTest import ProcessorTest @@ -135,6 +135,16 @@ def test_caption_true_numbered_list_missing_end_tag(self): self.assertRaises(TagNotMatchedError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) + def test_missing_alt_parameter(self): + '''Tests that missing alt argument produces correct error. + ''' + test_string = self.read_test_file(self.processor_name, 'missing_alt_parameter.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [ImageContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) + def test_image_in_image_tag(self): '''Test that ImageCaptionContainsImageError is raised when the first line in an image container block is another image container block. ''' @@ -438,9 +448,114 @@ def test_image_width_value_external_image(self): expected_images = set() self.assertSetEqual(expected_images, images) - #~ + def test_custom_arguments_alt_false(self): + '''Tests to ensure that image tag is rendered correctly when alt tag is not required and expected images are updated. + ''' + custom_argument_rules = { + "image-container": { + "alt": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'alt_false.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False, True, False], [ImageContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'alt_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'cats.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_hover_true(self): + '''Tests to ensure that image tag is rendered correctly when hover argument is required and expected images are updated. + ''' + custom_argument_rules = { + "image-container": { + "hover-text": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'hover_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [ImageContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'hover_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'computer-studying-turing-test.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_alt_false_source_true(self): + '''Tests to ensure that image tag is rendered correctly when alt argument is not required and source argument is true and expected images are updated. + ''' + custom_argument_rules = { + "image-container": { + "alt": False, + "source": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'alt_false_source_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False, True, False], [ImageContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'alt_false_source_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'cats.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_hover_true_not_provided(self): + '''Tests to ensure that correct error is raised when hover text is required and not provided. + ''' + custom_argument_rules = { + "image-container": { + "hover-text": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'hover_true_not_provided.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [ImageContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) + + # ~ # Doc Tests - #~ + # ~ def test_doc_example_basic(self): '''Basic example of common usage. diff --git a/verto/tests/ImageInlineTest.py b/verto/tests/ImageInlineTest.py index cb6ba0b5..0a2a7591 100644 --- a/verto/tests/ImageInlineTest.py +++ b/verto/tests/ImageInlineTest.py @@ -2,10 +2,13 @@ import re from unittest.mock import Mock from collections import defaultdict + from verto.VertoExtension import VertoExtension from verto.processors.ImageInlinePattern import ImageInlinePattern +from verto.errors.ArgumentMissingError import ArgumentMissingError from verto.tests.ProcessorTest import ProcessorTest + class ImageInlineTest(ProcessorTest): '''Tests to check the 'image-inline' pattern works as intended.''' @@ -38,7 +41,6 @@ def test_basic_usage(self): } self.assertSetEqual(expected_images, images) - def test_doc_example_override_html(self): '''Basic example showing how to override the html-template.''' test_string = self.read_test_file(self.processor_name, 'doc_example_override_html.md') @@ -57,9 +59,9 @@ def test_doc_example_override_html(self): expected_images = set() self.assertSetEqual(expected_images, images) - #~ + # ~ # Image locations tests - #~ + # ~ def test_internal_image(self): '''Test to ensure that an internally reference image produces @@ -119,24 +121,18 @@ def test_multiple_internal_images(self): } self.assertSetEqual(expected_images, images) - #~ + # ~ # Argument tests - #~ + # ~ - def test_argument_alt(self): - '''Test that the alt argument is correctly rendered.''' - test_string = self.read_test_file(self.processor_name, 'argument_alt.md') + def test_missing_argument_alt(self): + '''Test that ArgumentMissingError is thrown when alt argument is missing''' + test_string = self.read_test_file(self.processor_name, 'missing_argument_alt.md') processor = ImageInlinePattern(self.ext, self.md.parser) self.assertIsNotNone(re.search(processor.compiled_re, test_string)) - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) - expected_string = self.read_test_file(self.processor_name, 'argument_alt_expected.html', strip=True).strip() - self.assertEqual(expected_string, converted_test_string) - - images = self.verto_extension.required_files['images'] - expected_images = set() - self.assertSetEqual(expected_images, images) + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) def test_argument_caption(self): '''Test that the caption argument is correctly rendered.''' @@ -202,13 +198,17 @@ def test_image_width_value(self): '''Test image rendered correctly with width value. ''' test_string = self.read_test_file(self.processor_name, 'file_width_value.md') + processor = ImageInlinePattern(self.ext, self.md.parser) self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + html_template = self.read_test_file(self.processor_name, 'file_width_value_html_template.html', strip=True) verto_extension = VertoExtension([self.processor_name], html_templates={self.processor_name: html_template}) + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_width_value_expected.html', strip=True).strip() self.assertEqual(expected_string, converted_test_string) + images = verto_extension.required_files['images'] expected_images = {'path/to/image@500px.png'} self.assertSetEqual(expected_images, images) @@ -217,13 +217,17 @@ def test_image_width_value_no_units(self): '''Test image rendered correctly with width value with no units. ''' test_string = self.read_test_file(self.processor_name, 'file_width_value_no_units.md') + processor = ImageInlinePattern(self.ext, self.md.parser) self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + html_template = self.read_test_file(self.processor_name, 'file_width_value_no_units_html_template.html', strip=True) verto_extension = VertoExtension([self.processor_name], html_templates={self.processor_name: html_template}) + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_width_value_no_units_expected.html', strip=True).strip() self.assertEqual(expected_string, converted_test_string) + images = verto_extension.required_files['images'] expected_images = {'path/to/image@900.png'} self.assertSetEqual(expected_images, images) @@ -232,11 +236,14 @@ def test_image_invalid_width_value_1(self): '''Test image rendered correctly with width value. ''' test_string = self.read_test_file(self.processor_name, 'file_invalid_width_value_1.md') + processor = ImageInlinePattern(self.ext, self.md.parser) self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_invalid_width_value_1_expected.html', strip=True).strip() self.assertEqual(expected_string, converted_test_string) + images = self.verto_extension.required_files['images'] expected_images = {'path/to/image@.png'} self.assertSetEqual(expected_images, images) @@ -245,11 +252,14 @@ def test_image_invalid_width_value_2(self): '''Test image rendered correctly with width value. ''' test_string = self.read_test_file(self.processor_name, 'file_invalid_width_value_2.md') + processor = ImageInlinePattern(self.ext, self.md.parser) self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_invalid_width_value_2_expected.html', strip=True).strip() self.assertEqual(expected_string, converted_test_string) + images = self.verto_extension.required_files['images'] expected_images = {'path/to/image@em20.png'} self.assertSetEqual(expected_images, images) @@ -258,18 +268,21 @@ def test_image_width_value_external_image(self): '''Test image rendered correctly with width value. ''' test_string = self.read_test_file(self.processor_name, 'file_width_value_external_image.md') + processor = ImageInlinePattern(self.ext, self.md.parser) self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_width_value_external_image_expected.html', strip=True).strip() self.assertEqual(expected_string, converted_test_string) + images = self.verto_extension.required_files['images'] expected_images = set() self.assertSetEqual(expected_images, images) - #~ + # ~ # Embed test. - #~ + # ~ def test_numbered_list(self): '''Test that image-inline functions within a numbered list.''' @@ -303,3 +316,108 @@ def test_table_embed(self): 'img/example2.png' } self.assertSetEqual(expected_images, images) + + # ~ + # custom arguments tests. + # ~ + + def test_custom_arguments_alt_false(self): + '''Tests to ensure that image tag is rendered correctly when alt tag is not required and expected images are updated. + ''' + custom_argument_rules = { + "image-inline": { + "alt": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'alt_false.md') + processor = ImageInlinePattern(self.ext, self.md.parser) + self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'alt_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'img/example.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_hover_true(self): + '''Tests to ensure that image tag is rendered correctly when hover argument is required and expected images are updated. + ''' + custom_argument_rules = { + "image-inline": { + "hover-text": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'hover_true.md') + processor = ImageInlinePattern(self.ext, self.md.parser) + self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'hover_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'img/example.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_alt_false_source_true(self): + '''Tests to ensure that image tag is rendered correctly when alt argument is not required and source argument is required and expected images are updated. + ''' + custom_argument_rules = { + "image-inline": { + "alt": False, + "source": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'alt_false_source_true.md') + processor = ImageInlinePattern(self.ext, self.md.parser) + self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'alt_false_source_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'img/example.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_hover_true_not_provided(self): + '''Tests to ensure that correct error is raised when hover text is required and not provided. + ''' + custom_argument_rules = { + "image-inline": { + "hover-text": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'hover_true_not_provided.md') + processor = ImageInlinePattern(self.ext, self.md.parser) + self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) diff --git a/verto/tests/ImageTagTest.py b/verto/tests/ImageTagTest.py index 9c885cfb..ae01e45f 100644 --- a/verto/tests/ImageTagTest.py +++ b/verto/tests/ImageTagTest.py @@ -177,23 +177,15 @@ def test_contains_hover_text(self): } self.assertSetEqual(expected_images, images) - def test_contains_alt(self): - '''Tests that argument for alt produces expected output and expected images are updated. + def test_missing_alt_parameter(self): + '''Tests that missing alt argument produces correct error. ''' - test_string = self.read_test_file(self.processor_name, 'contains_alt.md') + test_string = self.read_test_file(self.processor_name, 'missing_alt_parameter.md') blocks = self.to_blocks(test_string) self.assertListEqual([True, False], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) - expected_string = self.read_test_file(self.processor_name, 'contains_alt_expected.html', strip=True) - self.assertEqual(expected_string, converted_test_string) - - images = self.verto_extension.required_files['images'] - expected_images = { - 'computer-studying-turing-test.png' - } - self.assertSetEqual(expected_images, images) + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) def test_contains_source(self): '''Tests that argument for source produces expected output and expected images are updated. @@ -308,12 +300,16 @@ def test_image_width_value(self): ''' test_string = self.read_test_file(self.processor_name, 'file_width_value.md') blocks = self.to_blocks(test_string) + self.assertListEqual([True], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + html_template = self.read_test_file(self.processor_name, 'file_width_value_html_template.html', strip=True) verto_extension = VertoExtension([self.processor_name], html_templates={self.tag_argument: html_template}) + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_width_value_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) + images = self.verto_extension.required_files['images'] expected_images = set() self.assertSetEqual(expected_images, images) @@ -323,12 +319,16 @@ def test_image_width_value_no_units(self): ''' test_string = self.read_test_file(self.processor_name, 'file_width_value_no_units.md') blocks = self.to_blocks(test_string) + self.assertListEqual([True], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + html_template = self.read_test_file(self.processor_name, 'file_width_value_no_units_html_template.html', strip=True) verto_extension = VertoExtension([self.processor_name], html_templates={self.tag_argument: html_template}) + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_width_value_no_units_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) + images = self.verto_extension.required_files['images'] expected_images = set() self.assertSetEqual(expected_images, images) @@ -338,12 +338,15 @@ def test_image_invalid_width_value_1(self): ''' test_string = self.read_test_file(self.processor_name, 'file_invalid_width_value_1.md') blocks = self.to_blocks(test_string) + self.assertListEqual([True], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + html_template = self.read_test_file(self.processor_name, 'file_invalid_width_value_1_html_template.html', strip=True) verto_extension = VertoExtension([self.processor_name], html_templates={self.tag_argument: html_template}) converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_invalid_width_value_1_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) + images = self.verto_extension.required_files['images'] expected_images = set() self.assertSetEqual(expected_images, images) @@ -353,12 +356,16 @@ def test_image_invalid_width_value_2(self): ''' test_string = self.read_test_file(self.processor_name, 'file_invalid_width_value_2.md') blocks = self.to_blocks(test_string) + self.assertListEqual([True], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + html_template = self.read_test_file(self.processor_name, 'file_invalid_width_value_2_html_template.html', strip=True) verto_extension = VertoExtension([self.processor_name], html_templates={self.tag_argument: html_template}) + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_invalid_width_value_2_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) + images = self.verto_extension.required_files['images'] expected_images = set() self.assertSetEqual(expected_images, images) @@ -368,19 +375,129 @@ def test_image_width_value_external_image(self): ''' test_string = self.read_test_file(self.processor_name, 'file_width_value_external_image.md') blocks = self.to_blocks(test_string) + self.assertListEqual([True], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + html_template = self.read_test_file(self.processor_name, 'file_width_value_external_image_html_template.html', strip=True) verto_extension = VertoExtension([self.processor_name], html_templates={self.tag_argument: html_template}) + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) expected_string = self.read_test_file(self.processor_name, 'file_width_value_external_image_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) + images = self.verto_extension.required_files['images'] expected_images = set() self.assertSetEqual(expected_images, images) - #~ + def test_custom_arguments_alt_false(self): + '''Tests to ensure that image tag is rendered correctly when alt tag is not required and expected images are updated. + ''' + custom_argument_rules = { + "image-tag": { + "alt": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'alt_false.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'alt_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'pixel-diamond.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_hover_true(self): + '''Tests to ensure that image tag is rendered correctly when hover argument is required and expected images are updated. + ''' + custom_argument_rules = { + "image-tag": { + "hover-text": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'hover_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'hover_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'computer-studying-turing-test.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_alt_false_source_true(self): + '''Tests to ensure that image tag is rendered correctly when alt argument is not required and source argument is required and expected images are updated. + ''' + custom_argument_rules = { + "image-tag": { + "alt": False, + "source": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'alt_false_source_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False, True, False], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'alt_false_source_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + images = verto_extension_custom_rules.required_files['images'] + expected_images = { + 'finite-state-automata-trap-added-example.png', + 'finite-state-automata-no-trap-example.png' + } + self.assertSetEqual(expected_images, images) + + def test_custom_arguments_hover_true_not_provided(self): + '''Tests to ensure that correct error is raised when hover text is required and not provided. + ''' + custom_argument_rules = { + "image-tag": { + "hover-text": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'hover_true_not_provided.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True], [ImageTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) + + # ~ # Doc Tests - #~ + # ~ def test_doc_example_basic(self): '''Basic example of common usage. diff --git a/verto/tests/InteractiveContainerTest.py b/verto/tests/InteractiveContainerTest.py new file mode 100644 index 00000000..5516d78f --- /dev/null +++ b/verto/tests/InteractiveContainerTest.py @@ -0,0 +1,459 @@ +import markdown +from unittest.mock import Mock +from collections import defaultdict + +from verto.VertoExtension import VertoExtension +from verto.processors.InteractiveContainerBlockProcessor import InteractiveContainerBlockProcessor +from verto.errors.ArgumentMissingError import ArgumentMissingError +from verto.errors.ArgumentValueError import ArgumentValueError +from verto.errors.TagNotMatchedError import TagNotMatchedError +from verto.errors.InteractiveTextContainsInteractiveError import InteractiveTextContainsInteractiveError +from verto.errors.InteractiveMissingTextError import InteractiveMissingTextError +from verto.tests.ProcessorTest import ProcessorTest + + +class InteractiveContainerTest(ProcessorTest): + '''The interactive processor is a simple tag with a complex + output that relies on external systems. + When writing tests whether or not the thumbnail is externally + or internally linked will changed output. If the thumbnail is + internal then the required files must be modified to include + this image. + ''' + + def __init__(self, *args, **kwargs): + '''Set processor name in class for file names. + ''' + ProcessorTest.__init__(self, *args, **kwargs) + self.processor_name = 'interactive-container' + self.tag_argument = 'interactive' + self.ext = Mock() + self.ext.jinja_templates = {'interactive': ProcessorTest.loadJinjaTemplate(self, 'interactive')} + self.ext.processor_info = ProcessorTest.loadProcessorInfo(self) + self.ext.required_files = defaultdict(set) + + def test_whole_page_external_thumbnail(self): + '''Test external image for image thumbnail. + ''' + test_string = self.read_test_file(self.processor_name, 'whole_page_external_thumbnail.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'whole_page_external_thumbnail_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + "binary-cards" + }, + 'images': set(), + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_text_true_not_provided(self): + '''Tests that InteractiveMissingTextError is thrown when text argument is true but not provided. + ''' + test_string = self.read_test_file(self.processor_name, 'text_true_not_provided.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, True, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(InteractiveMissingTextError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) + + def test_text_true_missing_end_tag(self): + '''Tests that TagNotMatchedError is thrown when interactive tag is missing end tag. + ''' + test_string = self.read_test_file(self.processor_name, 'text_true_missing_end_tag.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(TagNotMatchedError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) + + def test_multiple_interactives_text_true(self): + '''Test multiple interactives in one file are all correctly parsed. + ''' + test_string = self.read_test_file(self.processor_name, 'multiple_interactives_text_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False, True, False, True, False, True, False, True, False, True, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'multiple_interactives_text_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + 'binary-cards', + 'arrows', + 'flying-boxes' + }, + 'images': { + 'binarycards.png', + 'interactives/arrows/img/thumbnail.png', + 'interactives/flying-boxes/img/thumbnail.png' + }, + 'page_scripts': set(), + 'scratch_images': set() + } + + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_contains_multiple_interactives_some_text(self): + '''Test multiple interactives in one file are all correctly parsed, and ignores those without text. + ''' + test_string = self.read_test_file(self.processor_name, 'multiple_interactives_some_text.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False, True, False, False, False, False, False, False, False, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'multiple_interactives_some_text_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + 'binary-cards', + }, + 'images': { + 'binarycards.png' + }, + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_text_false(self): + '''Tests processor does not match interactive tag when text argument is false. + ''' + test_string = self.read_test_file(self.processor_name, 'text_false.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'text_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': set(), + 'images': set(), + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_no_text(self): + '''Tests processor does not match interactive tag when text argument is not included. + ''' + test_string = self.read_test_file(self.processor_name, 'no_text.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, False, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'no_text_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': set(), + 'images': set(), + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_interactive_in_interactive_tag(self): + '''Test that InteractiveTextContainsInteractiveError is raised when the first line in an interactive container block is another interactive container block. + ''' + test_string = self.read_test_file(self.processor_name, 'interactive_in_interactive_tag.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False, True, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(InteractiveTextContainsInteractiveError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) + + def test_whole_page_parameters(self): + '''Test whole page interactive with parameters is correctly parsed. + ''' + test_string = self.read_test_file(self.processor_name, 'whole_page_parameters.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'whole_page_parameters_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + "binary-cards" + }, + 'images': { + 'interactives/binary-cards/img/thumbnail.png' + }, + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_whole_page_thumbnail(self): + '''Test whole page interactive with thumbnail is correctly parsed and thumbnail path is added to required files. + ''' + test_string = self.read_test_file(self.processor_name, 'whole_page_thumbnail.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'whole_page_thumbnail_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + "binary-cards" + }, + 'images': { + 'interactives/binary-cards/img/binarycards.png' + }, + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_whole_page_thumbnail_parameters(self): + '''Test whole page interactive with thumbnail and parameters is correctly parsed and thumbnail path is added to required files. + ''' + test_string = self.read_test_file(self.processor_name, 'whole_page_thumbnail_parameters.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'whole_page_thumbnail_parameters_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + "binary-cards" + }, + 'images': { + 'binarycards.png' + }, + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_iframe(self): + '''Test iframe interactive is ignored. + ''' + test_string = self.read_test_file(self.processor_name, 'iframe.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'iframe_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': set(), + 'images': set(), + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_missing_type(self): + '''Test ArgumentMissingError is raised when interactive type is not given. + ''' + test_string = self.read_test_file(self.processor_name, 'missing_type.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) + + def test_invalid_type(self): + '''Test ArgumentValueError is raised when interactive type is not valid. + ''' + test_string = self.read_test_file(self.processor_name, 'invalid_type.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentValueError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) + + def test_multiple_interactives(self): + '''Test multiple interactives in one file are all correctly parsed. + ''' + test_string = self.read_test_file(self.processor_name, 'multiple_interactives.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True, False, True, False, True, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'multiple_interactives_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + 'arrows', + 'flying-boxes' + }, + 'images': { + 'interactives/arrows/img/thumbnail.png', + 'interactives/flying-boxes/img/thumbnail.png' + }, + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_custom_arguments_parameters_true(self): + '''Tests to ensure that interactive tag is rendered correctly when parameters argument is not required. + ''' + custom_argument_rules = { + "interactive-container": { + "parameters": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'parameters_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'parameters_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_thumbnail_true(self): + '''Tests to ensure that interactive tag is rendered correctly when thumbnail argument is not required. + ''' + custom_argument_rules = { + "interactive-container": { + "thumbnail": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'thumbnail_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'thumbnail_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_text_true_not_provided(self): + '''Tests to ensure that correct error is raised when text is required and not provided. + ''' + custom_argument_rules = { + "interactive-container": { + "text": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'text_true_not_provided.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, True, False], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(InteractiveMissingTextError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) + + def test_custom_arguments_parameters_and_thumbnail_true(self): + '''Tests to ensure that interactive tag is rendered correctly when text and thumbnail arguments are required. + ''' + custom_argument_rules = { + "interactive-container": { + "parameters": True, + "thumbnail": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'parameters_and_thumbnail_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'parameters_and_thumbnail_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + # ~ + # Doc Tests + # ~ + + def test_doc_example_whole_page(self): + '''Example of a whole-page interactive. + ''' + test_string = self.read_test_file(self.processor_name, 'doc_example_whole_page_usage.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'doc_example_whole_page_usage_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + "binary-cards" + }, + 'images': { + 'interactives/binary-cards/img/thumbnail.png' + }, + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(self.verto_extension.required_files, required_files) + + def test_doc_example_override_html(self): + '''Example showing overriding the html-template. + ''' + test_string = self.read_test_file(self.processor_name, 'doc_example_override_html.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, True], [InteractiveContainerBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + html_template = self.read_test_file(self.processor_name, 'doc_example_override_html_template.html', strip=True) + verto_extension = VertoExtension([self.processor_name], html_templates={self.tag_argument: html_template}) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'doc_example_override_html_expected.html', strip=True) + + self.assertEqual(expected_string, converted_test_string) + + required_files = { + 'interactives': { + 'binary-cards' + }, + 'images': { + 'binarycards.png' + }, + 'page_scripts': set(), + 'scratch_images': set() + } + self.assertEqual(verto_extension.required_files, required_files) diff --git a/verto/tests/InteractiveTest.py b/verto/tests/InteractiveTagTest.py similarity index 56% rename from verto/tests/InteractiveTest.py rename to verto/tests/InteractiveTagTest.py index ba00cd24..326b1d6f 100644 --- a/verto/tests/InteractiveTest.py +++ b/verto/tests/InteractiveTagTest.py @@ -3,13 +3,13 @@ from collections import defaultdict from verto.VertoExtension import VertoExtension -from verto.processors.InteractiveBlockProcessor import InteractiveBlockProcessor +from verto.processors.InteractiveTagBlockProcessor import InteractiveTagBlockProcessor from verto.errors.ArgumentMissingError import ArgumentMissingError from verto.errors.ArgumentValueError import ArgumentValueError from verto.tests.ProcessorTest import ProcessorTest -class InteractiveTest(ProcessorTest): +class InteractiveTagTest(ProcessorTest): '''The interactive processor is a simple tag with a complex output that relies on external systems. When writing tests whether or not the thumbnail is externally @@ -22,126 +22,28 @@ def __init__(self, *args, **kwargs): '''Set processor name in class for file names. ''' ProcessorTest.__init__(self, *args, **kwargs) - self.processor_name = 'interactive' + self.processor_name = 'interactive-tag' + self.tag_argument = 'interactive' self.ext = Mock() + self.ext.jinja_templates = {'interactive': ProcessorTest.loadJinjaTemplate(self, 'interactive')} self.ext.processor_info = ProcessorTest.loadProcessorInfo(self) - self.ext.jinja_templates = {self.processor_name: ProcessorTest.loadJinjaTemplate(self, self.processor_name)} self.ext.required_files = defaultdict(set) - def test_whole_page_external_thumbnail(self): - '''Test external image for image thumbnail. - ''' - test_string = self.read_test_file(self.processor_name, 'whole_page_external_thumbnail.md') - blocks = self.to_blocks(test_string) - - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) - - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) - expected_string = self.read_test_file(self.processor_name, 'whole_page_external_thumbnail_expected.html', strip=True) - self.assertEqual(expected_string, converted_test_string) - - required_files = { - 'interactives': { - "binary-cards" - }, - 'images': set(), - 'page_scripts': set(), - 'scratch_images': set() - } - self.assertEqual(self.verto_extension.required_files, required_files) - def test_whole_page_text(self): - '''Test whole page interactive with text is correctly parsed. + '''Test whole page interactive with text is ignored. ''' test_string = self.read_test_file(self.processor_name, 'whole_page_text.md') blocks = self.to_blocks(test_string) - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([False, False, False], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_string = self.read_test_file(self.processor_name, 'whole_page_text_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) required_files = { - 'interactives': { - "binary-cards" - }, - 'images': { - 'interactives/binary-cards/img/thumbnail.png' - }, - 'page_scripts': set(), - 'scratch_images': set() - } - self.assertEqual(self.verto_extension.required_files, required_files) - - def test_whole_page_parameters(self): - '''Test whole page interactive with parameters is correctly parsed. - ''' - test_string = self.read_test_file(self.processor_name, 'whole_page_parameters.md') - blocks = self.to_blocks(test_string) - - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) - - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) - expected_string = self.read_test_file(self.processor_name, 'whole_page_parameters_expected.html', strip=True) - self.assertEqual(expected_string, converted_test_string) - - required_files = { - 'interactives': { - "binary-cards" - }, - 'images': { - 'interactives/binary-cards/img/thumbnail.png' - }, - 'page_scripts': set(), - 'scratch_images': set() - } - self.assertEqual(self.verto_extension.required_files, required_files) - - def test_whole_page_thumbnail(self): - '''Test whole page interactive with thumbnail is correctly parsed and thumbnail path is added to required files. - ''' - test_string = self.read_test_file(self.processor_name, 'whole_page_thumbnail.md') - blocks = self.to_blocks(test_string) - - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) - - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) - expected_string = self.read_test_file(self.processor_name, 'whole_page_thumbnail_expected.html', strip=True) - self.assertEqual(expected_string, converted_test_string) - - required_files = { - 'interactives': { - "binary-cards" - }, - 'images': { - 'interactives/binary-cards/img/binarycards.png' - }, - 'page_scripts': set(), - 'scratch_images': set() - } - self.assertEqual(self.verto_extension.required_files, required_files) - - - def test_whole_page_thumbnail_parameters(self): - '''Test whole page interactive with thumbnail and parameters is correctly parsed and thumbnail path is added to required files. - ''' - test_string = self.read_test_file(self.processor_name, 'whole_page_thumbnail_parameters.md') - blocks = self.to_blocks(test_string) - - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) - - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) - expected_string = self.read_test_file(self.processor_name, 'whole_page_thumbnail_parameters_expected.html', strip=True) - self.assertEqual(expected_string, converted_test_string) - - required_files = { - 'interactives': { - "binary-cards" - }, - 'images': { - 'binarycards.png' - }, + 'interactives': set(), + 'images': set(), 'page_scripts': set(), 'scratch_images': set() } @@ -153,7 +55,7 @@ def test_iframe_parameters(self): test_string = self.read_test_file(self.processor_name, 'iframe_parameters.md') blocks = self.to_blocks(test_string) - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([True], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_string = self.read_test_file(self.processor_name, 'iframe_parameters_expected.html', strip=True) @@ -175,7 +77,7 @@ def test_in_page_missing_name(self): test_string = self.read_test_file(self.processor_name, 'in_page_missing_name.md') blocks = self.to_blocks(test_string) - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([True], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) @@ -185,7 +87,7 @@ def test_missing_type(self): test_string = self.read_test_file(self.processor_name, 'missing_type.md') blocks = self.to_blocks(test_string) - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([True], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) @@ -195,7 +97,7 @@ def test_invalid_type(self): test_string = self.read_test_file(self.processor_name, 'invalid_type.md') blocks = self.to_blocks(test_string) - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([True], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) self.assertRaises(ArgumentValueError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) @@ -205,7 +107,7 @@ def test_multiple_interactives(self): test_string = self.read_test_file(self.processor_name, 'multiple_interactives.md') blocks = self.to_blocks(test_string) - self.assertListEqual([False, True, False, True, False, True, False], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([False, True, False, True, False, True, False], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_string = self.read_test_file(self.processor_name, 'multiple_interactives_expected.html', strip=True) @@ -227,9 +129,76 @@ def test_multiple_interactives(self): } self.assertEqual(self.verto_extension.required_files, required_files) - #~ + def test_custom_arguments_parameters_true(self): + '''Tests to ensure that interactive tag is rendered correctly when parameters argument is required. + ''' + custom_argument_rules = { + "interactive-tag": { + "parameters": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'parameters_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'parameters_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_thumbnail_true(self): + '''Tests to ensure that interactive tag is rendered correctly when thumbnail argument is required. + ''' + custom_argument_rules = { + "interactive-tag": { + "thumbnail": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'thumbnail_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'thumbnail_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_parameters_and_thumbnail_true(self): + '''Tests to ensure that interactive tag is rendered correctly when type argument is not required and parameters argument is required. + ''' + custom_argument_rules = { + "interactive-tag": { + "parameters": True, + "thumbnail": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'parameters_and_thumbnail_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, True, False], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'parameters_and_thumbnail_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + # ~ # Doc Tests - #~ + # ~ def test_doc_example_in_page(self): '''Example of an in-page interactive. @@ -237,7 +206,7 @@ def test_doc_example_in_page(self): test_string = self.read_test_file(self.processor_name, 'doc_example_in_page_usage.md') blocks = self.to_blocks(test_string) - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([True], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_string = self.read_test_file(self.processor_name, 'doc_example_in_page_usage_expected.html', strip=True) @@ -255,37 +224,13 @@ def test_doc_example_in_page(self): } self.assertEqual(self.verto_extension.required_files, required_files) - def test_doc_example_whole_page(self): - '''Example of a whole-page interactive. - ''' - test_string = self.read_test_file(self.processor_name, 'doc_example_whole_page_usage.md') - blocks = self.to_blocks(test_string) - - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) - - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) - expected_string = self.read_test_file(self.processor_name, 'doc_example_whole_page_usage_expected.html', strip=True) - self.assertEqual(expected_string, converted_test_string) - - required_files = { - 'interactives': { - "binary-cards" - }, - 'images': { - 'interactives/binary-cards/img/thumbnail.png' - }, - 'page_scripts': set(), - 'scratch_images': set() - } - self.assertEqual(self.verto_extension.required_files, required_files) - def test_doc_example_iframe(self): '''Example of an iframe interactive. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_iframe_usage.md') blocks = self.to_blocks(test_string) - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([True], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_string = self.read_test_file(self.processor_name, 'doc_example_iframe_usage_expected.html', strip=True) @@ -307,10 +252,10 @@ def test_doc_example_override_html(self): test_string = self.read_test_file(self.processor_name, 'doc_example_override_html.md') blocks = self.to_blocks(test_string) - self.assertListEqual([True], [InteractiveBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + self.assertListEqual([True], [InteractiveTagBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) html_template = self.read_test_file(self.processor_name, 'doc_example_override_html_template.html', strip=True) - verto_extension = VertoExtension([self.processor_name], html_templates={self.processor_name: html_template}) + verto_extension = VertoExtension([self.processor_name], html_templates={self.tag_argument: html_template}) converted_test_string = markdown.markdown(test_string, extensions=[verto_extension]) expected_string = self.read_test_file(self.processor_name, 'doc_example_override_html_expected.html', strip=True) diff --git a/verto/tests/JinjaTest.py b/verto/tests/JinjaTest.py index effce2e2..680bb64f 100644 --- a/verto/tests/JinjaTest.py +++ b/verto/tests/JinjaTest.py @@ -1,7 +1,7 @@ import markdown -from verto.VertoExtension import VertoExtension from verto.tests.ProcessorTest import ProcessorTest + class JinjaTest(ProcessorTest): '''Unescape special characters within Django blocks. ''' @@ -13,7 +13,7 @@ def __init__(self, *args, **kwargs): self.processor_name = 'jinja' def test_doc_example_basic(self): - '''Checks that basic usecase works as expected. + '''Checks that basic use case works as expected. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_basic_usage.md') diff --git a/verto/tests/PanelTest.py b/verto/tests/PanelTest.py index 76c4344b..4151d02b 100644 --- a/verto/tests/PanelTest.py +++ b/verto/tests/PanelTest.py @@ -4,9 +4,11 @@ from verto.VertoExtension import VertoExtension from verto.processors.PanelBlockProcessor import PanelBlockProcessor from verto.errors.TagNotMatchedError import TagNotMatchedError +from verto.errors.ArgumentMissingError import ArgumentMissingError from verto.errors.ArgumentValueError import ArgumentValueError from verto.errors.PanelMissingTitleError import PanelMissingTitleError from verto.errors.PanelMissingSubtitleError import PanelMissingSubtitleError +from verto.errors.StyleError import StyleError from verto.tests.ProcessorTest import ProcessorTest @@ -356,9 +358,105 @@ def test_panel_only_in_numbered_list(self): expected_string = self.read_test_file(self.processor_name, 'panel_only_in_numbered_list_expected.html', strip=True) self.assertEqual(expected_string, converted_test_string) - #~ + def test_panel_block_missing_whitespace(self): + '''Tests that panels and containers work within numbered lists. + ''' + test_string = self.read_test_file(self.processor_name, 'panel_block_missing_whitespace.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(StyleError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) + + def test_custom_arguments_type_false(self): + '''Tests to ensure that panel tag is rendered correctly when type argument is not required. + ''' + custom_argument_rules = { + "panel": { + "type": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'type_false.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'type_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_subtitle_true(self): + '''Tests to ensure that panel tag is rendered correctly when subtitle argument is required. + ''' + custom_argument_rules = { + "panel": { + "subtitle": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'subtitle_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, False, False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'subtitle_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_expanded_true(self): + '''Tests to ensure that panel tag is rendered correctly when expanded argument is required. + ''' + custom_argument_rules = { + "panel": { + "expanded": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'expanded_true.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, False, False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'expanded_true_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + def test_custom_arguments_subtitle_true_not_provided(self): + '''Tests to ensure that correct error is raised when subtitle is required and not provided. + ''' + custom_argument_rules = { + "panel": { + "subtitle": True + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'subtitle_true_not_provided.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([True, False, False, False, True], [self.block_processor.test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string) + + # ~ # Doc Tests - #~ + # ~ def test_doc_example_basic(self): '''Example of the common usecase. diff --git a/verto/tests/RelativeLinkTest.py b/verto/tests/RelativeLinkTest.py index ae9694e8..2811f1c4 100644 --- a/verto/tests/RelativeLinkTest.py +++ b/verto/tests/RelativeLinkTest.py @@ -1,10 +1,10 @@ import markdown import re from unittest.mock import Mock -from verto.VertoExtension import VertoExtension from verto.processors.RelativeLinkPattern import RelativeLinkPattern from verto.tests.ProcessorTest import ProcessorTest + class RelativeLinkTest(ProcessorTest): '''Tests to check the 'relative-link' pattern works as intended. This class is unique to other processors as it overrides @@ -216,7 +216,6 @@ def test_mailto_text(self): expected_string = self.read_test_file(self.processor_name, 'mailto_text_expected.html', strip=True).strip() self.assertEqual(expected_string, converted_test_string) - def test_ignore_news_schema(self): '''Tests that non-relative links are not matched. ''' diff --git a/verto/tests/RemoveTitleTest.py b/verto/tests/RemoveTitleTest.py index 8cc5eef0..248b2e11 100644 --- a/verto/tests/RemoveTitleTest.py +++ b/verto/tests/RemoveTitleTest.py @@ -4,6 +4,7 @@ from verto.processors.RemoveTitlePreprocessor import RemoveTitlePreprocessor from verto.tests.ProcessorTest import ProcessorTest + class RemoveTitleTest(ProcessorTest): '''Tests to check the 'remove-title' preprocesser works as intended. ''' diff --git a/verto/tests/ScratchInlineTest.py b/verto/tests/ScratchInlineTest.py index 3b5e3256..d5270fed 100644 --- a/verto/tests/ScratchInlineTest.py +++ b/verto/tests/ScratchInlineTest.py @@ -1,12 +1,10 @@ import markdown -from unittest.mock import Mock -from collections import defaultdict from verto.VertoExtension import VertoExtension from verto.processors.ScratchTreeprocessor import ScratchImageMetaData -from verto.processors.ScratchInlineTreeprocessor import ScratchInlineTreeprocessor from verto.tests.ProcessorTest import ProcessorTest + class ScratchInlineTest(ProcessorTest): '''Scratch blocks are unique in that they override behaviour in markdown. ''' diff --git a/verto/tests/ScratchTest.py b/verto/tests/ScratchTest.py index 27c35746..68e9feb5 100644 --- a/verto/tests/ScratchTest.py +++ b/verto/tests/ScratchTest.py @@ -1,11 +1,10 @@ import markdown -from unittest.mock import Mock -from collections import defaultdict from verto.VertoExtension import VertoExtension -from verto.processors.ScratchTreeprocessor import ScratchTreeprocessor, ScratchImageMetaData +from verto.processors.ScratchTreeprocessor import ScratchImageMetaData from verto.tests.ProcessorTest import ProcessorTest + class ScratchTest(ProcessorTest): '''Scratch blocks are unique in that they override behaviour in markdown and behaviour in markdown extensions, while also retaining @@ -23,9 +22,10 @@ def setUp(self): ''' self.verto_extension = VertoExtension([self.processor_name], {}, ['markdown.extensions.fenced_code']) - #~ + # ~ # Doc Tests - #~ + # ~ + def test_doc_example_basic(self): '''An example of common useage. ''' diff --git a/verto/tests/StyleTest.py b/verto/tests/StyleTest.py index 7e862ac9..0ad4f9ce 100644 --- a/verto/tests/StyleTest.py +++ b/verto/tests/StyleTest.py @@ -1,11 +1,10 @@ import markdown from unittest.mock import Mock -from verto.VertoExtension import VertoExtension -from verto.processors.StylePreprocessor import StylePreprocessor from verto.errors.StyleError import StyleError from verto.tests.ProcessorTest import ProcessorTest + class StyleTest(ProcessorTest): '''Checks that failures are raised correctly. ''' @@ -22,62 +21,59 @@ def test_doc_example_block_whitespace(self): '''Test before an after a block. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_whitespace.md') - with self.assertRaises(StyleError): - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + self.assertRaises(StyleError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) def test_doc_example_block_whitespace_1(self): '''Test no whitespace before an after content in a block container. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_whitespace_1.md') - with self.assertRaises(StyleError): - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + self.assertRaises(StyleError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) def test_doc_example_block_whitespace_2(self): '''Test no whitespace before a block tag. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_whitespace_2.md') - with self.assertRaises(StyleError): - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + self.assertRaises(StyleError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) def test_doc_example_block_whitespace_3(self): '''Test no whitespace after a block tag. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_whitespace_3.md') - with self.assertRaises(StyleError): - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + self.assertRaises(StyleError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) def test_doc_example_block_solitary(self): '''Test extra text after a tag that should be solitary. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_solitary.md') - with self.assertRaises(StyleError): - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + self.assertRaises(StyleError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) def test_doc_example_block_solitary_1(self): '''Test extra text before a tag that should be solitary. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_solitary_1.md') - with self.assertRaises(StyleError): - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + self.assertRaises(StyleError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) def test_doc_example_block_valid(self): '''A valid example of using container tags. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_valid.md') converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'doc_example_block_valid_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) def test_doc_example_block_valid_in_list(self): '''A valid example of using container tags. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_valid_in_list.md') converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'doc_example_block_valid_in_list_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) def test_doc_example_block_error_in_list(self): '''A valid example of using container tags. ''' test_string = self.read_test_file(self.processor_name, 'doc_example_block_error_in_list.md') - with self.assertRaises(StyleError): - converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + self.assertRaises(StyleError, lambda x: markdown.markdown(x, extensions=[self.verto_extension]), test_string) diff --git a/verto/tests/TableOfContentsTest.py b/verto/tests/TableOfContentsTest.py index 08fd50a1..e7edf4a9 100644 --- a/verto/tests/TableOfContentsTest.py +++ b/verto/tests/TableOfContentsTest.py @@ -23,9 +23,10 @@ def __init__(self, *args, **kwargs): self.ext.jinja_templates = {self.processor_name: ProcessorTest.loadJinjaTemplate(self, self.processor_name)} self.block_processor = GenericTagBlockProcessor(self.processor_name, self.ext, Mock()) - #~ + # ~ # Doc Tests - #~ + # ~ + def test_doc_example_basic(self): '''A generic example of common usage. ''' diff --git a/verto/tests/VideoTest.py b/verto/tests/VideoTest.py index 61d88c66..33827513 100644 --- a/verto/tests/VideoTest.py +++ b/verto/tests/VideoTest.py @@ -3,7 +3,6 @@ from verto.VertoExtension import VertoExtension from verto.processors.VideoBlockProcessor import VideoBlockProcessor -from verto.errors.NoSourceLinkError import NoSourceLinkError from verto.errors.NoVideoIdentifierError import NoVideoIdentifierError from verto.errors.UnsupportedVideoPlayerError import UnsupportedVideoPlayerError from verto.tests.ProcessorTest import ProcessorTest @@ -23,10 +22,10 @@ def __init__(self, *args, **kwargs): self.processor_name = 'video' self.ext = Mock() self.ext.jinja_templates = { - self.processor_name: ProcessorTest.loadJinjaTemplate(self, self.processor_name), - 'video-youtube': ProcessorTest.loadJinjaTemplate(self, 'video-youtube'), - 'video-vimeo': ProcessorTest.loadJinjaTemplate(self, 'video-vimeo') - } + self.processor_name: ProcessorTest.loadJinjaTemplate(self, self.processor_name), + 'video-youtube': ProcessorTest.loadJinjaTemplate(self, 'video-youtube'), + 'video-vimeo': ProcessorTest.loadJinjaTemplate(self, 'video-vimeo') + } self.ext.processor_info = ProcessorTest.loadProcessorInfo(self) def test_contains_no_video(self): @@ -173,9 +172,33 @@ def test_contains_multiple_videos(self): converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) expected_file_string = self.read_test_file(self.processor_name, 'contains_multiple_videos_expected.html', strip=True) self.assertEqual(converted_test_string, expected_file_string) - #~ + + def test_url_false_custom_argument_rules(self): + '''Tests to ensure that video tag is rendered correctly when url argument is not required. + ''' + custom_argument_rules = { + "video": { + "url": False + } + } + verto_extension_custom_rules = VertoExtension( + processors=[self.processor_name], + custom_argument_rules=custom_argument_rules + ) + + test_string = self.read_test_file(self.processor_name, 'url_false.md') + blocks = self.to_blocks(test_string) + + self.assertListEqual([False, False, False], [VideoBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[verto_extension_custom_rules]) + expected_string = self.read_test_file(self.processor_name, 'url_false_expected.html', strip=True) + self.assertEqual(expected_string, converted_test_string) + + # ~ # Doc Tests - #~ + # ~ + def test_doc_example_basic(self): '''A generic example of common usage. ''' diff --git a/verto/tests/assets/boxed-text/boxed_text_type.md b/verto/tests/assets/boxed-text/boxed_text_type.md new file mode 100644 index 00000000..bb5fe6ff --- /dev/null +++ b/verto/tests/assets/boxed-text/boxed_text_type.md @@ -0,0 +1,7 @@ +{boxed-text type="quote"} + +This text is displayed using a Bootstrap 4 card. + +Where some more text might exist. + +{boxed-text end} diff --git a/verto/tests/assets/boxed-text/boxed_text_type_expected.html b/verto/tests/assets/boxed-text/boxed_text_type_expected.html new file mode 100644 index 00000000..22ecc381 --- /dev/null +++ b/verto/tests/assets/boxed-text/boxed_text_type_expected.html @@ -0,0 +1,4 @@ +
+

This text is displayed using a Bootstrap 4 card.

+

Where some more text might exist.

+
diff --git a/verto/tests/assets/boxed-text/indented_and_type_required.md b/verto/tests/assets/boxed-text/indented_and_type_required.md new file mode 100644 index 00000000..b2879294 --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_and_type_required.md @@ -0,0 +1,5 @@ +{boxed-text indented="yes" type="quote"} + +This text is displayed using a Bootstrap 4 card. + +{boxed-text end} diff --git a/verto/tests/assets/boxed-text/indented_and_type_required_expected.html b/verto/tests/assets/boxed-text/indented_and_type_required_expected.html new file mode 100644 index 00000000..5a1b1c3b --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_and_type_required_expected.html @@ -0,0 +1,3 @@ +
+

This text is displayed using a Bootstrap 4 card.

+
diff --git a/verto/tests/assets/boxed-text/indented_and_type_required_type_not_provided.md b/verto/tests/assets/boxed-text/indented_and_type_required_type_not_provided.md new file mode 100644 index 00000000..cae9cb4a --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_and_type_required_type_not_provided.md @@ -0,0 +1,5 @@ +{boxed-text indented="yes"} + +This text is displayed using a Bootstrap 4 card. + +{boxed-text end} diff --git a/verto/tests/assets/boxed-text/indented_required.md b/verto/tests/assets/boxed-text/indented_required.md new file mode 100644 index 00000000..cae9cb4a --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_required.md @@ -0,0 +1,5 @@ +{boxed-text indented="yes"} + +This text is displayed using a Bootstrap 4 card. + +{boxed-text end} diff --git a/verto/tests/assets/boxed-text/indented_required_expected.html b/verto/tests/assets/boxed-text/indented_required_expected.html new file mode 100644 index 00000000..cd5443b5 --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_required_expected.html @@ -0,0 +1,3 @@ +
+

This text is displayed using a Bootstrap 4 card.

+
diff --git a/verto/tests/assets/boxed-text/indented_required_not_provided.md b/verto/tests/assets/boxed-text/indented_required_not_provided.md new file mode 100644 index 00000000..7f453656 --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_required_not_provided.md @@ -0,0 +1,5 @@ +{boxed-text} + +This text is displayed using a Bootstrap 4 card. + +{boxed-text end} diff --git a/verto/tests/assets/boxed-text/indented_type_boxed_text.md b/verto/tests/assets/boxed-text/indented_type_boxed_text.md new file mode 100644 index 00000000..c3ddbe57 --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_type_boxed_text.md @@ -0,0 +1,5 @@ +{boxed-text indented="yes" type="cats"} + +This text is displayed using a Bootstrap 4 card. + +{boxed-text end} diff --git a/verto/tests/assets/boxed-text/indented_type_boxed_text_expected.html b/verto/tests/assets/boxed-text/indented_type_boxed_text_expected.html new file mode 100644 index 00000000..b19d7440 --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_type_boxed_text_expected.html @@ -0,0 +1,3 @@ +
+

This text is displayed using a Bootstrap 4 card.

+
diff --git a/verto/tests/assets/boxed-text/indented_value_no.md b/verto/tests/assets/boxed-text/indented_value_no.md new file mode 100644 index 00000000..1c7ed6d8 --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_value_no.md @@ -0,0 +1,7 @@ +{boxed-text indented="no"} + +This text is displayed using a Bootstrap 4 card. + +Where some more text might exist. + +{boxed-text end} diff --git a/verto/tests/assets/boxed-text/indented_value_no_expected.html b/verto/tests/assets/boxed-text/indented_value_no_expected.html new file mode 100644 index 00000000..a5ffb467 --- /dev/null +++ b/verto/tests/assets/boxed-text/indented_value_no_expected.html @@ -0,0 +1,4 @@ +
+

This text is displayed using a Bootstrap 4 card.

+

Where some more text might exist.

+
diff --git a/verto/tests/assets/boxed-text/multiple_boxed_text.md b/verto/tests/assets/boxed-text/multiple_boxed_text.md index be8ba40f..28b06d95 100644 --- a/verto/tests/assets/boxed-text/multiple_boxed_text.md +++ b/verto/tests/assets/boxed-text/multiple_boxed_text.md @@ -6,7 +6,7 @@ This text is displayed using a Bootstrap 4 card. Aenean turpis diam, dictum nec odio ut, porta luctus nunc. Donec vulputate eu magna non finibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam finibus lectus non lorem consectetur, id sollicitudin est tristique. Nulla in ultricies lectus, nec dapibus ante. Ut ullamcorper orci tincidunt ex mollis rutrum. Nam dapibus diam eu orci laoreet, et egestas quam consectetur. Vestibulum ligula leo, iaculis ac commodo lobortis, posuere ac dui. Aliquam egestas odio congue tempus cursus. Donec dictum dui facilisis enim molestie venenatis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -{boxed-text} +{boxed-text type="cats"} Lorem ipsum dolor sit amet, consectetur adipiscing elit. In fermentum sit amet metus at congue. Fusce nec mauris accumsan, consequat mi ut, scelerisque erat. In hac habitasse platea dictumst. Phasellus maximus semper blandit. Nam consequat justo eget orci ultricies convallis. Praesent tempus sodales ipsum. Suspendisse faucibus quam vitae mollis rutrum. Fusce sit amet lacus sit amet arcu lobortis suscipit a vel nulla. diff --git a/verto/tests/assets/boxed-text/multiple_boxed_text_expected.html b/verto/tests/assets/boxed-text/multiple_boxed_text_expected.html index 2dbeb661..9d7bfc5f 100644 --- a/verto/tests/assets/boxed-text/multiple_boxed_text_expected.html +++ b/verto/tests/assets/boxed-text/multiple_boxed_text_expected.html @@ -2,7 +2,7 @@

This text is displayed using a Bootstrap 4 card.

Aenean turpis diam, dictum nec odio ut, porta luctus nunc. Donec vulputate eu magna non finibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam finibus lectus non lorem consectetur, id sollicitudin est tristique. Nulla in ultricies lectus, nec dapibus ante. Ut ullamcorper orci tincidunt ex mollis rutrum. Nam dapibus diam eu orci laoreet, et egestas quam consectetur. Vestibulum ligula leo, iaculis ac commodo lobortis, posuere ac dui. Aliquam egestas odio congue tempus cursus. Donec dictum dui facilisis enim molestie venenatis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

-
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In fermentum sit amet metus at congue. Fusce nec mauris accumsan, consequat mi ut, scelerisque erat. In hac habitasse platea dictumst. Phasellus maximus semper blandit. Nam consequat justo eget orci ultricies convallis. Praesent tempus sodales ipsum. Suspendisse faucibus quam vitae mollis rutrum. Fusce sit amet lacus sit amet arcu lobortis suscipit a vel nulla.

Mauris vestibulum vestibulum neque a mollis. Curabitur ut urna eleifend urna eleifend mollis. Aliquam malesuada luctus purus, eu maximus elit finibus sed. Ut consectetur tempus tempus. Etiam lacinia at mauris eu sagittis. Donec ante urna, semper id aliquam id.

diff --git a/verto/tests/assets/boxed-text/type_required.md b/verto/tests/assets/boxed-text/type_required.md new file mode 100644 index 00000000..ccb26844 --- /dev/null +++ b/verto/tests/assets/boxed-text/type_required.md @@ -0,0 +1,5 @@ +{boxed-text type="quote"} + +This text is a quote. + +{boxed-text end} diff --git a/verto/tests/assets/boxed-text/type_required_expected.html b/verto/tests/assets/boxed-text/type_required_expected.html new file mode 100644 index 00000000..a1df3c12 --- /dev/null +++ b/verto/tests/assets/boxed-text/type_required_expected.html @@ -0,0 +1,3 @@ +
+

This text is a quote.

+
diff --git a/verto/tests/assets/button-link/file_true.md b/verto/tests/assets/button-link/file_true.md new file mode 100644 index 00000000..e58874d3 --- /dev/null +++ b/verto/tests/assets/button-link/file_true.md @@ -0,0 +1,7 @@ +The following interactive has a program that solves the problem for however many cities you want to select by trying out all possible routes, and recording the best so far. You can get a feel for what an intractable problem looks like by seeing how long the interactive takes to solve the problem for different size maps. +Try generating a map with about 5 cities, and press "Start" to solve the problem. + +{button-link link="files/python-example.py" text="Example Code", file="yes"} + +Now try it for 10 cities (twice as many). Does it take twice as long? How about twice as many again (20 cities)? What about 50 cities? Can you guess how long it would take? +You're starting to get a feel for what it means for a problem to be *intractable*. diff --git a/verto/tests/assets/button-link/file_true_expected.html b/verto/tests/assets/button-link/file_true_expected.html new file mode 100644 index 00000000..f7de3f7a --- /dev/null +++ b/verto/tests/assets/button-link/file_true_expected.html @@ -0,0 +1,4 @@ +

The following interactive has a program that solves the problem for however many cities you want to select by trying out all possible routes, and recording the best so far. You can get a feel for what an intractable problem looks like by seeing how long the interactive takes to solve the problem for different size maps. +Try generating a map with about 5 cities, and press "Start" to solve the problem.

+Example Code

Now try it for 10 cities (twice as many). Does it take twice as long? How about twice as many again (20 cities)? What about 50 cities? Can you guess how long it would take? +You're starting to get a feel for what it means for a problem to be intractable.

diff --git a/verto/tests/assets/button-link/file_true_not_provided.md b/verto/tests/assets/button-link/file_true_not_provided.md new file mode 100644 index 00000000..228328d4 --- /dev/null +++ b/verto/tests/assets/button-link/file_true_not_provided.md @@ -0,0 +1,7 @@ +The following interactive has a program that solves the problem for however many cities you want to select by trying out all possible routes, and recording the best so far. You can get a feel for what an intractable problem looks like by seeing how long the interactive takes to solve the problem for different size maps. +Try generating a map with about 5 cities, and press "Start" to solve the problem. + +{button-link link="http://www.csfieldguide.org.nz/releases/1.9.9/_static/widgets/tract-tsp-basic-v2.html" text="View city trip interactive"} + +Now try it for 10 cities (twice as many). Does it take twice as long? How about twice as many again (20 cities)? What about 50 cities? Can you guess how long it would take? +You're starting to get a feel for what it means for a problem to be *intractable*. diff --git a/verto/tests/assets/button-link/link_false.md b/verto/tests/assets/button-link/link_false.md new file mode 100644 index 00000000..82ede019 --- /dev/null +++ b/verto/tests/assets/button-link/link_false.md @@ -0,0 +1,3 @@ +You can try out this 3D matrix in the following interactive. + +{button-link text="Click for interactive: 3D transform matrix"} diff --git a/verto/tests/assets/button-link/link_false_expected.html b/verto/tests/assets/button-link/link_false_expected.html new file mode 100644 index 00000000..d3fc1a8e --- /dev/null +++ b/verto/tests/assets/button-link/link_false_expected.html @@ -0,0 +1,2 @@ +

You can try out this 3D matrix in the following interactive.

+Click for interactive: 3D transform matrix diff --git a/verto/tests/assets/button-link/text_false.md b/verto/tests/assets/button-link/text_false.md new file mode 100644 index 00000000..83cfeeef --- /dev/null +++ b/verto/tests/assets/button-link/text_false.md @@ -0,0 +1,7 @@ +The following interactive has a program that solves the problem for however many cities you want to select by trying out all possible routes, and recording the best so far. You can get a feel for what an intractable problem looks like by seeing how long the interactive takes to solve the problem for different size maps. +Try generating a map with about 5 cities, and press "Start" to solve the problem. + +{button-link link="http://www.csfieldguide.org.nz/releases/1.9.9/_static/widgets/tract-tsp-basic-v2.html"} + +Now try it for 10 cities (twice as many). Does it take twice as long? How about twice as many again (20 cities)? What about 50 cities? Can you guess how long it would take? +You're starting to get a feel for what it means for a problem to be *intractable*. diff --git a/verto/tests/assets/button-link/text_false_expected.html b/verto/tests/assets/button-link/text_false_expected.html new file mode 100644 index 00000000..724289c8 --- /dev/null +++ b/verto/tests/assets/button-link/text_false_expected.html @@ -0,0 +1,4 @@ +

The following interactive has a program that solves the problem for however many cities you want to select by trying out all possible routes, and recording the best so far. You can get a feel for what an intractable problem looks like by seeing how long the interactive takes to solve the problem for different size maps. +Try generating a map with about 5 cities, and press "Start" to solve the problem.

+None

Now try it for 10 cities (twice as many). Does it take twice as long? How about twice as many again (20 cities)? What about 50 cities? Can you guess how long it would take? +You're starting to get a feel for what it means for a problem to be intractable.

diff --git a/verto/tests/assets/button-link/text_false_file_true.md b/verto/tests/assets/button-link/text_false_file_true.md new file mode 100644 index 00000000..9b0c6868 --- /dev/null +++ b/verto/tests/assets/button-link/text_false_file_true.md @@ -0,0 +1,6 @@ +The following interactive has a program that solves the problem for however many cities you want to select by trying out all possible routes, and recording the best so far. You can get a feel for what an intractable problem looks like by seeing how long the interactive takes to solve the problem for different size maps. +Try generating a map with about 5 cities, and press "Start" to solve the problem. + +{button-link link="link.html" file="yes"} + +Now try it for 10 cities (twice as many). Does it take twice as long? How about twice as many again (20 cities)? What about 50 cities? Can you guess how long it would take? diff --git a/verto/tests/assets/button-link/text_false_file_true_expected.html b/verto/tests/assets/button-link/text_false_file_true_expected.html new file mode 100644 index 00000000..caf23058 --- /dev/null +++ b/verto/tests/assets/button-link/text_false_file_true_expected.html @@ -0,0 +1,3 @@ +

The following interactive has a program that solves the problem for however many cities you want to select by trying out all possible routes, and recording the best so far. You can get a feel for what an intractable problem looks like by seeing how long the interactive takes to solve the problem for different size maps. +Try generating a map with about 5 cities, and press "Start" to solve the problem.

+None

Now try it for 10 cities (twice as many). Does it take twice as long? How about twice as many again (20 cities)? What about 50 cities? Can you guess how long it would take?

diff --git a/verto/tests/assets/configuration/all_processors.md b/verto/tests/assets/configuration/all_processors.md index f73584be..9165b86e 100644 --- a/verto/tests/assets/configuration/all_processors.md +++ b/verto/tests/assets/configuration/all_processors.md @@ -18,13 +18,13 @@ This text is the panel's contents. {panel end} -{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} +{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left" alt="This is alt text"} Dancing with our hands tied. {image end} -{image file-path="http://placehold.it/250x50" caption="false" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} +{image file-path="http://placehold.it/250x50" caption="false" source="https://placehold.it/" hover-text="This is hover text" alignment="left" alt="This is alt text"} {boxed-text} @@ -46,7 +46,7 @@ It's worth considering which {glossary-link term="algorithm"}algorithms{glossary {iframe link="https://github.com/"} -{interactive name="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"} +{interactive slug="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"} scratch when flag clicked diff --git a/verto/tests/assets/configuration/all_processors_custom_html_expected.html b/verto/tests/assets/configuration/all_processors_custom_html_expected.html index 36e2992d..41904832 100644 --- a/verto/tests/assets/configuration/all_processors_custom_html_expected.html +++ b/verto/tests/assets/configuration/all_processors_custom_html_expected.html @@ -20,7 +20,7 @@

This text is the panel's contents.

-
+testtest

Computer Science Report for 2.44

Put your introduction to what bits are here.

@@ -31,7 +31,7 @@

-
diff --git a/verto/tests/assets/configuration/all_processors_except_comment_expected.html b/verto/tests/assets/configuration/all_processors_except_comment_expected.html index 1bb2e934..fc481627 100644 --- a/verto/tests/assets/configuration/all_processors_except_comment_expected.html +++ b/verto/tests/assets/configuration/all_processors_except_comment_expected.html @@ -22,12 +22,12 @@

- +This is alt text

Dancing with our hands tied.

Source

- +This is alt text

Source

@@ -41,7 +41,7 @@

-
@@ -49,5 +49,5 @@

{{ table_of_contents }}
- +
diff --git a/verto/tests/assets/configuration/all_processors_expected.html b/verto/tests/assets/configuration/all_processors_expected.html index 40f8370c..df3a7494 100644 --- a/verto/tests/assets/configuration/all_processors_expected.html +++ b/verto/tests/assets/configuration/all_processors_expected.html @@ -21,12 +21,12 @@

- +This is alt text

Dancing with our hands tied.

Source

- +This is alt text

Source

@@ -40,7 +40,7 @@

-
@@ -48,5 +48,5 @@

{{ table_of_contents }}
- +
diff --git a/verto/tests/assets/configuration/custom_argument_rules_multiple_tags_error.md b/verto/tests/assets/configuration/custom_argument_rules_multiple_tags_error.md new file mode 100644 index 00000000..b8d4d162 --- /dev/null +++ b/verto/tests/assets/configuration/custom_argument_rules_multiple_tags_error.md @@ -0,0 +1,64 @@ +# Example Title + +This is a sentence. + +# Example Title 2 + +{comment This is a comment for other authors to read} + +Check out this [resource](resource/134). + +{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} + +{panel type="teacher-note"} + +# Teacher Note + +This text is the panel's contents. + +{panel end} + +Dancing with our hands tied. + +{image end} + +{image file-path="http://placehold.it/250x50" caption="false" source="https://placehold.it/" hover-text="This is hover text" alignment="left" alt="This is alt text"} + +{boxed-text} + +**Computer Science Report for 2.44** + +Put your introduction to what bits are here. + +{boxed-text end} + +{button-link link="http://www.google.com" text="Visit Google"} + +{conditional if condition="version == 'teacher'"} + +This is text that only teachers should see. + +{conditional end} + +It's worth considering which {glossary-link term="algorithm"}algorithms{glossary-link end} should be used. + +{iframe link="https://github.com/"} + +{interactive slug="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"} + + scratch + when flag clicked + clear + forever + pen down + if < and > then + switch costume to [button v] + else + add (x position) to [list v] + end + move (foo) steps + turn ccw (9) degrees + +{table-of-contents} + +{video url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"} diff --git a/verto/tests/assets/configuration/custom_processors_custom_templates_expected.html b/verto/tests/assets/configuration/custom_processors_custom_templates_expected.html index 4274fac0..2226aeb0 100644 --- a/verto/tests/assets/configuration/custom_processors_custom_templates_expected.html +++ b/verto/tests/assets/configuration/custom_processors_custom_templates_expected.html @@ -8,10 +8,10 @@

Teacher Note

Guides for Algorithms

This text is the panel's contents.

{panel end}

-

{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"}

+

{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left" alt="This is alt text"}

Dancing with our hands tied.

{image end}

-
+test

Computer Science Report for 2.44

Put your introduction to what bits are here.

@@ -21,7 +21,7 @@

Guides for Algorithms

{conditional end}

It's worth considering which {glossary-link term="algorithm"}algorithms{glossary-link end} should be used.

{iframe link="https://github.com/"}

-

{interactive name="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"}

+

{interactive slug="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"}

scratch
 when flag clicked
 clear
diff --git a/verto/tests/assets/configuration/custom_processors_expected.html b/verto/tests/assets/configuration/custom_processors_expected.html
index 981fad7c..d49c836e 100644
--- a/verto/tests/assets/configuration/custom_processors_expected.html
+++ b/verto/tests/assets/configuration/custom_processors_expected.html
@@ -12,11 +12,11 @@ 

Example Title 2

- +This is alt text

Dancing with our hands tied.

Source

-

{image file-path="http://placehold.it/250x50" caption="false" source="https://placehold.it/" hover-text="This is hover text" alignment="left"}

+

{image file-path="http://placehold.it/250x50" caption="false" source="https://placehold.it/" hover-text="This is hover text" alignment="left" alt="This is alt text"}

{boxed-text}

Computer Science Report for 2.44

Put your introduction to what bits are here.

@@ -27,7 +27,7 @@

Example Title 2

{conditional end}

It's worth considering which {glossary-link term="algorithm"}algorithms{glossary-link end} should be used.

{iframe link="https://github.com/"}

-

{interactive name="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"}

+

{interactive slug="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"}

scratch
 when flag clicked
 clear
diff --git a/verto/tests/assets/configuration/multiline_templates_expected.html b/verto/tests/assets/configuration/multiline_templates_expected.html
index f9034627..5aa68efa 100644
--- a/verto/tests/assets/configuration/multiline_templates_expected.html
+++ b/verto/tests/assets/configuration/multiline_templates_expected.html
@@ -39,7 +39,7 @@ 

-
@@ -47,5 +47,5 @@

{{ table_of_contents }}
- +
diff --git a/verto/tests/assets/configuration/some_processors.md b/verto/tests/assets/configuration/some_processors.md index 3b02c4b1..835f559d 100644 --- a/verto/tests/assets/configuration/some_processors.md +++ b/verto/tests/assets/configuration/some_processors.md @@ -2,7 +2,7 @@ ## This is an H2 -{image file-path="totally-legit-image.png"} +{image alt="This is alt text" file-path="totally-legit-image.png"} This is a sentence. diff --git a/verto/tests/assets/configuration/some_processors_2.md b/verto/tests/assets/configuration/some_processors_2.md index e4e675b1..5dd5a897 100644 --- a/verto/tests/assets/configuration/some_processors_2.md +++ b/verto/tests/assets/configuration/some_processors_2.md @@ -1,6 +1,6 @@ # Another Example Title -{image file-path="totally-legit-image.png"} +{image alt="This is alt text" file-path="totally-legit-image.png"} This is a sentence. diff --git a/verto/tests/assets/configuration/some_processors_2_expected.html b/verto/tests/assets/configuration/some_processors_2_expected.html index a5e37f5e..4b530eb2 100644 --- a/verto/tests/assets/configuration/some_processors_2_expected.html +++ b/verto/tests/assets/configuration/some_processors_2_expected.html @@ -5,7 +5,7 @@

Another Example Title

- +This is alt text

This is a sentence.

Here's another FSA to consider:

diff --git a/verto/tests/assets/configuration/some_processors_expected.html b/verto/tests/assets/configuration/some_processors_expected.html index af54bf2d..45b513b3 100644 --- a/verto/tests/assets/configuration/some_processors_expected.html +++ b/verto/tests/assets/configuration/some_processors_expected.html @@ -11,7 +11,7 @@

This is an H2

- +This is alt text

This is a sentence.

Chomsky Hierarchy

diff --git a/verto/tests/assets/glossary-link/reference_text_true.md b/verto/tests/assets/glossary-link/reference_text_true.md new file mode 100644 index 00000000..8c3c9ff5 --- /dev/null +++ b/verto/tests/assets/glossary-link/reference_text_true.md @@ -0,0 +1 @@ +{glossary-link term="chomsky-hierarchy" reference-text="Formal languages"}Chomsky Hierarchy{glossary-link end} diff --git a/verto/tests/assets/glossary-link/reference_text_true_expected.html b/verto/tests/assets/glossary-link/reference_text_true_expected.html new file mode 100644 index 00000000..94bb3629 --- /dev/null +++ b/verto/tests/assets/glossary-link/reference_text_true_expected.html @@ -0,0 +1 @@ +

Chomsky Hierarchy

diff --git a/verto/tests/assets/glossary-link/reference_text_true_not_provided.md b/verto/tests/assets/glossary-link/reference_text_true_not_provided.md new file mode 100644 index 00000000..e6b1ee8a --- /dev/null +++ b/verto/tests/assets/glossary-link/reference_text_true_not_provided.md @@ -0,0 +1 @@ +{glossary-link term="chomsky-hierarchy"}Chomsky Hierarchy{glossary-link end} diff --git a/verto/tests/assets/iframe/link_false.md b/verto/tests/assets/iframe/link_false.md new file mode 100644 index 00000000..3eec868f --- /dev/null +++ b/verto/tests/assets/iframe/link_false.md @@ -0,0 +1 @@ +{iframe} diff --git a/verto/tests/assets/iframe/link_false_expected.html b/verto/tests/assets/iframe/link_false_expected.html new file mode 100644 index 00000000..69f84f7e --- /dev/null +++ b/verto/tests/assets/iframe/link_false_expected.html @@ -0,0 +1,3 @@ + diff --git a/verto/tests/assets/image-container/align_center.md b/verto/tests/assets/image-container/align_center.md index b26706b7..e027f644 100644 --- a/verto/tests/assets/image-container/align_center.md +++ b/verto/tests/assets/image-container/align_center.md @@ -1,4 +1,4 @@ -{image file-path="computer-studying-turing-test.png" caption="true" alignment="center"} +{image alt="alt text" file-path="computer-studying-turing-test.png" caption="true" alignment="center"} This is a caption for a computer studying the turing test. diff --git a/verto/tests/assets/image-container/align_center_expected.html b/verto/tests/assets/image-container/align_center_expected.html index 262ae566..4a6d9a8f 100644 --- a/verto/tests/assets/image-container/align_center_expected.html +++ b/verto/tests/assets/image-container/align_center_expected.html @@ -1,4 +1,4 @@
- +alt text

This is a caption for a computer studying the turing test.

diff --git a/verto/tests/assets/image-container/align_left.md b/verto/tests/assets/image-container/align_left.md index 88ac54c1..8e814886 100644 --- a/verto/tests/assets/image-container/align_left.md +++ b/verto/tests/assets/image-container/align_left.md @@ -1,4 +1,4 @@ -{image file-path="computer-studying-turing-test.png" alignment="left" caption="true"} +{image alt="alt text" file-path="computer-studying-turing-test.png" alignment="left" caption="true"} Cats cats cats. diff --git a/verto/tests/assets/image-container/align_left_expected.html b/verto/tests/assets/image-container/align_left_expected.html index 2369410c..e4dc2421 100644 --- a/verto/tests/assets/image-container/align_left_expected.html +++ b/verto/tests/assets/image-container/align_left_expected.html @@ -1,4 +1,4 @@
- +alt text

Cats cats cats.

diff --git a/verto/tests/assets/image-container/align_right.md b/verto/tests/assets/image-container/align_right.md index 4d997b94..5f126959 100644 --- a/verto/tests/assets/image-container/align_right.md +++ b/verto/tests/assets/image-container/align_right.md @@ -1,4 +1,4 @@ -{image caption="true" file-path="computer-studying-turing-test.png" alignment="right"} +{image caption="true" alt="alt text" file-path="computer-studying-turing-test.png" alignment="right"} Hey hey hey, look who it is! A caption! diff --git a/verto/tests/assets/image-container/align_right_expected.html b/verto/tests/assets/image-container/align_right_expected.html index dfb21c1a..3c8ae5c7 100644 --- a/verto/tests/assets/image-container/align_right_expected.html +++ b/verto/tests/assets/image-container/align_right_expected.html @@ -1,4 +1,4 @@
- +alt text

Hey hey hey, look who it is! A caption!

diff --git a/verto/tests/assets/image-container/align_undefined_error.md b/verto/tests/assets/image-container/align_undefined_error.md index e9e15de6..70c36826 100644 --- a/verto/tests/assets/image-container/align_undefined_error.md +++ b/verto/tests/assets/image-container/align_undefined_error.md @@ -1,4 +1,4 @@ -{image file-path="computer-studying-turing-test.png" alignment="around-about-here" caption="true"} +{image alt="alt text" file-path="computer-studying-turing-test.png" alignment="around-about-here" caption="true"} This is the caption. diff --git a/verto/tests/assets/image-container/alt_false.md b/verto/tests/assets/image-container/alt_false.md new file mode 100644 index 00000000..d98fe8cb --- /dev/null +++ b/verto/tests/assets/image-container/alt_false.md @@ -0,0 +1,11 @@ +Here's another FSA to consider: + +{image file-path="cats.png" caption="true"} + +This is a caption. + +{image end} + +It's fairly clear what it will accept: strings like "ab", "abab", "abababababab", and, of course {math}\epsilon{math end}. +But there are some missing transitions: if you are in state 1 and get a "b" there's nowhere to go. +If an input cannot be accepted, it will be rejected, as in this case. We could have put in a trap state to make this clear: diff --git a/verto/tests/assets/image-container/alt_false_expected.html b/verto/tests/assets/image-container/alt_false_expected.html new file mode 100644 index 00000000..407dcc1e --- /dev/null +++ b/verto/tests/assets/image-container/alt_false_expected.html @@ -0,0 +1,8 @@ +

Here's another FSA to consider:

+
+ +

This is a caption.

+
+

It's fairly clear what it will accept: strings like "ab", "abab", "abababababab", and, of course {math}\epsilon{math end}. +But there are some missing transitions: if you are in state 1 and get a "b" there's nowhere to go. +If an input cannot be accepted, it will be rejected, as in this case. We could have put in a trap state to make this clear:

diff --git a/verto/tests/assets/image-container/alt_false_source_true.md b/verto/tests/assets/image-container/alt_false_source_true.md new file mode 100644 index 00000000..0f6519a0 --- /dev/null +++ b/verto/tests/assets/image-container/alt_false_source_true.md @@ -0,0 +1,11 @@ +Here's another FSA to consider: + +{image file-path="cats.png" caption="true" source="source.com"} + +This is a caption. + +{image end} + +It's fairly clear what it will accept: strings like "ab", "abab", "abababababab", and, of course {math}\epsilon{math end}. +But there are some missing transitions: if you are in state 1 and get a "b" there's nowhere to go. +If an input cannot be accepted, it will be rejected, as in this case. We could have put in a trap state to make this clear: diff --git a/verto/tests/assets/image-container/alt_false_source_true_expected.html b/verto/tests/assets/image-container/alt_false_source_true_expected.html new file mode 100644 index 00000000..09f3c378 --- /dev/null +++ b/verto/tests/assets/image-container/alt_false_source_true_expected.html @@ -0,0 +1,9 @@ +

Here's another FSA to consider:

+
+ +

This is a caption.

+

Source

+
+

It's fairly clear what it will accept: strings like "ab", "abab", "abababababab", and, of course {math}\epsilon{math end}. +But there are some missing transitions: if you are in state 1 and get a "b" there's nowhere to go. +If an input cannot be accepted, it will be rejected, as in this case. We could have put in a trap state to make this clear:

diff --git a/verto/tests/assets/image-container/caption_true_not_provided_numbered_list.md b/verto/tests/assets/image-container/caption_true_not_provided_numbered_list.md index ecb5bf2e..b89cc604 100644 --- a/verto/tests/assets/image-container/caption_true_not_provided_numbered_list.md +++ b/verto/tests/assets/image-container/caption_true_not_provided_numbered_list.md @@ -6,7 +6,7 @@ 2. Lorem - {image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} + {image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left" alt="alt text"} {image end} diff --git a/verto/tests/assets/image-container/caption_true_numbered_list_missing_end_tag.md b/verto/tests/assets/image-container/caption_true_numbered_list_missing_end_tag.md index 3183eb06..e2c2f59e 100644 --- a/verto/tests/assets/image-container/caption_true_numbered_list_missing_end_tag.md +++ b/verto/tests/assets/image-container/caption_true_numbered_list_missing_end_tag.md @@ -6,7 +6,7 @@ 2. Lorem - {image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} + {image file-path="http://placehold.it/350x150" alt="alt text" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} This is a caption diff --git a/verto/tests/assets/image-container/contains_caption_expected.html b/verto/tests/assets/image-container/contains_caption_expected.html index c889960f..e056d598 100644 --- a/verto/tests/assets/image-container/contains_caption_expected.html +++ b/verto/tests/assets/image-container/contains_caption_expected.html @@ -1,4 +1,4 @@
- +alt text

Lipsum

diff --git a/verto/tests/assets/image-container/contains_caption_link.md b/verto/tests/assets/image-container/contains_caption_link.md index 1b743b6a..8baab5b2 100644 --- a/verto/tests/assets/image-container/contains_caption_link.md +++ b/verto/tests/assets/image-container/contains_caption_link.md @@ -1,4 +1,4 @@ -{image file-path="computer-studying-turing-test.png" caption="true" caption-link="example.com"} +{image alt="alt text" file-path="computer-studying-turing-test.png" caption="true" caption-link="example.com"} Lipsum diff --git a/verto/tests/assets/image-container/contains_caption_link_expected.html b/verto/tests/assets/image-container/contains_caption_link_expected.html index e2d38f64..a41f9f04 100644 --- a/verto/tests/assets/image-container/contains_caption_link_expected.html +++ b/verto/tests/assets/image-container/contains_caption_link_expected.html @@ -1,4 +1,4 @@
- +alt text

Lipsum

diff --git a/verto/tests/assets/image-container/contains_hover_text.md b/verto/tests/assets/image-container/contains_hover_text.md index 715bd4d0..ab5e254e 100644 --- a/verto/tests/assets/image-container/contains_hover_text.md +++ b/verto/tests/assets/image-container/contains_hover_text.md @@ -1,4 +1,4 @@ -{image file-path="computer-studying-turing-test.png" hover-text="Lipsum" caption="true"} +{image alt="alt text" file-path="computer-studying-turing-test.png" hover-text="Lipsum" caption="true"} This is why we can't have nice things. diff --git a/verto/tests/assets/image-container/contains_hover_text_expected.html b/verto/tests/assets/image-container/contains_hover_text_expected.html index 17a98075..17baafb5 100644 --- a/verto/tests/assets/image-container/contains_hover_text_expected.html +++ b/verto/tests/assets/image-container/contains_hover_text_expected.html @@ -1,4 +1,4 @@
- +alt text

This is why we can't have nice things.

diff --git a/verto/tests/assets/image-container/contains_source.md b/verto/tests/assets/image-container/contains_source.md index 25aeb33f..85e3a910 100644 --- a/verto/tests/assets/image-container/contains_source.md +++ b/verto/tests/assets/image-container/contains_source.md @@ -1,4 +1,4 @@ -{image caption="true" file-path="computer-studying-turing-test.png" source="example.com"} +{image alt="alt text" caption="true" file-path="computer-studying-turing-test.png" source="example.com"} Dancing with our hands tied. diff --git a/verto/tests/assets/image-container/contains_source_expected.html b/verto/tests/assets/image-container/contains_source_expected.html index ba041d06..fb3a88e4 100644 --- a/verto/tests/assets/image-container/contains_source_expected.html +++ b/verto/tests/assets/image-container/contains_source_expected.html @@ -1,5 +1,5 @@
- +alt text

Dancing with our hands tied.

Source

diff --git a/verto/tests/assets/image-container/doc_example_2_override_html.md b/verto/tests/assets/image-container/doc_example_2_override_html.md index b9349730..c2c765a8 100644 --- a/verto/tests/assets/image-container/doc_example_2_override_html.md +++ b/verto/tests/assets/image-container/doc_example_2_override_html.md @@ -1,4 +1,4 @@ -{image file-path="apple.png" caption="true"} +{image alt="Placeholder alt text" file-path="apple.png" caption="true"} Don't pretend it's such a mystery. diff --git a/verto/tests/assets/image-container/doc_example_2_override_html_expected.html b/verto/tests/assets/image-container/doc_example_2_override_html_expected.html index b5f8b829..6ae9c715 100644 --- a/verto/tests/assets/image-container/doc_example_2_override_html_expected.html +++ b/verto/tests/assets/image-container/doc_example_2_override_html_expected.html @@ -1,4 +1,4 @@
- +Placeholder alt text

Caption:

Don't pretend it's such a mystery.
diff --git a/verto/tests/assets/image-container/doc_example_2_override_html_template.html b/verto/tests/assets/image-container/doc_example_2_override_html_template.html index 8c8660e2..dc86abc1 100644 --- a/verto/tests/assets/image-container/doc_example_2_override_html_template.html +++ b/verto/tests/assets/image-container/doc_example_2_override_html_template.html @@ -1,4 +1,4 @@
- +{{ alt }}

Caption:

{{ caption }}
diff --git a/verto/tests/assets/image-container/doc_example_basic_usage.md b/verto/tests/assets/image-container/doc_example_basic_usage.md index c9946610..39655a87 100644 --- a/verto/tests/assets/image-container/doc_example_basic_usage.md +++ b/verto/tests/assets/image-container/doc_example_basic_usage.md @@ -1,4 +1,4 @@ -{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} +{image alt="Alt text" file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} This is the caption text. diff --git a/verto/tests/assets/image-container/doc_example_basic_usage_expected.html b/verto/tests/assets/image-container/doc_example_basic_usage_expected.html index a0ecbb06..26088f64 100644 --- a/verto/tests/assets/image-container/doc_example_basic_usage_expected.html +++ b/verto/tests/assets/image-container/doc_example_basic_usage_expected.html @@ -1,5 +1,5 @@
- +Alt text

This is the caption text.

Source

diff --git a/verto/tests/assets/image-container/doc_example_override_html.md b/verto/tests/assets/image-container/doc_example_override_html.md index 06449b4b..355fd32a 100644 --- a/verto/tests/assets/image-container/doc_example_override_html.md +++ b/verto/tests/assets/image-container/doc_example_override_html.md @@ -1,4 +1,4 @@ -{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/"} +{image alt="Placeholder alt text" file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/"} This is the caption text. diff --git a/verto/tests/assets/image-container/doc_example_override_html_expected.html b/verto/tests/assets/image-container/doc_example_override_html_expected.html index e1a30e24..59580456 100644 --- a/verto/tests/assets/image-container/doc_example_override_html_expected.html +++ b/verto/tests/assets/image-container/doc_example_override_html_expected.html @@ -1,4 +1,4 @@
- + Placeholder alt text

This is the caption text.

diff --git a/verto/tests/assets/image-container/doc_example_override_html_template.html b/verto/tests/assets/image-container/doc_example_override_html_template.html index 886e565a..e0be7c19 100644 --- a/verto/tests/assets/image-container/doc_example_override_html_template.html +++ b/verto/tests/assets/image-container/doc_example_override_html_template.html @@ -1,4 +1,4 @@
- + {{ alt }}

{{ caption }}

diff --git a/verto/tests/assets/image-container/file_invalid_width_value_1.md b/verto/tests/assets/image-container/file_invalid_width_value_1.md index 50779ab5..d6443e04 100644 --- a/verto/tests/assets/image-container/file_invalid_width_value_1.md +++ b/verto/tests/assets/image-container/file_invalid_width_value_1.md @@ -1,4 +1,4 @@ -{image file-path="path/to/image@.png" caption="true" hover-text="This is hover text" alignment="left"} +{image alt="ducks" file-path="path/to/image@.png" caption="true" hover-text="This is hover text" alignment="left"} This is the caption text. diff --git a/verto/tests/assets/image-container/file_invalid_width_value_1_expected.html b/verto/tests/assets/image-container/file_invalid_width_value_1_expected.html index 1fa1577a..fc2aebde 100644 --- a/verto/tests/assets/image-container/file_invalid_width_value_1_expected.html +++ b/verto/tests/assets/image-container/file_invalid_width_value_1_expected.html @@ -1,4 +1,4 @@
- +ducks

This is the caption text.

diff --git a/verto/tests/assets/image-container/file_invalid_width_value_2.md b/verto/tests/assets/image-container/file_invalid_width_value_2.md index 67ee5a4f..ea85f8aa 100644 --- a/verto/tests/assets/image-container/file_invalid_width_value_2.md +++ b/verto/tests/assets/image-container/file_invalid_width_value_2.md @@ -1,4 +1,4 @@ -{image file-path="path/to/image@em20.png" caption="true" hover-text="This is hover text" alignment="left"} +{image alt="ducks" file-path="path/to/image@em20.png" caption="true" hover-text="This is hover text" alignment="left"} This is the caption text. diff --git a/verto/tests/assets/image-container/file_invalid_width_value_2_expected.html b/verto/tests/assets/image-container/file_invalid_width_value_2_expected.html index 5d932441..e806d814 100644 --- a/verto/tests/assets/image-container/file_invalid_width_value_2_expected.html +++ b/verto/tests/assets/image-container/file_invalid_width_value_2_expected.html @@ -1,4 +1,4 @@
- +ducks

This is the caption text.

diff --git a/verto/tests/assets/image-container/file_width_value.md b/verto/tests/assets/image-container/file_width_value.md index 018577b6..b8b34654 100644 --- a/verto/tests/assets/image-container/file_width_value.md +++ b/verto/tests/assets/image-container/file_width_value.md @@ -1,4 +1,4 @@ -{image file-path="path/to/image@500px.png" caption="true" hover-text="This is hover text" alignment="left"} +{image file-path="path/to/image@500px.png" caption="true" hover-text="This is hover text" alt="cats" alignment="left"} This is the caption text. diff --git a/verto/tests/assets/image-container/file_width_value_expected.html b/verto/tests/assets/image-container/file_width_value_expected.html index eb89417f..1c7de037 100644 --- a/verto/tests/assets/image-container/file_width_value_expected.html +++ b/verto/tests/assets/image-container/file_width_value_expected.html @@ -1,4 +1,4 @@
- +cats

This is the caption text.

diff --git a/verto/tests/assets/image-container/file_width_value_external_image.md b/verto/tests/assets/image-container/file_width_value_external_image.md index 40cb4077..a04bf37f 100644 --- a/verto/tests/assets/image-container/file_width_value_external_image.md +++ b/verto/tests/assets/image-container/file_width_value_external_image.md @@ -1,4 +1,4 @@ -{image file-path="https://www.verto.io/images/image@200px.png" caption="true" hover-text="This is hover text" alignment="left"} +{image file-path="https://www.verto.io/images/image@200px.png" caption="true" alt="cats" hover-text="This is hover text" alignment="left"} This is the caption text. diff --git a/verto/tests/assets/image-container/file_width_value_external_image_expected.html b/verto/tests/assets/image-container/file_width_value_external_image_expected.html index 838b6e67..54ff24b4 100644 --- a/verto/tests/assets/image-container/file_width_value_external_image_expected.html +++ b/verto/tests/assets/image-container/file_width_value_external_image_expected.html @@ -1,4 +1,4 @@
- +cats

This is the caption text.

diff --git a/verto/tests/assets/image-container/file_width_value_no_units.md b/verto/tests/assets/image-container/file_width_value_no_units.md index 75353b01..4c393c8d 100644 --- a/verto/tests/assets/image-container/file_width_value_no_units.md +++ b/verto/tests/assets/image-container/file_width_value_no_units.md @@ -1,4 +1,4 @@ -{image file-path="path/to/image@700.png" caption="true"} +{image alt="alt text" file-path="path/to/image@700.png" caption="true"} This is the caption text. diff --git a/verto/tests/assets/image-container/file_width_value_no_units_expected.html b/verto/tests/assets/image-container/file_width_value_no_units_expected.html index 1b4706cf..9cc958a1 100644 --- a/verto/tests/assets/image-container/file_width_value_no_units_expected.html +++ b/verto/tests/assets/image-container/file_width_value_no_units_expected.html @@ -1,4 +1,4 @@
- +alt text

This is the caption text.

diff --git a/verto/tests/assets/image-container/file_width_value_no_units_html_template.html b/verto/tests/assets/image-container/file_width_value_no_units_html_template.html index 8f1b76f7..49a507fd 100644 --- a/verto/tests/assets/image-container/file_width_value_no_units_html_template.html +++ b/verto/tests/assets/image-container/file_width_value_no_units_html_template.html @@ -1,5 +1,6 @@
alt text +alt text +

This is why we can't have nice things.

+
diff --git a/verto/tests/assets/image-container/hover_true_not_provided.md b/verto/tests/assets/image-container/hover_true_not_provided.md new file mode 100644 index 00000000..e027f644 --- /dev/null +++ b/verto/tests/assets/image-container/hover_true_not_provided.md @@ -0,0 +1,5 @@ +{image alt="alt text" file-path="computer-studying-turing-test.png" caption="true" alignment="center"} + +This is a caption for a computer studying the turing test. + +{image end} diff --git a/verto/tests/assets/image-container/image_in_image_tag.md b/verto/tests/assets/image-container/image_in_image_tag.md index c269d275..5a812862 100644 --- a/verto/tests/assets/image-container/image_in_image_tag.md +++ b/verto/tests/assets/image-container/image_in_image_tag.md @@ -1,6 +1,6 @@ -{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} +{image alt="ducks" file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} -{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" alignment="left"} +{image alt="dogs" file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" alignment="left"} This is the second caption. diff --git a/verto/tests/assets/image-container/image_in_numbered_list.md b/verto/tests/assets/image-container/image_in_numbered_list.md index 45f94c35..f06c3f94 100644 --- a/verto/tests/assets/image-container/image_in_numbered_list.md +++ b/verto/tests/assets/image-container/image_in_numbered_list.md @@ -6,7 +6,7 @@ 2. Lorem - {image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} + {image alt="ducks" file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} Placeholder image diff --git a/verto/tests/assets/image-container/image_in_numbered_list_expected.html b/verto/tests/assets/image-container/image_in_numbered_list_expected.html index 9fbd62f1..d85fd530 100644 --- a/verto/tests/assets/image-container/image_in_numbered_list_expected.html +++ b/verto/tests/assets/image-container/image_in_numbered_list_expected.html @@ -10,7 +10,7 @@
  • Lorem

    - +ducks

    Placeholder image

    Source

    diff --git a/verto/tests/assets/image-container/missing_alt_parameter.md b/verto/tests/assets/image-container/missing_alt_parameter.md new file mode 100644 index 00000000..1c1a7d71 --- /dev/null +++ b/verto/tests/assets/image-container/missing_alt_parameter.md @@ -0,0 +1,5 @@ +{image file-path="computer-studying-turing-test.png" caption="true"} + +This is the caption text. + +{image end} \ No newline at end of file diff --git a/verto/tests/assets/image-container/missing_file_path.md b/verto/tests/assets/image-container/missing_file_path.md new file mode 100644 index 00000000..ec60d734 --- /dev/null +++ b/verto/tests/assets/image-container/missing_file_path.md @@ -0,0 +1,5 @@ +Some text before. + +{image caption="false" alignment="center"} + +Some text after. diff --git a/verto/tests/assets/image-container/multiple_images_captions_true.md b/verto/tests/assets/image-container/multiple_images_captions_true.md index 4efba9f4..3921fe4b 100644 --- a/verto/tests/assets/image-container/multiple_images_captions_true.md +++ b/verto/tests/assets/image-container/multiple_images_captions_true.md @@ -1,6 +1,6 @@ Imagine we have the following simple black and white image. -{image file-path="the-first-image.png" caption="true"} +{image file-path="the-first-image.png" alt="Alt text for an image" caption="true"} This is the first caption. diff --git a/verto/tests/assets/image-container/multiple_images_captions_true_expected.html b/verto/tests/assets/image-container/multiple_images_captions_true_expected.html index 209044bf..243b6e5a 100644 --- a/verto/tests/assets/image-container/multiple_images_captions_true_expected.html +++ b/verto/tests/assets/image-container/multiple_images_captions_true_expected.html @@ -1,6 +1,6 @@

    Imagine we have the following simple black and white image.

    - +Alt text for an image

    This is the first caption.

    diff --git a/verto/tests/assets/image-inline/alt_false.md b/verto/tests/assets/image-inline/alt_false.md new file mode 100644 index 00000000..b026c2d8 --- /dev/null +++ b/verto/tests/assets/image-inline/alt_false.md @@ -0,0 +1 @@ +An inline image: {image-inline file-path="img/example.png"}. diff --git a/verto/tests/assets/image-inline/alt_false_expected.html b/verto/tests/assets/image-inline/alt_false_expected.html new file mode 100644 index 00000000..5889401f --- /dev/null +++ b/verto/tests/assets/image-inline/alt_false_expected.html @@ -0,0 +1,3 @@ +

    An inline image:

    + +
    .

    diff --git a/verto/tests/assets/image-inline/alt_false_source_true.md b/verto/tests/assets/image-inline/alt_false_source_true.md new file mode 100644 index 00000000..4cb2e33d --- /dev/null +++ b/verto/tests/assets/image-inline/alt_false_source_true.md @@ -0,0 +1 @@ +An inline image: {image-inline source="website.com" file-path="img/example.png"}. diff --git a/verto/tests/assets/image-inline/alt_false_source_true_expected.html b/verto/tests/assets/image-inline/alt_false_source_true_expected.html new file mode 100644 index 00000000..b7660e4c --- /dev/null +++ b/verto/tests/assets/image-inline/alt_false_source_true_expected.html @@ -0,0 +1,4 @@ +

    An inline image:

    + +

    Source

    +
    .

    diff --git a/verto/tests/assets/image-inline/argument_alt_expected.html b/verto/tests/assets/image-inline/argument_alt_expected.html deleted file mode 100644 index cd24ec04..00000000 --- a/verto/tests/assets/image-inline/argument_alt_expected.html +++ /dev/null @@ -1,3 +0,0 @@ -

    An inline image:

    -Lipsum -
    .

    diff --git a/verto/tests/assets/image-inline/argument_caption.md b/verto/tests/assets/image-inline/argument_caption.md index 79ddbbed..29d60962 100644 --- a/verto/tests/assets/image-inline/argument_caption.md +++ b/verto/tests/assets/image-inline/argument_caption.md @@ -1 +1 @@ -An inline image: {image-inline file-path="http://placehold.it/350x150" caption="Lipsum Lorem"}. +An inline image: {image-inline file-path="http://placehold.it/350x150" alt="alt text" caption="Lipsum Lorem"}. diff --git a/verto/tests/assets/image-inline/argument_caption_expected.html b/verto/tests/assets/image-inline/argument_caption_expected.html index 4ce5ee90..0ac71dfc 100644 --- a/verto/tests/assets/image-inline/argument_caption_expected.html +++ b/verto/tests/assets/image-inline/argument_caption_expected.html @@ -1,4 +1,4 @@

    An inline image:

    - +alt text

    Lipsum Lorem

    .

    diff --git a/verto/tests/assets/image-inline/argument_caption_link.md b/verto/tests/assets/image-inline/argument_caption_link.md index 49b3a6f3..e2e528ee 100644 --- a/verto/tests/assets/image-inline/argument_caption_link.md +++ b/verto/tests/assets/image-inline/argument_caption_link.md @@ -1 +1 @@ -An inline image: {image-inline file-path="http://placehold.it/350x150" caption="Lipsum Lorem" caption-link="http://www.example.com"}. +An inline image: {image-inline alt="alt text" file-path="http://placehold.it/350x150" caption="Lipsum Lorem" caption-link="http://www.example.com"}. diff --git a/verto/tests/assets/image-inline/argument_caption_link_expected.html b/verto/tests/assets/image-inline/argument_caption_link_expected.html index 518067a8..14fc74bd 100644 --- a/verto/tests/assets/image-inline/argument_caption_link_expected.html +++ b/verto/tests/assets/image-inline/argument_caption_link_expected.html @@ -1,4 +1,4 @@

    An inline image:

    .

    diff --git a/verto/tests/assets/image-inline/argument_hover_text.md b/verto/tests/assets/image-inline/argument_hover_text.md index e9f7c1f2..c2610454 100644 --- a/verto/tests/assets/image-inline/argument_hover_text.md +++ b/verto/tests/assets/image-inline/argument_hover_text.md @@ -1 +1 @@ -An inline image: {image-inline file-path="http://placehold.it/350x150" hover-text="Lipsum Lorem"}. +An inline image: {image-inline alt="alt text" file-path="http://placehold.it/350x150" hover-text="Lipsum Lorem"}. diff --git a/verto/tests/assets/image-inline/argument_hover_text_expected.html b/verto/tests/assets/image-inline/argument_hover_text_expected.html index a1ee85e3..93499ef7 100644 --- a/verto/tests/assets/image-inline/argument_hover_text_expected.html +++ b/verto/tests/assets/image-inline/argument_hover_text_expected.html @@ -1,3 +1,3 @@

    An inline image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/argument_source_link.md b/verto/tests/assets/image-inline/argument_source_link.md index e4ab1fe3..f9aa9324 100644 --- a/verto/tests/assets/image-inline/argument_source_link.md +++ b/verto/tests/assets/image-inline/argument_source_link.md @@ -1 +1 @@ -An inline image: {image-inline file-path="http://placehold.it/350x150" source="http://www.example.com"}. +An inline image: {image-inline file-path="http://placehold.it/350x150" alt="alt text" source="http://www.example.com"}. diff --git a/verto/tests/assets/image-inline/argument_source_link_expected.html b/verto/tests/assets/image-inline/argument_source_link_expected.html index 2b48541c..299356e8 100644 --- a/verto/tests/assets/image-inline/argument_source_link_expected.html +++ b/verto/tests/assets/image-inline/argument_source_link_expected.html @@ -1,4 +1,4 @@

    An inline image:

    - +alt text

    Source

    .

    diff --git a/verto/tests/assets/image-inline/doc_example_2_override_html.md b/verto/tests/assets/image-inline/doc_example_2_override_html.md index 1dd140e3..015bcc3b 100644 --- a/verto/tests/assets/image-inline/doc_example_2_override_html.md +++ b/verto/tests/assets/image-inline/doc_example_2_override_html.md @@ -1 +1 @@ -An inline image: {image-inline file-path="path/to/image@500px.png"}. +An inline image: {image-inline alt="alt text" file-path="path/to/image@500px.png"}. diff --git a/verto/tests/assets/image-inline/doc_example_basic_usage.md b/verto/tests/assets/image-inline/doc_example_basic_usage.md index b026c2d8..568de38c 100644 --- a/verto/tests/assets/image-inline/doc_example_basic_usage.md +++ b/verto/tests/assets/image-inline/doc_example_basic_usage.md @@ -1 +1 @@ -An inline image: {image-inline file-path="img/example.png"}. +An inline image: {image-inline alt="alt text" file-path="img/example.png"}. diff --git a/verto/tests/assets/image-inline/doc_example_basic_usage_expected.html b/verto/tests/assets/image-inline/doc_example_basic_usage_expected.html index 5889401f..7d759e42 100644 --- a/verto/tests/assets/image-inline/doc_example_basic_usage_expected.html +++ b/verto/tests/assets/image-inline/doc_example_basic_usage_expected.html @@ -1,3 +1,3 @@

    An inline image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/doc_example_override_html.md b/verto/tests/assets/image-inline/doc_example_override_html.md index f1fe58dd..7b89f7cd 100644 --- a/verto/tests/assets/image-inline/doc_example_override_html.md +++ b/verto/tests/assets/image-inline/doc_example_override_html.md @@ -1 +1 @@ -An inline image: {image-inline file-path="http://placehold.it/350x150" caption="Placeholder image" source="https://placehold.it/"}. +An inline image: {image-inline alt="alt text" file-path="http://placehold.it/350x150" caption="Placeholder image" source="https://placehold.it/"}. diff --git a/verto/tests/assets/image-inline/doc_example_override_html_expected.html b/verto/tests/assets/image-inline/doc_example_override_html_expected.html index 74e3ca2a..a958f675 100644 --- a/verto/tests/assets/image-inline/doc_example_override_html_expected.html +++ b/verto/tests/assets/image-inline/doc_example_override_html_expected.html @@ -1,3 +1,3 @@

    An inline image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/doc_example_override_html_template.html b/verto/tests/assets/image-inline/doc_example_override_html_template.html index 28028df8..12ec513c 100644 --- a/verto/tests/assets/image-inline/doc_example_override_html_template.html +++ b/verto/tests/assets/image-inline/doc_example_override_html_template.html @@ -1,3 +1,3 @@
    - +{{ alt }}
    diff --git a/verto/tests/assets/image-inline/external_image.md b/verto/tests/assets/image-inline/external_image.md index 6e542791..a94a8a87 100644 --- a/verto/tests/assets/image-inline/external_image.md +++ b/verto/tests/assets/image-inline/external_image.md @@ -1 +1 @@ -An external image: {image-inline file-path="http://placehold.it/350x150"}. +An external image: {image-inline alt="alt text" file-path="http://placehold.it/350x150"}. diff --git a/verto/tests/assets/image-inline/external_image_expected.html b/verto/tests/assets/image-inline/external_image_expected.html index 331d87ca..6ec2e360 100644 --- a/verto/tests/assets/image-inline/external_image_expected.html +++ b/verto/tests/assets/image-inline/external_image_expected.html @@ -1,3 +1,3 @@

    An external image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/file_invalid_width_value_1.md b/verto/tests/assets/image-inline/file_invalid_width_value_1.md index 2b3edb48..dc79375e 100644 --- a/verto/tests/assets/image-inline/file_invalid_width_value_1.md +++ b/verto/tests/assets/image-inline/file_invalid_width_value_1.md @@ -1 +1 @@ -An inline image: {image-inline file-path="path/to/image@.png"}. +An inline image: {image-inline alt="alt text" file-path="path/to/image@.png"}. diff --git a/verto/tests/assets/image-inline/file_invalid_width_value_1_expected.html b/verto/tests/assets/image-inline/file_invalid_width_value_1_expected.html index 4fe1428f..6b52c77e 100644 --- a/verto/tests/assets/image-inline/file_invalid_width_value_1_expected.html +++ b/verto/tests/assets/image-inline/file_invalid_width_value_1_expected.html @@ -1,3 +1,3 @@

    An inline image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/file_invalid_width_value_2.md b/verto/tests/assets/image-inline/file_invalid_width_value_2.md index e04fc1e1..1c551c0f 100644 --- a/verto/tests/assets/image-inline/file_invalid_width_value_2.md +++ b/verto/tests/assets/image-inline/file_invalid_width_value_2.md @@ -1 +1 @@ -An inline image: {image-inline file-path="path/to/image@em20.png"}. +An inline image: {image-inline alt="alt text" file-path="path/to/image@em20.png"}. diff --git a/verto/tests/assets/image-inline/file_invalid_width_value_2_expected.html b/verto/tests/assets/image-inline/file_invalid_width_value_2_expected.html index a4bf5d06..bddd800d 100644 --- a/verto/tests/assets/image-inline/file_invalid_width_value_2_expected.html +++ b/verto/tests/assets/image-inline/file_invalid_width_value_2_expected.html @@ -1,3 +1,3 @@

    An inline image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/file_width_value.md b/verto/tests/assets/image-inline/file_width_value.md index 1dd140e3..015bcc3b 100644 --- a/verto/tests/assets/image-inline/file_width_value.md +++ b/verto/tests/assets/image-inline/file_width_value.md @@ -1 +1 @@ -An inline image: {image-inline file-path="path/to/image@500px.png"}. +An inline image: {image-inline alt="alt text" file-path="path/to/image@500px.png"}. diff --git a/verto/tests/assets/image-inline/file_width_value_expected.html b/verto/tests/assets/image-inline/file_width_value_expected.html index 6e3cd862..a0b01db8 100644 --- a/verto/tests/assets/image-inline/file_width_value_expected.html +++ b/verto/tests/assets/image-inline/file_width_value_expected.html @@ -1,3 +1,3 @@

    An inline image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/file_width_value_external_image.md b/verto/tests/assets/image-inline/file_width_value_external_image.md index fdeda0a1..b19997d5 100644 --- a/verto/tests/assets/image-inline/file_width_value_external_image.md +++ b/verto/tests/assets/image-inline/file_width_value_external_image.md @@ -1 +1 @@ -An inline image: {image-inline file-path="https://www.verto.io/images/image@200px.png"}. +An inline image: {image-inline alt="alt text" file-path="https://www.verto.io/images/image@200px.png"}. diff --git a/verto/tests/assets/image-inline/file_width_value_external_image_expected.html b/verto/tests/assets/image-inline/file_width_value_external_image_expected.html index 2ceca220..f254979b 100644 --- a/verto/tests/assets/image-inline/file_width_value_external_image_expected.html +++ b/verto/tests/assets/image-inline/file_width_value_external_image_expected.html @@ -1,3 +1,3 @@

    An inline image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/file_width_value_html_template.html b/verto/tests/assets/image-inline/file_width_value_html_template.html index 73d9a88f..cd4e6dac 100644 --- a/verto/tests/assets/image-inline/file_width_value_html_template.html +++ b/verto/tests/assets/image-inline/file_width_value_html_template.html @@ -1,5 +1,6 @@
    alt textAn inline image:
    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/file_width_value_no_units_html_template.html b/verto/tests/assets/image-inline/file_width_value_no_units_html_template.html index 73d9a88f..cd4e6dac 100644 --- a/verto/tests/assets/image-inline/file_width_value_no_units_html_template.html +++ b/verto/tests/assets/image-inline/file_width_value_no_units_html_template.html @@ -1,5 +1,6 @@
    alt textAn inline image:
    +alt text +
    .

    diff --git a/verto/tests/assets/image-inline/hover_true_not_provided.md b/verto/tests/assets/image-inline/hover_true_not_provided.md new file mode 100644 index 00000000..568de38c --- /dev/null +++ b/verto/tests/assets/image-inline/hover_true_not_provided.md @@ -0,0 +1 @@ +An inline image: {image-inline alt="alt text" file-path="img/example.png"}. diff --git a/verto/tests/assets/image-inline/internal_image.md b/verto/tests/assets/image-inline/internal_image.md index 9b87edd6..df76fdb4 100644 --- a/verto/tests/assets/image-inline/internal_image.md +++ b/verto/tests/assets/image-inline/internal_image.md @@ -1 +1 @@ -An internal image: {image-inline file-path="img/example.png"}. +An internal image: {image-inline alt="alt text" file-path="img/example.png"}. diff --git a/verto/tests/assets/image-inline/internal_image_expected.html b/verto/tests/assets/image-inline/internal_image_expected.html index 39561c40..f52d6329 100644 --- a/verto/tests/assets/image-inline/internal_image_expected.html +++ b/verto/tests/assets/image-inline/internal_image_expected.html @@ -1,3 +1,3 @@

    An internal image:

    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/argument_alt.md b/verto/tests/assets/image-inline/missing_argument_alt.md similarity index 74% rename from verto/tests/assets/image-inline/argument_alt.md rename to verto/tests/assets/image-inline/missing_argument_alt.md index c5bbcae0..9506de51 100644 --- a/verto/tests/assets/image-inline/argument_alt.md +++ b/verto/tests/assets/image-inline/missing_argument_alt.md @@ -1 +1 @@ -An inline image: {image-inline file-path="http://placehold.it/350x150" alt="Lipsum"}. +An inline image: {image-inline file-path="http://placehold.it/350x150"}. diff --git a/verto/tests/assets/image-inline/multiple_internal_images.md b/verto/tests/assets/image-inline/multiple_internal_images.md index 6b2e9495..e2db0421 100644 --- a/verto/tests/assets/image-inline/multiple_internal_images.md +++ b/verto/tests/assets/image-inline/multiple_internal_images.md @@ -1 +1 @@ -An internal image: {image-inline file-path="img/example.png"} and some other related image {image-inline file-path="img/placeholder.jpg"}. +An internal image: {image-inline alt="alt text" file-path="img/example.png"} and some other related image {image-inline alt="alt text" file-path="img/placeholder.jpg"}. diff --git a/verto/tests/assets/image-inline/multiple_internal_images_expected.html b/verto/tests/assets/image-inline/multiple_internal_images_expected.html index a4d96d7b..e304cada 100644 --- a/verto/tests/assets/image-inline/multiple_internal_images_expected.html +++ b/verto/tests/assets/image-inline/multiple_internal_images_expected.html @@ -1,5 +1,5 @@

    An internal image:

    - +alt text
    and some other related image
    - +alt text
    .

    diff --git a/verto/tests/assets/image-inline/numbered_list.md b/verto/tests/assets/image-inline/numbered_list.md index 86ade6c2..ac6621a2 100644 --- a/verto/tests/assets/image-inline/numbered_list.md +++ b/verto/tests/assets/image-inline/numbered_list.md @@ -4,6 +4,6 @@ * Ni * San -2. Lorem {image-inline file-path="http://placehold.it/350x150" caption="Placeholder image" source="https://placehold.it/" hover-text="This is hover text"} +2. Lorem {image-inline alt="alt text" file-path="http://placehold.it/350x150" caption="Placeholder image" source="https://placehold.it/" hover-text="This is hover text"} 3. Ipsem diff --git a/verto/tests/assets/image-inline/numbered_list_expected.html b/verto/tests/assets/image-inline/numbered_list_expected.html index d93521fd..62573ad1 100644 --- a/verto/tests/assets/image-inline/numbered_list_expected.html +++ b/verto/tests/assets/image-inline/numbered_list_expected.html @@ -9,7 +9,7 @@
  • Lorem

    - +alt text

    Placeholder image

    Source

    diff --git a/verto/tests/assets/image-inline/table_embed.md b/verto/tests/assets/image-inline/table_embed.md index 62912681..7a5b1baf 100644 --- a/verto/tests/assets/image-inline/table_embed.md +++ b/verto/tests/assets/image-inline/table_embed.md @@ -1,4 +1,4 @@ -| Input | Output | -| ----- | ------------------------------------------- | -| 31 | {image-inline file-path="img/example1.png"} | -| 11 | {image-inline file-path="img/example2.png"} | +| Input | Output | +| ----- | ---------------------------------------------------------- | +| 31 | {image-inline alt="alt text" file-path="img/example1.png"} | +| 11 | {image-inline alt="alt text" file-path="img/example2.png"} | diff --git a/verto/tests/assets/image-inline/table_embed_expected.html b/verto/tests/assets/image-inline/table_embed_expected.html index 7054919e..c91fc530 100644 --- a/verto/tests/assets/image-inline/table_embed_expected.html +++ b/verto/tests/assets/image-inline/table_embed_expected.html @@ -10,7 +10,7 @@ 31
    - +alt text
    @@ -18,7 +18,7 @@ 11
    - +alt text
    diff --git a/verto/tests/assets/image-tag/align_center.md b/verto/tests/assets/image-tag/align_center.md index d4e15401..131181af 100644 --- a/verto/tests/assets/image-tag/align_center.md +++ b/verto/tests/assets/image-tag/align_center.md @@ -1,5 +1,5 @@ Some text before. -{image file-path="computer-studying-turing-test.png" caption="false" alignment="center"} +{image file-path="computer-studying-turing-test.png" alt="placeholder image" caption="false" alignment="center"} Some text after. diff --git a/verto/tests/assets/image-tag/align_center_expected.html b/verto/tests/assets/image-tag/align_center_expected.html index d25639fb..083104d0 100644 --- a/verto/tests/assets/image-tag/align_center_expected.html +++ b/verto/tests/assets/image-tag/align_center_expected.html @@ -1,5 +1,5 @@

    Some text before.

    - +placeholder image

    Some text after.

    diff --git a/verto/tests/assets/image-tag/align_left.md b/verto/tests/assets/image-tag/align_left.md index c0d65c2f..738364cf 100644 --- a/verto/tests/assets/image-tag/align_left.md +++ b/verto/tests/assets/image-tag/align_left.md @@ -1 +1 @@ -{image file-path="computer-studying-turing-test.png" alignment="left"} +{image alt="placeholder image" file-path="computer-studying-turing-test.png" alignment="left"} diff --git a/verto/tests/assets/image-tag/align_left_expected.html b/verto/tests/assets/image-tag/align_left_expected.html index 3b7d79f1..d75c15e4 100644 --- a/verto/tests/assets/image-tag/align_left_expected.html +++ b/verto/tests/assets/image-tag/align_left_expected.html @@ -1,3 +1,3 @@
    - +placeholder image
    diff --git a/verto/tests/assets/image-tag/align_right.md b/verto/tests/assets/image-tag/align_right.md index 6fc50a4a..eb18da69 100644 --- a/verto/tests/assets/image-tag/align_right.md +++ b/verto/tests/assets/image-tag/align_right.md @@ -1 +1 @@ -{image file-path="computer-studying-turing-test.png" alignment="right"} +{image file-path="computer-studying-turing-test.png" alt="placeholder image" alignment="right"} diff --git a/verto/tests/assets/image-tag/align_right_expected.html b/verto/tests/assets/image-tag/align_right_expected.html index 6f88c4ca..8ef59fba 100644 --- a/verto/tests/assets/image-tag/align_right_expected.html +++ b/verto/tests/assets/image-tag/align_right_expected.html @@ -1,3 +1,3 @@
    - +placeholder image
    diff --git a/verto/tests/assets/image-tag/align_undefined_error.md b/verto/tests/assets/image-tag/align_undefined_error.md index d8d24505..7be59d44 100644 --- a/verto/tests/assets/image-tag/align_undefined_error.md +++ b/verto/tests/assets/image-tag/align_undefined_error.md @@ -1 +1 @@ -{image file-path="computer-studying-turing-test.png" alignment="around-about-here"} +{image file-path="computer-studying-turing-test.png" alignment="around-about-here" alt="placeholder image"} diff --git a/verto/tests/assets/image-tag/alt_false.md b/verto/tests/assets/image-tag/alt_false.md new file mode 100644 index 00000000..8eb8cc27 --- /dev/null +++ b/verto/tests/assets/image-tag/alt_false.md @@ -0,0 +1,5 @@ +Imagine we have the following simple black and white image. + +{image file-path="pixel-diamond.png"} + +One very simple way a computer can store this image in binary is by using a format where '0' means white and '1' means black (this is a "bit map", because we've mapped the pixels onto the values of bits). Using this method, the above image would be represented in the following way: diff --git a/verto/tests/assets/image-tag/alt_false_expected.html b/verto/tests/assets/image-tag/alt_false_expected.html new file mode 100644 index 00000000..255ba843 --- /dev/null +++ b/verto/tests/assets/image-tag/alt_false_expected.html @@ -0,0 +1,5 @@ +

    Imagine we have the following simple black and white image.

    +
    + +
    +

    One very simple way a computer can store this image in binary is by using a format where '0' means white and '1' means black (this is a "bit map", because we've mapped the pixels onto the values of bits). Using this method, the above image would be represented in the following way:

    diff --git a/verto/tests/assets/image-tag/alt_false_source_true.md b/verto/tests/assets/image-tag/alt_false_source_true.md new file mode 100644 index 00000000..e9171c61 --- /dev/null +++ b/verto/tests/assets/image-tag/alt_false_source_true.md @@ -0,0 +1,11 @@ +Here's another FSA to consider: + +{image file-path="finite-state-automata-no-trap-example.png" hover-text="hover text is me" source="example.com"} + +It's fairly clear what it will accept: strings like "ab", "abab", "abababababab", and, of course {math}\epsilon{math end}. +But there are some missing transitions: if you are in state 1 and get a "b" there's nowhere to go. +If an input cannot be accepted, it will be rejected, as in this case. We could have put in a trap state to make this clear: + +{image file-path="finite-state-automata-trap-added-example.png" source="example.com" hover-text="also some hover text"} + +But things can get out of hand. What if there are more letters in the alphabet? We'd need something like this: diff --git a/verto/tests/assets/image-tag/alt_false_source_true_expected.html b/verto/tests/assets/image-tag/alt_false_source_true_expected.html new file mode 100644 index 00000000..03d22a40 --- /dev/null +++ b/verto/tests/assets/image-tag/alt_false_source_true_expected.html @@ -0,0 +1,13 @@ +

    Here's another FSA to consider:

    +
    + +

    Source

    +
    +

    It's fairly clear what it will accept: strings like "ab", "abab", "abababababab", and, of course {math}\epsilon{math end}. +But there are some missing transitions: if you are in state 1 and get a "b" there's nowhere to go. +If an input cannot be accepted, it will be rejected, as in this case. We could have put in a trap state to make this clear:

    +
    + +

    Source

    +
    +

    But things can get out of hand. What if there are more letters in the alphabet? We'd need something like this:

    diff --git a/verto/tests/assets/image-tag/contains_alt.md b/verto/tests/assets/image-tag/contains_alt.md deleted file mode 100644 index ee2fd7ee..00000000 --- a/verto/tests/assets/image-tag/contains_alt.md +++ /dev/null @@ -1,3 +0,0 @@ -{image file-path="computer-studying-turing-test.png" alt="Lipsum"} - -Some text after. diff --git a/verto/tests/assets/image-tag/contains_alt_expected.html b/verto/tests/assets/image-tag/contains_alt_expected.html deleted file mode 100644 index 52ddc6b3..00000000 --- a/verto/tests/assets/image-tag/contains_alt_expected.html +++ /dev/null @@ -1,4 +0,0 @@ -
    -Lipsum -
    -

    Some text after.

    diff --git a/verto/tests/assets/image-tag/contains_hover_text.md b/verto/tests/assets/image-tag/contains_hover_text.md index b5c9bc76..59eb1acb 100644 --- a/verto/tests/assets/image-tag/contains_hover_text.md +++ b/verto/tests/assets/image-tag/contains_hover_text.md @@ -1,3 +1,3 @@ Some text before. -{image file-path="computer-studying-turing-test.png" hover-text="Lipsum"} +{image file-path="computer-studying-turing-test.png" hover-text="Lipsum" alt="placeholder image"} diff --git a/verto/tests/assets/image-tag/contains_hover_text_expected.html b/verto/tests/assets/image-tag/contains_hover_text_expected.html index 7b64b2c0..3287e46d 100644 --- a/verto/tests/assets/image-tag/contains_hover_text_expected.html +++ b/verto/tests/assets/image-tag/contains_hover_text_expected.html @@ -1,4 +1,4 @@

    Some text before.

    - +placeholder image
    diff --git a/verto/tests/assets/image-tag/contains_source.md b/verto/tests/assets/image-tag/contains_source.md index a87b3c4d..2a84bd32 100644 --- a/verto/tests/assets/image-tag/contains_source.md +++ b/verto/tests/assets/image-tag/contains_source.md @@ -1,3 +1,3 @@ So it goes... -{image caption="false" file-path="computer-studying-turing-test.png" source="example.com"} +{image caption="false" file-path="computer-studying-turing-test.png" alt="placeholder image" source="example.com"} diff --git a/verto/tests/assets/image-tag/contains_source_expected.html b/verto/tests/assets/image-tag/contains_source_expected.html index e12ecea6..a0a19d9c 100644 --- a/verto/tests/assets/image-tag/contains_source_expected.html +++ b/verto/tests/assets/image-tag/contains_source_expected.html @@ -1,5 +1,5 @@

    So it goes...

    - +placeholder image

    Source

    diff --git a/verto/tests/assets/image-tag/doc_example_2_override_html.md b/verto/tests/assets/image-tag/doc_example_2_override_html.md index d6818613..4428e4ff 100644 --- a/verto/tests/assets/image-tag/doc_example_2_override_html.md +++ b/verto/tests/assets/image-tag/doc_example_2_override_html.md @@ -1 +1 @@ -{image file-path="path/to/image@500px.png"} +{image alt="placeholder image" file-path="path/to/image@500px.png"} diff --git a/verto/tests/assets/image-tag/doc_example_2_override_html_expected.html b/verto/tests/assets/image-tag/doc_example_2_override_html_expected.html index 9e55150c..be5d1659 100644 --- a/verto/tests/assets/image-tag/doc_example_2_override_html_expected.html +++ b/verto/tests/assets/image-tag/doc_example_2_override_html_expected.html @@ -1 +1 @@ - +placeholder image diff --git a/verto/tests/assets/image-tag/doc_example_2_override_html_template.html b/verto/tests/assets/image-tag/doc_example_2_override_html_template.html index a1343960..07a4fbc8 100644 --- a/verto/tests/assets/image-tag/doc_example_2_override_html_template.html +++ b/verto/tests/assets/image-tag/doc_example_2_override_html_template.html @@ -1,4 +1,4 @@ -placeholder image - +placeholder image

    Source

    diff --git a/verto/tests/assets/image-tag/doc_example_override_html.md b/verto/tests/assets/image-tag/doc_example_override_html.md index 17eb6ef7..ab7d539f 100644 --- a/verto/tests/assets/image-tag/doc_example_override_html.md +++ b/verto/tests/assets/image-tag/doc_example_override_html.md @@ -1 +1 @@ -{image file-path="http://placehold.it/350x150" source="https://placehold.it/"} +{image alt="dogs" file-path="http://placehold.it/350x150" alt="placeholder image" source="https://placehold.it/"} diff --git a/verto/tests/assets/image-tag/doc_example_override_html_expected.html b/verto/tests/assets/image-tag/doc_example_override_html_expected.html index 11846fa6..a2a18547 100644 --- a/verto/tests/assets/image-tag/doc_example_override_html_expected.html +++ b/verto/tests/assets/image-tag/doc_example_override_html_expected.html @@ -1,3 +1,3 @@
    - +placeholder image
    diff --git a/verto/tests/assets/image-tag/doc_example_override_html_template.html b/verto/tests/assets/image-tag/doc_example_override_html_template.html index 28028df8..98bf2b3b 100644 --- a/verto/tests/assets/image-tag/doc_example_override_html_template.html +++ b/verto/tests/assets/image-tag/doc_example_override_html_template.html @@ -1,3 +1,3 @@
    - +placeholder image
    diff --git a/verto/tests/assets/image-tag/file_invalid_width_value_1.md b/verto/tests/assets/image-tag/file_invalid_width_value_1.md index a3dbce88..08eedb77 100644 --- a/verto/tests/assets/image-tag/file_invalid_width_value_1.md +++ b/verto/tests/assets/image-tag/file_invalid_width_value_1.md @@ -1 +1 @@ -{image file-path="path/to/image@.png"} +{image alt="image alt text" file-path="path/to/image@.png"} diff --git a/verto/tests/assets/image-tag/file_invalid_width_value_1_expected.html b/verto/tests/assets/image-tag/file_invalid_width_value_1_expected.html index e66fe9be..0024f343 100644 --- a/verto/tests/assets/image-tag/file_invalid_width_value_1_expected.html +++ b/verto/tests/assets/image-tag/file_invalid_width_value_1_expected.html @@ -1 +1 @@ - +image alt text diff --git a/verto/tests/assets/image-tag/file_invalid_width_value_1_html_template.html b/verto/tests/assets/image-tag/file_invalid_width_value_1_html_template.html index a1343960..ebec4dcb 100644 --- a/verto/tests/assets/image-tag/file_invalid_width_value_1_html_template.html +++ b/verto/tests/assets/image-tag/file_invalid_width_value_1_html_template.html @@ -1,4 +1,4 @@ -image alt text +image alt text diff --git a/verto/tests/assets/image-tag/file_invalid_width_value_2_html_template.html b/verto/tests/assets/image-tag/file_invalid_width_value_2_html_template.html index a1343960..ebec4dcb 100644 --- a/verto/tests/assets/image-tag/file_invalid_width_value_2_html_template.html +++ b/verto/tests/assets/image-tag/file_invalid_width_value_2_html_template.html @@ -1,4 +1,4 @@ -image alt text +image alt text diff --git a/verto/tests/assets/image-tag/file_width_value_external_image.md b/verto/tests/assets/image-tag/file_width_value_external_image.md index a4e7e4c6..4a2ac5b2 100644 --- a/verto/tests/assets/image-tag/file_width_value_external_image.md +++ b/verto/tests/assets/image-tag/file_width_value_external_image.md @@ -1 +1 @@ -{image file-path="https://www.verto.io/images/image@200px.png"} +{image alt="text" file-path="https://www.verto.io/images/image@200px.png"} diff --git a/verto/tests/assets/image-tag/file_width_value_external_image_expected.html b/verto/tests/assets/image-tag/file_width_value_external_image_expected.html index bf1003ff..b6bfa196 100644 --- a/verto/tests/assets/image-tag/file_width_value_external_image_expected.html +++ b/verto/tests/assets/image-tag/file_width_value_external_image_expected.html @@ -1 +1 @@ - +text diff --git a/verto/tests/assets/image-tag/file_width_value_external_image_html_template.html b/verto/tests/assets/image-tag/file_width_value_external_image_html_template.html index a1343960..41e5c544 100644 --- a/verto/tests/assets/image-tag/file_width_value_external_image_html_template.html +++ b/verto/tests/assets/image-tag/file_width_value_external_image_html_template.html @@ -1,4 +1,4 @@ -text +alt text diff --git a/verto/tests/assets/image-tag/file_width_value_no_units_html_template.html b/verto/tests/assets/image-tag/file_width_value_no_units_html_template.html index a1343960..6af6c930 100644 --- a/verto/tests/assets/image-tag/file_width_value_no_units_html_template.html +++ b/verto/tests/assets/image-tag/file_width_value_no_units_html_template.html @@ -1,4 +1,4 @@ -alt text +alt text + diff --git a/verto/tests/assets/image-tag/hover_true_not_provided.md b/verto/tests/assets/image-tag/hover_true_not_provided.md new file mode 100644 index 00000000..7105c8fe --- /dev/null +++ b/verto/tests/assets/image-tag/hover_true_not_provided.md @@ -0,0 +1 @@ +{image alt="alt text" file-path="computer-studying-turing-test.png" caption="false" alignment="center"} diff --git a/verto/tests/assets/image-tag/image_in_numbered_list.md b/verto/tests/assets/image-tag/image_in_numbered_list.md index 3d5a7b33..a8dd663b 100644 --- a/verto/tests/assets/image-tag/image_in_numbered_list.md +++ b/verto/tests/assets/image-tag/image_in_numbered_list.md @@ -6,6 +6,6 @@ 2. Lorem - {image file-path="http://placehold.it/350x150" caption="false" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} + {image alt="numbered list" file-path="http://placehold.it/350x150" caption="false" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} 3. Ipsem diff --git a/verto/tests/assets/image-tag/image_in_numbered_list_expected.html b/verto/tests/assets/image-tag/image_in_numbered_list_expected.html index 15072345..df546305 100644 --- a/verto/tests/assets/image-tag/image_in_numbered_list_expected.html +++ b/verto/tests/assets/image-tag/image_in_numbered_list_expected.html @@ -10,7 +10,7 @@
  • Lorem

    - +numbered list

    Source

  • diff --git a/verto/tests/assets/image-tag/missing_alt_parameter.md b/verto/tests/assets/image-tag/missing_alt_parameter.md new file mode 100644 index 00000000..2be8e999 --- /dev/null +++ b/verto/tests/assets/image-tag/missing_alt_parameter.md @@ -0,0 +1,3 @@ +{image file-path="computer-studying-turing-test.png"} + +Some text after. diff --git a/verto/tests/assets/image-tag/missing_file_path.md b/verto/tests/assets/image-tag/missing_file_path.md new file mode 100644 index 00000000..ec60d734 --- /dev/null +++ b/verto/tests/assets/image-tag/missing_file_path.md @@ -0,0 +1,5 @@ +Some text before. + +{image caption="false" alignment="center"} + +Some text after. diff --git a/verto/tests/assets/image-tag/multiple_images_captions_false.md b/verto/tests/assets/image-tag/multiple_images_captions_false.md index 3f90c160..4397a812 100644 --- a/verto/tests/assets/image-tag/multiple_images_captions_false.md +++ b/verto/tests/assets/image-tag/multiple_images_captions_false.md @@ -1,6 +1,6 @@ Imagine we have the following simple black and white image. -{image file-path="the-first-image.png" caption="false"} +{image file-path="the-first-image.png" caption="false" alt="alt text"} {image file-path="Lipsum.png" caption="false" alt="A diamond shape made out of pixels"} diff --git a/verto/tests/assets/image-tag/multiple_images_captions_false_expected.html b/verto/tests/assets/image-tag/multiple_images_captions_false_expected.html index 31c9eeab..7e7a46b4 100644 --- a/verto/tests/assets/image-tag/multiple_images_captions_false_expected.html +++ b/verto/tests/assets/image-tag/multiple_images_captions_false_expected.html @@ -1,6 +1,6 @@

    Imagine we have the following simple black and white image.

    - +alt text
    A diamond shape made out of pixels diff --git a/verto/tests/assets/image-tag/multiple_images_captions_true_expected.html b/verto/tests/assets/image-tag/multiple_images_captions_true_expected.html index 671e74c9..8fa494d3 100644 --- a/verto/tests/assets/image-tag/multiple_images_captions_true_expected.html +++ b/verto/tests/assets/image-tag/multiple_images_captions_true_expected.html @@ -1,6 +1,6 @@

    Imagine we have the following simple black and white image.

    - +the alt text
    A diamond shape made out of pixels diff --git a/verto/tests/assets/interactive-container/doc_example_override_html.md b/verto/tests/assets/interactive-container/doc_example_override_html.md new file mode 100644 index 00000000..9355eb43 --- /dev/null +++ b/verto/tests/assets/interactive-container/doc_example_override_html.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="true"} + +Binary Cards Interactive + +{interactive end} diff --git a/verto/tests/assets/interactive-container/doc_example_override_html_expected.html b/verto/tests/assets/interactive-container/doc_example_override_html_expected.html new file mode 100644 index 00000000..fb071360 --- /dev/null +++ b/verto/tests/assets/interactive-container/doc_example_override_html_expected.html @@ -0,0 +1,5 @@ + +
    +Binary Cards Interactive +
    +
    diff --git a/verto/tests/assets/interactive/doc_example_override_html_template.html b/verto/tests/assets/interactive-container/doc_example_override_html_template.html similarity index 66% rename from verto/tests/assets/interactive/doc_example_override_html_template.html rename to verto/tests/assets/interactive-container/doc_example_override_html_template.html index 868a4a3f..701edf7e 100644 --- a/verto/tests/assets/interactive/doc_example_override_html_template.html +++ b/verto/tests/assets/interactive-container/doc_example_override_html_template.html @@ -1,20 +1,20 @@ {% if type == 'in-page' -%}
    -{{ "{{% include 'interactive/" }}{{ name }}{{ "/index.html' %}}" }} +{{ "{{% include 'interactive/" }}{{ slug }}{{ "/index.html' %}}" }}
    {% elif type == 'iframe' -%} - {% elif type == 'whole-page' -%}
    {% if text -%} {{ text }} {% else -%} -Click to load {{ name }} +Click to load {{ slug }} {% endif -%}
    diff --git a/verto/tests/assets/interactive-container/doc_example_whole_page_usage.md b/verto/tests/assets/interactive-container/doc_example_whole_page_usage.md new file mode 100644 index 00000000..af3e23c7 --- /dev/null +++ b/verto/tests/assets/interactive-container/doc_example_whole_page_usage.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" text="true"} + +Binary Cards Interactive + +{interactive end} diff --git a/verto/tests/assets/interactive/doc_example_whole_page_usage_expected.html b/verto/tests/assets/interactive-container/doc_example_whole_page_usage_expected.html similarity index 62% rename from verto/tests/assets/interactive/doc_example_whole_page_usage_expected.html rename to verto/tests/assets/interactive-container/doc_example_whole_page_usage_expected.html index 95f3ccb5..fea9ee9c 100644 --- a/verto/tests/assets/interactive/doc_example_whole_page_usage_expected.html +++ b/verto/tests/assets/interactive-container/doc_example_whole_page_usage_expected.html @@ -1,4 +1,4 @@ - +
    Binary Cards Interactive diff --git a/verto/tests/assets/interactive-container/iframe.md b/verto/tests/assets/interactive-container/iframe.md new file mode 100644 index 00000000..e06b0837 --- /dev/null +++ b/verto/tests/assets/interactive-container/iframe.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"} diff --git a/verto/tests/assets/interactive-container/iframe_expected.html b/verto/tests/assets/interactive-container/iframe_expected.html new file mode 100644 index 00000000..daa8f4b3 --- /dev/null +++ b/verto/tests/assets/interactive-container/iframe_expected.html @@ -0,0 +1 @@ +

    {interactive slug="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"}

    diff --git a/verto/tests/assets/interactive-container/interactive_in_interactive_tag.md b/verto/tests/assets/interactive-container/interactive_in_interactive_tag.md new file mode 100644 index 00000000..5340594c --- /dev/null +++ b/verto/tests/assets/interactive-container/interactive_in_interactive_tag.md @@ -0,0 +1,9 @@ +Is it cool that I said all that + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="true"} + +{interactive slug="arrows" text="false" type="iframe" parameters="digits=5&start=BBBBB"} + +{interactive end} + +Is it too soon to do this yet diff --git a/verto/tests/assets/interactive-container/invalid_type.md b/verto/tests/assets/interactive-container/invalid_type.md new file mode 100644 index 00000000..e4d783a2 --- /dev/null +++ b/verto/tests/assets/interactive-container/invalid_type.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" type="not-a-real-type" parameters="digits=5&start=BBBBB" text="true"} + +Just like sand it slips through your hands + +{interactive end} diff --git a/verto/tests/assets/interactive-container/missing_type.md b/verto/tests/assets/interactive-container/missing_type.md new file mode 100644 index 00000000..6de7d3b0 --- /dev/null +++ b/verto/tests/assets/interactive-container/missing_type.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" parameters="digits=5&start=BBBBB" text="true"} + +And you're not invisibile + +{interactive end} diff --git a/verto/tests/assets/interactive-container/multiple_interactives.md b/verto/tests/assets/interactive-container/multiple_interactives.md new file mode 100644 index 00000000..b636c63c --- /dev/null +++ b/verto/tests/assets/interactive-container/multiple_interactives.md @@ -0,0 +1,15 @@ +{interactive slug="arrows" type="whole-page" text="true"} + +The text. + +{interactive end} + +And some more text again. + +{interactive slug="flying-boxes" type="whole-page" text="true"} + +the text. + +{interactive end} + +Aaaaaaaaaaaaaaaannnnnd here's some more. diff --git a/verto/tests/assets/interactive-container/multiple_interactives_expected.html b/verto/tests/assets/interactive-container/multiple_interactives_expected.html new file mode 100644 index 00000000..f04cd09f --- /dev/null +++ b/verto/tests/assets/interactive-container/multiple_interactives_expected.html @@ -0,0 +1,12 @@ +
    + +
    +The text. +
    +

    And some more text again.

    + + +
    +the text. +
    +

    Aaaaaaaaaaaaaaaannnnnd here's some more.

    diff --git a/verto/tests/assets/interactive-container/multiple_interactives_some_text.md b/verto/tests/assets/interactive-container/multiple_interactives_some_text.md new file mode 100644 index 00000000..c6d3cd9c --- /dev/null +++ b/verto/tests/assets/interactive-container/multiple_interactives_some_text.md @@ -0,0 +1,23 @@ +I'd kiss you as the lights went out + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="true"} + +Swaying as the room burned down + +{interactive end} + +I'd hold you as the water rushes in + +{interactive slug="arrows" text="false" type="iframe" parameters="digits=5&start=BBBBB"} + +I'd kiss you as the lights went out + +{interactive slug="flying-boxes" type="in-page"} + +I'd hold you as the water rushes in + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"} + +I'd kiss you as the lights went out + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="false"} diff --git a/verto/tests/assets/interactive-container/multiple_interactives_some_text_expected.html b/verto/tests/assets/interactive-container/multiple_interactives_some_text_expected.html new file mode 100644 index 00000000..50a37315 --- /dev/null +++ b/verto/tests/assets/interactive-container/multiple_interactives_some_text_expected.html @@ -0,0 +1,14 @@ +

    I'd kiss you as the lights went out

    + + +
    +Swaying as the room burned down +
    +

    I'd hold you as the water rushes in

    +

    {interactive slug="arrows" text="false" type="iframe" parameters="digits=5&start=BBBBB"}

    +

    I'd kiss you as the lights went out

    +

    {interactive slug="flying-boxes" type="in-page"}

    +

    I'd hold you as the water rushes in

    +

    {interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"}

    +

    I'd kiss you as the lights went out

    +

    {interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="false"}

    diff --git a/verto/tests/assets/interactive-container/multiple_interactives_text_true.md b/verto/tests/assets/interactive-container/multiple_interactives_text_true.md new file mode 100644 index 00000000..85b4e749 --- /dev/null +++ b/verto/tests/assets/interactive-container/multiple_interactives_text_true.md @@ -0,0 +1,25 @@ +I'd kiss you as the lights went out + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="true"} + +Swaying as the room burned down + +{interactive end} + +I'd hold you as the water rushes in + +{interactive slug="arrows" text="true" type="whole-page" parameters="digits=5&start=BBBBB"} + +If I could dance with you again + +{interactive end} + +I'd kiss you as the lights went out + +{interactive text="true" slug="flying-boxes" type="whole-page"} + +Swaying as the room burned down + +{interactive end} + +I'd hold you as the water rushes in diff --git a/verto/tests/assets/interactive-container/multiple_interactives_text_true_expected.html b/verto/tests/assets/interactive-container/multiple_interactives_text_true_expected.html new file mode 100644 index 00000000..4f403584 --- /dev/null +++ b/verto/tests/assets/interactive-container/multiple_interactives_text_true_expected.html @@ -0,0 +1,19 @@ +

    I'd kiss you as the lights went out

    + + +
    +Swaying as the room burned down +
    +

    I'd hold you as the water rushes in

    + + +
    +If I could dance with you again +
    +

    I'd kiss you as the lights went out

    + + +
    +Swaying as the room burned down +
    +

    I'd hold you as the water rushes in

    diff --git a/verto/tests/assets/interactive-container/no_text.md b/verto/tests/assets/interactive-container/no_text.md new file mode 100644 index 00000000..a11a41da --- /dev/null +++ b/verto/tests/assets/interactive-container/no_text.md @@ -0,0 +1,5 @@ +See you in the dark + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB"} + +All eyes on you my magician diff --git a/verto/tests/assets/interactive-container/no_text_expected.html b/verto/tests/assets/interactive-container/no_text_expected.html new file mode 100644 index 00000000..6696871a --- /dev/null +++ b/verto/tests/assets/interactive-container/no_text_expected.html @@ -0,0 +1,3 @@ +

    See you in the dark

    +

    {interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB"}

    +

    All eyes on you my magician

    diff --git a/verto/tests/assets/interactive-container/parameters_and_thumbnail_true.md b/verto/tests/assets/interactive-container/parameters_and_thumbnail_true.md new file mode 100644 index 00000000..51fb2c2d --- /dev/null +++ b/verto/tests/assets/interactive-container/parameters_and_thumbnail_true.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" thumbnail="cats.png" type="whole-page" parameters="digits=5&start=BBBBB" text="true"} + +Binary Cards Interactive + +{interactive end} diff --git a/verto/tests/assets/interactive-container/parameters_and_thumbnail_true_expected.html b/verto/tests/assets/interactive-container/parameters_and_thumbnail_true_expected.html new file mode 100644 index 00000000..7d9b069b --- /dev/null +++ b/verto/tests/assets/interactive-container/parameters_and_thumbnail_true_expected.html @@ -0,0 +1,6 @@ + + +
    +Binary Cards Interactive +
    +
    diff --git a/verto/tests/assets/interactive-container/parameters_true.md b/verto/tests/assets/interactive-container/parameters_true.md new file mode 100644 index 00000000..af3e23c7 --- /dev/null +++ b/verto/tests/assets/interactive-container/parameters_true.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" text="true"} + +Binary Cards Interactive + +{interactive end} diff --git a/verto/tests/assets/interactive/whole_page_text_expected.html b/verto/tests/assets/interactive-container/parameters_true_expected.html similarity index 62% rename from verto/tests/assets/interactive/whole_page_text_expected.html rename to verto/tests/assets/interactive-container/parameters_true_expected.html index 0b462722..fea9ee9c 100644 --- a/verto/tests/assets/interactive/whole_page_text_expected.html +++ b/verto/tests/assets/interactive-container/parameters_true_expected.html @@ -1,4 +1,4 @@ - +
    Binary Cards Interactive diff --git a/verto/tests/assets/interactive-container/text_false.md b/verto/tests/assets/interactive-container/text_false.md new file mode 100644 index 00000000..f9bfcf2d --- /dev/null +++ b/verto/tests/assets/interactive-container/text_false.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" text="false"} diff --git a/verto/tests/assets/interactive-container/text_false_expected.html b/verto/tests/assets/interactive-container/text_false_expected.html new file mode 100644 index 00000000..1e50edeb --- /dev/null +++ b/verto/tests/assets/interactive-container/text_false_expected.html @@ -0,0 +1 @@ +

    {interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" text="false"}

    diff --git a/verto/tests/assets/interactive-container/text_true_missing_end_tag.md b/verto/tests/assets/interactive-container/text_true_missing_end_tag.md new file mode 100644 index 00000000..f89d928b --- /dev/null +++ b/verto/tests/assets/interactive-container/text_true_missing_end_tag.md @@ -0,0 +1,7 @@ +you said there was nothing in the world that could stop it + +{interactive slug="binary-cards" type="whole-page" text="true" thumbnail="interactives/binary-cards/img/binarycards.png"} + +I had a bad feeling + +And darling... diff --git a/verto/tests/assets/interactive-container/text_true_not_provided.md b/verto/tests/assets/interactive-container/text_true_not_provided.md new file mode 100644 index 00000000..3a8107c3 --- /dev/null +++ b/verto/tests/assets/interactive-container/text_true_not_provided.md @@ -0,0 +1,7 @@ +I, I loved you in secret. + +{interactive slug="binary-cards" type="whole-page" text="true" thumbnail="interactives/binary-cards/img/binarycards.png"} + +{interactive end} + +First sight, yea, we love without reason. diff --git a/verto/tests/assets/interactive-container/thumbnail_true.md b/verto/tests/assets/interactive-container/thumbnail_true.md new file mode 100644 index 00000000..ab3f74a1 --- /dev/null +++ b/verto/tests/assets/interactive-container/thumbnail_true.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" type="whole-page" thumbnail="interactives/binary-cards/img/binarycards.png" text="true"} + +There is an indentation in the shape of you + +{interactive end} diff --git a/verto/tests/assets/interactive/doc_example_override_thumbnail_html_expected.html b/verto/tests/assets/interactive-container/thumbnail_true_expected.html similarity index 54% rename from verto/tests/assets/interactive/doc_example_override_thumbnail_html_expected.html rename to verto/tests/assets/interactive-container/thumbnail_true_expected.html index b0fbc0aa..263dd49c 100644 --- a/verto/tests/assets/interactive/doc_example_override_thumbnail_html_expected.html +++ b/verto/tests/assets/interactive-container/thumbnail_true_expected.html @@ -1,6 +1,6 @@ -
    +
    -Binary Cards Interactive +There is an indentation in the shape of you
    diff --git a/verto/tests/assets/interactive-container/whole_page_external_thumbnail.md b/verto/tests/assets/interactive-container/whole_page_external_thumbnail.md new file mode 100644 index 00000000..18747d6e --- /dev/null +++ b/verto/tests/assets/interactive-container/whole_page_external_thumbnail.md @@ -0,0 +1,5 @@ +{interactive text="true" slug="binary-cards" type="whole-page" thumbnail="http://totallylegit/filepath/foran/image.png"} + +Binary Cards + +{interactive end} diff --git a/verto/tests/assets/interactive/whole_page_external_thumbnail_expected.html b/verto/tests/assets/interactive-container/whole_page_external_thumbnail_expected.html similarity index 56% rename from verto/tests/assets/interactive/whole_page_external_thumbnail_expected.html rename to verto/tests/assets/interactive-container/whole_page_external_thumbnail_expected.html index 1807afee..87326cdd 100644 --- a/verto/tests/assets/interactive/whole_page_external_thumbnail_expected.html +++ b/verto/tests/assets/interactive-container/whole_page_external_thumbnail_expected.html @@ -1,6 +1,6 @@ - +
    -Click to load binary-cards +Binary Cards
    diff --git a/verto/tests/assets/interactive-container/whole_page_parameters.md b/verto/tests/assets/interactive-container/whole_page_parameters.md new file mode 100644 index 00000000..af3e23c7 --- /dev/null +++ b/verto/tests/assets/interactive-container/whole_page_parameters.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" text="true"} + +Binary Cards Interactive + +{interactive end} diff --git a/verto/tests/assets/interactive/whole_page_parameters_expected.html b/verto/tests/assets/interactive-container/whole_page_parameters_expected.html similarity index 62% rename from verto/tests/assets/interactive/whole_page_parameters_expected.html rename to verto/tests/assets/interactive-container/whole_page_parameters_expected.html index 95f3ccb5..fea9ee9c 100644 --- a/verto/tests/assets/interactive/whole_page_parameters_expected.html +++ b/verto/tests/assets/interactive-container/whole_page_parameters_expected.html @@ -1,4 +1,4 @@ - +
    Binary Cards Interactive diff --git a/verto/tests/assets/interactive-container/whole_page_thumbnail.md b/verto/tests/assets/interactive-container/whole_page_thumbnail.md new file mode 100644 index 00000000..ab3f74a1 --- /dev/null +++ b/verto/tests/assets/interactive-container/whole_page_thumbnail.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" type="whole-page" thumbnail="interactives/binary-cards/img/binarycards.png" text="true"} + +There is an indentation in the shape of you + +{interactive end} diff --git a/verto/tests/assets/interactive-container/whole_page_thumbnail_expected.html b/verto/tests/assets/interactive-container/whole_page_thumbnail_expected.html new file mode 100644 index 00000000..263dd49c --- /dev/null +++ b/verto/tests/assets/interactive-container/whole_page_thumbnail_expected.html @@ -0,0 +1,6 @@ + + +
    +There is an indentation in the shape of you +
    +
    diff --git a/verto/tests/assets/interactive-container/whole_page_thumbnail_parameters.md b/verto/tests/assets/interactive-container/whole_page_thumbnail_parameters.md new file mode 100644 index 00000000..da9c0472 --- /dev/null +++ b/verto/tests/assets/interactive-container/whole_page_thumbnail_parameters.md @@ -0,0 +1,7 @@ +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="true"} + +All of this silence and patience, pining and desperately waiting + +{interactive end} + +My hands are shaking from holding back from all this diff --git a/verto/tests/assets/interactive-container/whole_page_thumbnail_parameters_expected.html b/verto/tests/assets/interactive-container/whole_page_thumbnail_parameters_expected.html new file mode 100644 index 00000000..e67a8d55 --- /dev/null +++ b/verto/tests/assets/interactive-container/whole_page_thumbnail_parameters_expected.html @@ -0,0 +1,6 @@ + + +
    +All of this silence and patience, pining and desperately waiting +
    +

    My hands are shaking from holding back from all this

    diff --git a/verto/tests/assets/interactive-tag/doc_example_iframe_usage.md b/verto/tests/assets/interactive-tag/doc_example_iframe_usage.md new file mode 100644 index 00000000..e06b0837 --- /dev/null +++ b/verto/tests/assets/interactive-tag/doc_example_iframe_usage.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"} diff --git a/verto/tests/assets/interactive/doc_example_iframe_usage_expected.html b/verto/tests/assets/interactive-tag/doc_example_iframe_usage_expected.html similarity index 54% rename from verto/tests/assets/interactive/doc_example_iframe_usage_expected.html rename to verto/tests/assets/interactive-tag/doc_example_iframe_usage_expected.html index 8e04ad3a..25f235b0 100644 --- a/verto/tests/assets/interactive/doc_example_iframe_usage_expected.html +++ b/verto/tests/assets/interactive-tag/doc_example_iframe_usage_expected.html @@ -1,3 +1,3 @@ - diff --git a/verto/tests/assets/interactive-tag/doc_example_in_page_usage.md b/verto/tests/assets/interactive-tag/doc_example_in_page_usage.md new file mode 100644 index 00000000..bc4f421a --- /dev/null +++ b/verto/tests/assets/interactive-tag/doc_example_in_page_usage.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="in-page"} diff --git a/verto/tests/assets/interactive/doc_example_in_page_usage_expected.html b/verto/tests/assets/interactive-tag/doc_example_in_page_usage_expected.html similarity index 100% rename from verto/tests/assets/interactive/doc_example_in_page_usage_expected.html rename to verto/tests/assets/interactive-tag/doc_example_in_page_usage_expected.html diff --git a/verto/tests/assets/interactive-tag/doc_example_override_html.md b/verto/tests/assets/interactive-tag/doc_example_override_html.md new file mode 100644 index 00000000..33681e40 --- /dev/null +++ b/verto/tests/assets/interactive-tag/doc_example_override_html.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"} diff --git a/verto/tests/assets/interactive-tag/doc_example_override_html_expected.html b/verto/tests/assets/interactive-tag/doc_example_override_html_expected.html new file mode 100644 index 00000000..ae503f6b --- /dev/null +++ b/verto/tests/assets/interactive-tag/doc_example_override_html_expected.html @@ -0,0 +1,5 @@ + +
    +load binary-cards +
    +
    diff --git a/verto/tests/assets/interactive-tag/doc_example_override_html_template.html b/verto/tests/assets/interactive-tag/doc_example_override_html_template.html new file mode 100644 index 00000000..d711f3e9 --- /dev/null +++ b/verto/tests/assets/interactive-tag/doc_example_override_html_template.html @@ -0,0 +1,21 @@ +{% if type == 'in-page' -%} +
    +{{ "{{% include 'interactive/" }}{{ slug }}{{ "/index.html' %}}" }} +
    +{% elif type == 'iframe' -%} + +{% elif type == 'whole-page' -%} + +
    +{% if text -%} +{{ text }} +{% else -%} +load {{ slug }} +{% endif -%} +
    +
    +{%- endif -%} diff --git a/verto/tests/assets/interactive-tag/iframe_parameters.md b/verto/tests/assets/interactive-tag/iframe_parameters.md new file mode 100644 index 00000000..e06b0837 --- /dev/null +++ b/verto/tests/assets/interactive-tag/iframe_parameters.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"} diff --git a/verto/tests/assets/interactive/iframe_parameters_expected.html b/verto/tests/assets/interactive-tag/iframe_parameters_expected.html similarity index 54% rename from verto/tests/assets/interactive/iframe_parameters_expected.html rename to verto/tests/assets/interactive-tag/iframe_parameters_expected.html index 8e04ad3a..25f235b0 100644 --- a/verto/tests/assets/interactive/iframe_parameters_expected.html +++ b/verto/tests/assets/interactive-tag/iframe_parameters_expected.html @@ -1,3 +1,3 @@ - diff --git a/verto/tests/assets/interactive/in_page_missing_name.md b/verto/tests/assets/interactive-tag/in_page_missing_name.md similarity index 100% rename from verto/tests/assets/interactive/in_page_missing_name.md rename to verto/tests/assets/interactive-tag/in_page_missing_name.md diff --git a/verto/tests/assets/interactive/in_page_missing_name_expected.html b/verto/tests/assets/interactive-tag/in_page_missing_name_expected.html similarity index 100% rename from verto/tests/assets/interactive/in_page_missing_name_expected.html rename to verto/tests/assets/interactive-tag/in_page_missing_name_expected.html diff --git a/verto/tests/assets/interactive-tag/invalid_type.md b/verto/tests/assets/interactive-tag/invalid_type.md new file mode 100644 index 00000000..62b2d6d2 --- /dev/null +++ b/verto/tests/assets/interactive-tag/invalid_type.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="not-a-real-type" parameters="digits=5&start=BBBBB" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive-tag/missing_type.md b/verto/tests/assets/interactive-tag/missing_type.md new file mode 100644 index 00000000..7efd0ef9 --- /dev/null +++ b/verto/tests/assets/interactive-tag/missing_type.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" parameters="digits=5&start=BBBBB" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/multiple_interactives.md b/verto/tests/assets/interactive-tag/multiple_interactives.md similarity index 50% rename from verto/tests/assets/interactive/multiple_interactives.md rename to verto/tests/assets/interactive-tag/multiple_interactives.md index 955b5bb0..45d248a1 100644 --- a/verto/tests/assets/interactive/multiple_interactives.md +++ b/verto/tests/assets/interactive-tag/multiple_interactives.md @@ -1,13 +1,13 @@ This is some text. -{interactive name="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"} +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"} This is some more text. -{interactive name="arrows" type="iframe" parameters="digits=5&start=BBBBB"} +{interactive slug="arrows" type="iframe" parameters="digits=5&start=BBBBB"} And some more text again. -{interactive name="flying-boxes" type="in-page"} +{interactive slug="flying-boxes" type="in-page"} Aaaaaaaaaaaaaaaannnnnd here's some more. diff --git a/verto/tests/assets/interactive/multiple_interactives_expected.html b/verto/tests/assets/interactive-tag/multiple_interactives_expected.html similarity index 70% rename from verto/tests/assets/interactive/multiple_interactives_expected.html rename to verto/tests/assets/interactive-tag/multiple_interactives_expected.html index e3982ef8..fe8c70a2 100644 --- a/verto/tests/assets/interactive/multiple_interactives_expected.html +++ b/verto/tests/assets/interactive-tag/multiple_interactives_expected.html @@ -1,11 +1,11 @@

    This is some text.

    - +
    Click to load binary-cards

    This is some more text.

    -

    And some more text again.

    diff --git a/verto/tests/assets/interactive-tag/parameters_and_thumbnail_true.md b/verto/tests/assets/interactive-tag/parameters_and_thumbnail_true.md new file mode 100644 index 00000000..8b4daaa8 --- /dev/null +++ b/verto/tests/assets/interactive-tag/parameters_and_thumbnail_true.md @@ -0,0 +1,5 @@ +This is some text. + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"} + +This is some more text. diff --git a/verto/tests/assets/interactive-tag/parameters_and_thumbnail_true_expected.html b/verto/tests/assets/interactive-tag/parameters_and_thumbnail_true_expected.html new file mode 100644 index 00000000..909d282a --- /dev/null +++ b/verto/tests/assets/interactive-tag/parameters_and_thumbnail_true_expected.html @@ -0,0 +1,7 @@ +

    This is some text.

    + + +
    +Click to load binary-cards +
    +

    This is some more text.

    diff --git a/verto/tests/assets/interactive-tag/parameters_true.md b/verto/tests/assets/interactive-tag/parameters_true.md new file mode 100644 index 00000000..8b4daaa8 --- /dev/null +++ b/verto/tests/assets/interactive-tag/parameters_true.md @@ -0,0 +1,5 @@ +This is some text. + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"} + +This is some more text. diff --git a/verto/tests/assets/interactive-tag/parameters_true_expected.html b/verto/tests/assets/interactive-tag/parameters_true_expected.html new file mode 100644 index 00000000..909d282a --- /dev/null +++ b/verto/tests/assets/interactive-tag/parameters_true_expected.html @@ -0,0 +1,7 @@ +

    This is some text.

    + + +
    +Click to load binary-cards +
    +

    This is some more text.

    diff --git a/verto/tests/assets/interactive-tag/thumbnail_true.md b/verto/tests/assets/interactive-tag/thumbnail_true.md new file mode 100644 index 00000000..8b4daaa8 --- /dev/null +++ b/verto/tests/assets/interactive-tag/thumbnail_true.md @@ -0,0 +1,5 @@ +This is some text. + +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"} + +This is some more text. diff --git a/verto/tests/assets/interactive-tag/thumbnail_true_expected.html b/verto/tests/assets/interactive-tag/thumbnail_true_expected.html new file mode 100644 index 00000000..909d282a --- /dev/null +++ b/verto/tests/assets/interactive-tag/thumbnail_true_expected.html @@ -0,0 +1,7 @@ +

    This is some text.

    + + +
    +Click to load binary-cards +
    +

    This is some more text.

    diff --git a/verto/tests/assets/interactive-tag/whole_page_text.md b/verto/tests/assets/interactive-tag/whole_page_text.md new file mode 100644 index 00000000..d4c6daf2 --- /dev/null +++ b/verto/tests/assets/interactive-tag/whole_page_text.md @@ -0,0 +1,5 @@ +{interactive slug="binary-cards" type="whole-page" text="true"} + +Binary Cards Interactive + +{interactive end} diff --git a/verto/tests/assets/interactive-tag/whole_page_text_expected.html b/verto/tests/assets/interactive-tag/whole_page_text_expected.html new file mode 100644 index 00000000..d58577bb --- /dev/null +++ b/verto/tests/assets/interactive-tag/whole_page_text_expected.html @@ -0,0 +1,3 @@ +

    {interactive slug="binary-cards" type="whole-page" text="true"}

    +

    Binary Cards Interactive

    +

    {interactive end}

    diff --git a/verto/tests/assets/interactive/doc_example_iframe_usage.md b/verto/tests/assets/interactive/doc_example_iframe_usage.md deleted file mode 100644 index 44ec3458..00000000 --- a/verto/tests/assets/interactive/doc_example_iframe_usage.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"} diff --git a/verto/tests/assets/interactive/doc_example_in_page_usage.md b/verto/tests/assets/interactive/doc_example_in_page_usage.md deleted file mode 100644 index f796c9a9..00000000 --- a/verto/tests/assets/interactive/doc_example_in_page_usage.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="in-page"} diff --git a/verto/tests/assets/interactive/doc_example_override_html.md b/verto/tests/assets/interactive/doc_example_override_html.md deleted file mode 100644 index 4179a11b..00000000 --- a/verto/tests/assets/interactive/doc_example_override_html.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/doc_example_override_html_expected.html b/verto/tests/assets/interactive/doc_example_override_html_expected.html deleted file mode 100644 index 579c2fb4..00000000 --- a/verto/tests/assets/interactive/doc_example_override_html_expected.html +++ /dev/null @@ -1,5 +0,0 @@ - -
    -Binary Cards Interactive -
    -
    diff --git a/verto/tests/assets/interactive/doc_example_override_thumbnail_html.md b/verto/tests/assets/interactive/doc_example_override_thumbnail_html.md deleted file mode 100644 index 4179a11b..00000000 --- a/verto/tests/assets/interactive/doc_example_override_thumbnail_html.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/doc_example_thumbnail_path_html_template.html b/verto/tests/assets/interactive/doc_example_thumbnail_path_html_template.html deleted file mode 100644 index 5d399d19..00000000 --- a/verto/tests/assets/interactive/doc_example_thumbnail_path_html_template.html +++ /dev/null @@ -1,3 +0,0 @@ -{% autoescape false -%} -{{ "{% static '" }}interactives/{{ name }}/img/{{ file_path }}{{ "' %}" }} -{%- endautoescape %} diff --git a/verto/tests/assets/interactive/doc_example_whole_page_usage.md b/verto/tests/assets/interactive/doc_example_whole_page_usage.md deleted file mode 100644 index 7d26cc23..00000000 --- a/verto/tests/assets/interactive/doc_example_whole_page_usage.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/iframe_parameters.md b/verto/tests/assets/interactive/iframe_parameters.md deleted file mode 100644 index 44ec3458..00000000 --- a/verto/tests/assets/interactive/iframe_parameters.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="iframe" parameters="digits=5&start=BBBBB"} diff --git a/verto/tests/assets/interactive/invalid_type.md b/verto/tests/assets/interactive/invalid_type.md deleted file mode 100644 index 2d4abe99..00000000 --- a/verto/tests/assets/interactive/invalid_type.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="not-a-real-type" parameters="digits=5&start=BBBBB" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/missing_type.md b/verto/tests/assets/interactive/missing_type.md deleted file mode 100644 index 3d561427..00000000 --- a/verto/tests/assets/interactive/missing_type.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" parameters="digits=5&start=BBBBB" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/parameters_true.md b/verto/tests/assets/interactive/parameters_true.md new file mode 100644 index 00000000..aa820f2d --- /dev/null +++ b/verto/tests/assets/interactive/parameters_true.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/parameters_true_expected.html b/verto/tests/assets/interactive/parameters_true_expected.html new file mode 100644 index 00000000..fea9ee9c --- /dev/null +++ b/verto/tests/assets/interactive/parameters_true_expected.html @@ -0,0 +1,6 @@ + + +
    +Binary Cards Interactive +
    +
    diff --git a/verto/tests/assets/interactive/subtitle_true.md b/verto/tests/assets/interactive/subtitle_true.md new file mode 100644 index 00000000..68119833 --- /dev/null +++ b/verto/tests/assets/interactive/subtitle_true.md @@ -0,0 +1,9 @@ +{panel type="note" subtitle="true"} + +# Heading + +## Subtitle + +This panel does have a subtitle! + +{panel end} diff --git a/verto/tests/assets/interactive/text_and_thumbnail_true.md b/verto/tests/assets/interactive/text_and_thumbnail_true.md new file mode 100644 index 00000000..e82bd8f7 --- /dev/null +++ b/verto/tests/assets/interactive/text_and_thumbnail_true.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="whole-page" text="cats" thumbnail="interactives/binary-cards/img/binarycards.png"} diff --git a/verto/tests/assets/interactive/text_and_thumbnail_true_expected.html b/verto/tests/assets/interactive/text_and_thumbnail_true_expected.html new file mode 100644 index 00000000..fe1a17a5 --- /dev/null +++ b/verto/tests/assets/interactive/text_and_thumbnail_true_expected.html @@ -0,0 +1,6 @@ + + +
    +cats +
    +
    diff --git a/verto/tests/assets/interactive/text_true.md b/verto/tests/assets/interactive/text_true.md new file mode 100644 index 00000000..e82bd8f7 --- /dev/null +++ b/verto/tests/assets/interactive/text_true.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="whole-page" text="cats" thumbnail="interactives/binary-cards/img/binarycards.png"} diff --git a/verto/tests/assets/interactive/text_true_expected.html b/verto/tests/assets/interactive/text_true_expected.html new file mode 100644 index 00000000..fe1a17a5 --- /dev/null +++ b/verto/tests/assets/interactive/text_true_expected.html @@ -0,0 +1,6 @@ + + +
    +cats +
    +
    diff --git a/verto/tests/assets/interactive/text_true_not_provided.md b/verto/tests/assets/interactive/text_true_not_provided.md new file mode 100644 index 00000000..4625c3a2 --- /dev/null +++ b/verto/tests/assets/interactive/text_true_not_provided.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="whole-page" thumbnail="interactives/binary-cards/img/binarycards.png"} diff --git a/verto/tests/assets/interactive/thumbnail_true.md b/verto/tests/assets/interactive/thumbnail_true.md new file mode 100644 index 00000000..4625c3a2 --- /dev/null +++ b/verto/tests/assets/interactive/thumbnail_true.md @@ -0,0 +1 @@ +{interactive slug="binary-cards" type="whole-page" thumbnail="interactives/binary-cards/img/binarycards.png"} diff --git a/verto/tests/assets/interactive/whole_page_thumbnail_expected.html b/verto/tests/assets/interactive/thumbnail_true_expected.html similarity index 68% rename from verto/tests/assets/interactive/whole_page_thumbnail_expected.html rename to verto/tests/assets/interactive/thumbnail_true_expected.html index f2629137..9ec659d6 100644 --- a/verto/tests/assets/interactive/whole_page_thumbnail_expected.html +++ b/verto/tests/assets/interactive/thumbnail_true_expected.html @@ -1,4 +1,4 @@ - +
    Click to load binary-cards diff --git a/verto/tests/assets/interactive/whole_page_external_thumbnail.md b/verto/tests/assets/interactive/whole_page_external_thumbnail.md deleted file mode 100644 index 5a801328..00000000 --- a/verto/tests/assets/interactive/whole_page_external_thumbnail.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="whole-page" thumbnail="http://totallylegit/filepath/foran/image.png"} diff --git a/verto/tests/assets/interactive/whole_page_parameters.md b/verto/tests/assets/interactive/whole_page_parameters.md deleted file mode 100644 index 7d26cc23..00000000 --- a/verto/tests/assets/interactive/whole_page_parameters.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/whole_page_text.md b/verto/tests/assets/interactive/whole_page_text.md deleted file mode 100644 index 5b65e430..00000000 --- a/verto/tests/assets/interactive/whole_page_text.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="whole-page" text="Binary Cards Interactive"} diff --git a/verto/tests/assets/interactive/whole_page_thumbnail.md b/verto/tests/assets/interactive/whole_page_thumbnail.md deleted file mode 100644 index 23d3459f..00000000 --- a/verto/tests/assets/interactive/whole_page_thumbnail.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="whole-page" thumbnail="interactives/binary-cards/img/binarycards.png"} diff --git a/verto/tests/assets/interactive/whole_page_thumbnail_parameters.md b/verto/tests/assets/interactive/whole_page_thumbnail_parameters.md deleted file mode 100644 index c1bd9f8c..00000000 --- a/verto/tests/assets/interactive/whole_page_thumbnail_parameters.md +++ /dev/null @@ -1 +0,0 @@ -{interactive name="binary-cards" type="whole-page" parameters="digits=5&start=BBBBB" thumbnail="binarycards.png"} diff --git a/verto/tests/assets/interactive/whole_page_thumbnail_parameters_expected.html b/verto/tests/assets/interactive/whole_page_thumbnail_parameters_expected.html deleted file mode 100644 index e5020999..00000000 --- a/verto/tests/assets/interactive/whole_page_thumbnail_parameters_expected.html +++ /dev/null @@ -1,6 +0,0 @@ - - -
    -Click to load binary-cards -
    -
    diff --git a/verto/tests/assets/panel/contains_inner_image.md b/verto/tests/assets/panel/contains_inner_image.md index 7fbdcc00..2b53aa02 100644 --- a/verto/tests/assets/panel/contains_inner_image.md +++ b/verto/tests/assets/panel/contains_inner_image.md @@ -6,7 +6,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc non accumsan libero, et suscipit velit. Phasellus quis lorem eget lacus rutrum lobortis. Integer tincidunt convallis arcu a porttitor. Ut urna sapien, egestas mollis lectus a, suscipit placerat ante. Vestibulum id congue tellus. Nullam dapibus felis eu ligula mattis, vel consectetur nibh aliquet. Maecenas nec elit orci. Curabitur ut massa maximus, ultrices diam at, porttitor erat. Praesent eu purus vitae ligula elementum iaculis in non eros. Quisque eu aliquet dolor, ut pharetra lacus. -{image file-path="http://placehold.it/350x150" caption="true" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} +{image file-path="http://placehold.it/350x150" caption="true" alt="alt text" source="https://placehold.it/" hover-text="This is hover text" alignment="left"} Placeholder image diff --git a/verto/tests/assets/panel/contains_inner_image_expected.html b/verto/tests/assets/panel/contains_inner_image_expected.html index 5b149fb3..8d621ad7 100644 --- a/verto/tests/assets/panel/contains_inner_image_expected.html +++ b/verto/tests/assets/panel/contains_inner_image_expected.html @@ -5,7 +5,7 @@

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc non accumsan libero, et suscipit velit. Phasellus quis lorem eget lacus rutrum lobortis. Integer tincidunt convallis arcu a porttitor. Ut urna sapien, egestas mollis lectus a, suscipit placerat ante. Vestibulum id congue tellus. Nullam dapibus felis eu ligula mattis, vel consectetur nibh aliquet. Maecenas nec elit orci. Curabitur ut massa maximus, ultrices diam at, porttitor erat. Praesent eu purus vitae ligula elementum iaculis in non eros. Quisque eu aliquet dolor, ut pharetra lacus.

    - +alt text

    Placeholder image

    Source

    diff --git a/verto/tests/assets/panel/expanded_true.md b/verto/tests/assets/panel/expanded_true.md new file mode 100644 index 00000000..6f56d7e9 --- /dev/null +++ b/verto/tests/assets/panel/expanded_true.md @@ -0,0 +1,9 @@ +{panel type="extra-for-experts" subtitle="true" expanded="always"} + +# Lorem ipsum + +## Nunc non accumsan + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc non accumsan libero, et suscipit velit. Phasellus quis lorem eget lacus rutrum lobortis. Integer tincidunt convallis arcu a porttitor. Ut urna sapien, egestas mollis lectus a, suscipit placerat ante. Vestibulum id congue tellus. Nullam dapibus felis eu ligula mattis, vel consectetur nibh aliquet. Maecenas nec elit orci. Curabitur ut massa maximus, ultrices diam at, porttitor erat. Praesent eu purus vitae ligula elementum iaculis in non eros. Quisque eu aliquet dolor, ut pharetra lacus. + +{panel end} diff --git a/verto/tests/assets/panel/expanded_true_expected.html b/verto/tests/assets/panel/expanded_true_expected.html new file mode 100644 index 00000000..77d01a3b --- /dev/null +++ b/verto/tests/assets/panel/expanded_true_expected.html @@ -0,0 +1,8 @@ +
    +
    +Lorem ipsum: Nunc non accumsan +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc non accumsan libero, et suscipit velit. Phasellus quis lorem eget lacus rutrum lobortis. Integer tincidunt convallis arcu a porttitor. Ut urna sapien, egestas mollis lectus a, suscipit placerat ante. Vestibulum id congue tellus. Nullam dapibus felis eu ligula mattis, vel consectetur nibh aliquet. Maecenas nec elit orci. Curabitur ut massa maximus, ultrices diam at, porttitor erat. Praesent eu purus vitae ligula elementum iaculis in non eros. Quisque eu aliquet dolor, ut pharetra lacus.

    +
    +
    diff --git a/verto/tests/assets/panel/panel_block_missing_whitespace.md b/verto/tests/assets/panel/panel_block_missing_whitespace.md new file mode 100644 index 00000000..bc921fe2 --- /dev/null +++ b/verto/tests/assets/panel/panel_block_missing_whitespace.md @@ -0,0 +1,3 @@ +This is some text. +{panel} +Some more text. diff --git a/verto/tests/assets/panel/subtitle_true.md b/verto/tests/assets/panel/subtitle_true.md new file mode 100644 index 00000000..68119833 --- /dev/null +++ b/verto/tests/assets/panel/subtitle_true.md @@ -0,0 +1,9 @@ +{panel type="note" subtitle="true"} + +# Heading + +## Subtitle + +This panel does have a subtitle! + +{panel end} diff --git a/verto/tests/assets/panel/subtitle_true_expected.html b/verto/tests/assets/panel/subtitle_true_expected.html new file mode 100644 index 00000000..92b98a7b --- /dev/null +++ b/verto/tests/assets/panel/subtitle_true_expected.html @@ -0,0 +1,8 @@ +
    +
    +Heading: Subtitle +
    +
    +

    This panel does have a subtitle!

    +
    +
    diff --git a/verto/tests/assets/panel/subtitle_true_not_provided.md b/verto/tests/assets/panel/subtitle_true_not_provided.md new file mode 100644 index 00000000..d0f5cf56 --- /dev/null +++ b/verto/tests/assets/panel/subtitle_true_not_provided.md @@ -0,0 +1,9 @@ +{panel type="extra-for-experts" expanded="always"} + +# Lorem ipsum + +## Nunc non accumsan + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc non accumsan libero, et suscipit velit. Phasellus quis lorem eget lacus rutrum lobortis. Integer tincidunt convallis arcu a porttitor. Ut urna sapien, egestas mollis lectus a, suscipit placerat ante. Vestibulum id congue tellus. Nullam dapibus felis eu ligula mattis, vel consectetur nibh aliquet. Maecenas nec elit orci. Curabitur ut massa maximus, ultrices diam at, porttitor erat. Praesent eu purus vitae ligula elementum iaculis in non eros. Quisque eu aliquet dolor, ut pharetra lacus. + +{panel end} diff --git a/verto/tests/assets/panel/type_false.md b/verto/tests/assets/panel/type_false.md new file mode 100644 index 00000000..be6c53b6 --- /dev/null +++ b/verto/tests/assets/panel/type_false.md @@ -0,0 +1,7 @@ +{panel type="note" subtitle="false"} + +# Heading + +This panel does not have a subtitle + +{panel end} diff --git a/verto/tests/assets/panel/type_false_expected.html b/verto/tests/assets/panel/type_false_expected.html new file mode 100644 index 00000000..fa59321c --- /dev/null +++ b/verto/tests/assets/panel/type_false_expected.html @@ -0,0 +1,8 @@ +
    +
    +Heading +
    +
    +

    This panel does not have a subtitle

    +
    +
    diff --git a/verto/tests/assets/smoke/algorithms.md b/verto/tests/assets/smoke/algorithms.md index a7fd564e..5abe1123 100644 --- a/verto/tests/assets/smoke/algorithms.md +++ b/verto/tests/assets/smoke/algorithms.md @@ -8,7 +8,7 @@ Every computer device you have ever used, from your school computers to your calculator, has been using algorithms to tell it how to do whatever it was doing. Algorithms are a very important topic in Computer Science because they help software developers create efficient and error free programs. The most important thing to remember about algorithms is that there can be many different algorithms for the same problem, but some are much better than others! -{interactive name="sorting-algorithm-comparison" type="in-page"} +{interactive slug="sorting-algorithm-comparison" type="in-page"} Computers are incredibly fast at manipulating, moving and looking through data. However the amount of data computers use is often so large that it doesn't matter how fast the computer is, it will take it far too long to examine every single piece of data (companies like Google, Facebook and Twitter routinely process billions of things per day, and in some cases, per minute!) This is where algorithms come in. If a computer is given a better algorithm to process the data then it doesn't matter how much information it has to look through, it will still be able to do it in a reasonable amount of time. @@ -24,7 +24,7 @@ Often you can get away with describing a process just using some sort of informa "please get me a glass of water". A human can understand what this means and can figure out how to accomplish this task by thinking, but a computer would have no idea how to do this! -{interactive name="high-score-boxes" type="whole-page" text="High Score Boxes"} +{interactive slug="high-score-boxes" type="whole-page" text="High Score Boxes"} An example in a computational context might be if you wanted to find a high score in a table of scores: go through each score keeping track of the largest so far. @@ -157,13 +157,13 @@ Searching through collections of data is something computers have to do all the Lets investigate searching with a game... -{interactive name="searching-algorithms" type="whole-page" text="Searching Boxes - Part 1" parameters="max=2"} +{interactive slug="searching-algorithms" type="whole-page" text="Searching Boxes - Part 1" parameters="max=2"} You may have noticed that the numbers on the monsters and pets in the game were in a random order, which meant that finding the pet was basically luck! You might have found it on your first try, or if you were less lucky you might have had to look inside almost all the presents before you found it. This might not seem like such a bad thing since you had enough lives to look under all the boxes, but imagine if there had been 1,000 boxes, or worse 1,000,000! It would have taken far too long to look through all the boxes and the pet might have never been found. Now this next game is slightly different. You have less lives, which makes things a bit more challenging, but this time the numbers inside the boxes will be in order. The monsters, or maybe the pet, with the smallest number is in the present on the far left, and the one with the largest number is in the present on the far right. Let's see if you can collect all the pets without running out of lives... -{interactive name="searching-algorithms" type="whole-page" text="Searching Boxes - Part 2" parameters="level=3" thumbnail="thumbnail2.png"} +{interactive slug="searching-algorithms" type="whole-page" text="Searching Boxes - Part 2" parameters="level=3" thumbnail="thumbnail2.png"} Now that you have played through the whole game (and hopefully found all of the lost pets!) you may have noticed that even though you had less lives in the second part of the game, and lots of presents to search through, you were still able to find the pet. Why was this possible? @@ -261,7 +261,7 @@ Use the scales to compare the boxes (you can only compare two boxes at a time) a If the interactive does not run properly on your computer you can use a set of physical balance scales instead; just make sure you can only tell if one box is heavier than the other, not their exact weight (so not digital scales that show the exact weight). -{interactive name="sorting-algorithms" type="whole-page" text="Scales interactive"} +{interactive slug="sorting-algorithms" type="whole-page" text="Scales interactive"} {comment} @@ -350,7 +350,7 @@ Insertion and Selection Sort may seem like logical ways to sort things into orde A much better sorting algorithm is {glossary-link term="quicksort"}Quicksort!{glossary-link end} (the name is a bit of a giveaway) -{interactive name="sorting-algorithms" type="whole-page" text="Quicksort interactive" parameters="method=quick" thumbnail="thumbnail-quick.png"} +{interactive slug="sorting-algorithms" type="whole-page" text="Quicksort interactive" parameters="method=quick" thumbnail="thumbnail-quick.png"} This algorithm is a little more complicated, but is very powerful. To do this algorithm with the sorting interactive, start by randomly choosing a box and placing it on the scales. Now compare every other box to the one you selected; heavier boxes should be put on the right of the second row and lighter boxes are put on the left. When you are done, place the box you were comparing everything else to between these two groups, but to help you keep track of things, put it in the row below. The following example shows how it might look after this step. Note that the selected block is in the right place for the final sorted order, and everything on either side will remain on the side that it is on. diff --git a/verto/tests/assets/smoke/introduction.md b/verto/tests/assets/smoke/introduction.md index c2678def..bf2f29b8 100644 --- a/verto/tests/assets/smoke/introduction.md +++ b/verto/tests/assets/smoke/introduction.md @@ -45,7 +45,7 @@ They both have the same functionality (they can do the same calculations), but w (This book has many interactives like this. If the calculators don't work properly, you may need to use a more recent browser. The interactive material in this book works in most recent browsers; Google Chrome is a particularly safe bet.) -{interactive name="awful-calculator" type="in-page"} +{interactive slug="awful-calculator" type="in-page"} The second calculator above is slower, and that can be frustrating. But it has a fancier interface --- buttons expand when you point to them to highlight what you're doing. diff --git a/verto/tests/assets/style/doc_example_block_valid_expected.html b/verto/tests/assets/style/doc_example_block_valid_expected.html new file mode 100644 index 00000000..5e780afa --- /dev/null +++ b/verto/tests/assets/style/doc_example_block_valid_expected.html @@ -0,0 +1,5 @@ +

    This is valid.

    +

    {panel}

    +

    This is valid.

    +

    {panel end}

    +

    This is valid.

    diff --git a/verto/tests/assets/style/doc_example_block_valid_in_list_expected.html b/verto/tests/assets/style/doc_example_block_valid_in_list_expected.html new file mode 100644 index 00000000..070cfbfc --- /dev/null +++ b/verto/tests/assets/style/doc_example_block_valid_in_list_expected.html @@ -0,0 +1,7 @@ +

    This is valid.

    +
      +
    1. {panel} +This is valid. +{panel end}
    2. +
    +

    This is valid.

    diff --git a/verto/tests/assets/video/contains_multiple_videos_expected.html b/verto/tests/assets/video/contains_multiple_videos_expected.html index dbf02d94..9882716d 100644 --- a/verto/tests/assets/video/contains_multiple_videos_expected.html +++ b/verto/tests/assets/video/contains_multiple_videos_expected.html @@ -1,13 +1,13 @@

    Videos

    There and back again: a packet's tale

    - +

    How does the internet work?

    - +

    How the internet works in 5 minutes

    - +
    diff --git a/verto/tests/assets/video/doc_example_basic_usage_expected.html b/verto/tests/assets/video/doc_example_basic_usage_expected.html index 0db0aa21..68ae17cb 100644 --- a/verto/tests/assets/video/doc_example_basic_usage_expected.html +++ b/verto/tests/assets/video/doc_example_basic_usage_expected.html @@ -1,3 +1,3 @@
    - +
    diff --git a/verto/tests/assets/video/doc_example_override_html_expected.html b/verto/tests/assets/video/doc_example_override_html_expected.html index 32c0429b..69f91d54 100644 --- a/verto/tests/assets/video/doc_example_override_html_expected.html +++ b/verto/tests/assets/video/doc_example_override_html_expected.html @@ -1,3 +1,3 @@
    - +
    diff --git a/verto/tests/assets/video/multiple_youtube_links_expected.html b/verto/tests/assets/video/multiple_youtube_links_expected.html index 2d452568..4e40316d 100644 --- a/verto/tests/assets/video/multiple_youtube_links_expected.html +++ b/verto/tests/assets/video/multiple_youtube_links_expected.html @@ -1,21 +1,21 @@

    Videos

    There and back again: a packet's tale

    - +

    How does the internet work?

    - +

    Totally real video

    - +

    How the internet works in 5 minutes

    - +

    It has English captions, but the most interesting part is what is happening in the action.

    - +
    diff --git a/verto/tests/assets/video/url_false.md b/verto/tests/assets/video/url_false.md new file mode 100644 index 00000000..521f459e --- /dev/null +++ b/verto/tests/assets/video/url_false.md @@ -0,0 +1,5 @@ +Engineering Disasters 13: Software Flaws + +{video} + +is an excerpt from Engineering Disaster Episode 13 explaining software flaws in Ariane 5 and Patriot Missiles diff --git a/verto/tests/assets/video/url_false_expected.html b/verto/tests/assets/video/url_false_expected.html new file mode 100644 index 00000000..c88e3d7d --- /dev/null +++ b/verto/tests/assets/video/url_false_expected.html @@ -0,0 +1,3 @@ +

    Engineering Disasters 13: Software Flaws

    +

    {video}

    +

    is an excerpt from Engineering Disaster Episode 13 explaining software flaws in Ariane 5 and Patriot Missiles

    diff --git a/verto/tests/assets/video/youtube_and_vimeo_links_expected.html b/verto/tests/assets/video/youtube_and_vimeo_links_expected.html index 708705db..5cfd9024 100644 --- a/verto/tests/assets/video/youtube_and_vimeo_links_expected.html +++ b/verto/tests/assets/video/youtube_and_vimeo_links_expected.html @@ -1,29 +1,29 @@

    Videos

    There and back again: a packet's tale

    - +

    How does the internet work?

    - +

    Totally real video

    - +

    How the internet works in 5 minutes

    - +

    It has English captions, but the most interesting part is what is happening in the action.

    - +
    diff --git a/verto/tests/assets/video/youtube_be_link_expected.html b/verto/tests/assets/video/youtube_be_link_expected.html index 48a1c01b..3c712c3e 100644 --- a/verto/tests/assets/video/youtube_be_link_expected.html +++ b/verto/tests/assets/video/youtube_be_link_expected.html @@ -1,5 +1,5 @@

    Engineering Disasters 13: Software Flaws

    - +

    is an excerpt from Engineering Disaster Episode 13 explaining software flaws in Ariane 5 and Patriot Missiles

    diff --git a/verto/tests/assets/video/youtube_embed_link.md b/verto/tests/assets/video/youtube_embed_link.md index b7605f64..ce5c0d33 100644 --- a/verto/tests/assets/video/youtube_embed_link.md +++ b/verto/tests/assets/video/youtube_embed_link.md @@ -1,6 +1,6 @@ ## Run Length Encoding -{video url="https://www.youtube.com/embed/uaV2RuAJTjQ?rel=0"} +{video url="https://www.youtube.com/embed/uaV2RuAJTjQ"} Run length encoding (RLE) is a technique that isn't so widely used these days, but it's a great way to get a feel for some of the issues around using compression. diff --git a/verto/tests/assets/video/youtube_embed_link_expected.html b/verto/tests/assets/video/youtube_embed_link_expected.html index 151447a8..d846cf76 100644 --- a/verto/tests/assets/video/youtube_embed_link_expected.html +++ b/verto/tests/assets/video/youtube_embed_link_expected.html @@ -1,6 +1,6 @@

    Run Length Encoding

    - +

    Run length encoding (RLE) is a technique that isn't so widely used these days, but it's a great way to get a feel for some of the issues around using compression.

    {panel type="teacher-note" summary="Who uses run length encoding?"}

    diff --git a/verto/tests/assets/video/youtube_watch_link_expected.html b/verto/tests/assets/video/youtube_watch_link_expected.html index 77b23ec3..4c6dde17 100644 --- a/verto/tests/assets/video/youtube_watch_link_expected.html +++ b/verto/tests/assets/video/youtube_watch_link_expected.html @@ -4,6 +4,6 @@

    The Turing Test

    {panel type="teacher-note" summary="TED video introducing the Turing Test"}

    There is a TED video that gives an overview of the Turing Test on YouTube

    - +

    {panel end}

    diff --git a/verto/tests/start_tests.py b/verto/tests/start_tests.py index eacb1c89..40645002 100644 --- a/verto/tests/start_tests.py +++ b/verto/tests/start_tests.py @@ -1,7 +1,8 @@ -import sys, unittest, optparse +import sys +import unittest +import optparse from verto.tests.ConfigurationTest import ConfigurationTest from verto.tests.SmokeTests import SmokeFileTest, SmokeDocsTest - from verto.tests.BoxedTextTest import BoxedTextTest from verto.tests.ButtonLinkTest import ButtonLinkTest from verto.tests.CommentTest import CommentTest @@ -13,7 +14,8 @@ from verto.tests.ImageTagTest import ImageTagTest from verto.tests.ImageContainerTest import ImageContainerTest from verto.tests.JinjaTest import JinjaTest -from verto.tests.InteractiveTest import InteractiveTest +from verto.tests.InteractiveTagTest import InteractiveTagTest +from verto.tests.InteractiveContainerTest import InteractiveContainerTest from verto.tests.PanelTest import PanelTest from verto.tests.RelativeLinkTest import RelativeLinkTest from verto.tests.RemoveTest import RemoveTest @@ -24,7 +26,6 @@ from verto.tests.StyleTest import StyleTest from verto.tests.TableOfContentsTest import TableOfContentsTest from verto.tests.VideoTest import VideoTest - from verto.tests.HtmlParserTest import HtmlParserTest from verto.tests.MarkdownOverrideTest import MarkdownOverrideTest @@ -34,15 +35,31 @@ def parse_args(): useful for developing when parts of verto are known to fail. ''' opts = optparse.OptionParser( - usage='Run the command `python -m verto.tests.start_tests` from the level above the verto directory.', description='Verifies that Verto is functional compared to the testing suite.') - opts.add_option('--travis', - action='store_true', help='Enables skipping suites on failure. To be used by continuous integration system.', default=False) - opts.add_option('--no_smoke', - action='store_true', help='Skips smoke tests, should be used for local development only.', default=False) - opts.add_option('--no_system', - action='store_true', help='Skips system tests, should be used for local development only.', default=False) - opts.add_option('--no_unit', - action='store_true', help='Skips unit tests, should be used for local development only.', default=False) + usage='Run the command `python -m verto.tests.start_tests` from the level above the verto directory.', + description='Verifies that Verto is functional compared to the testing suite.') + opts.add_option( + '--travis', + action='store_true', + help='Enables skipping suites on failure. To be used by continuous integration system.', + default=False + ) + opts.add_option( + '--no_smoke', + action='store_true', + help='Skips smoke tests, should be used for local development only.', + default=False + ) + opts.add_option( + '--no_system', + action='store_true', help='Skips system tests, should be used for local development only.', + default=False + ) + opts.add_option( + '--no_unit', + action='store_true', + help='Skips unit tests, should be used for local development only.', + default=False + ) options, arguments = opts.parse_args() return options, arguments @@ -79,7 +96,8 @@ def unit_suite(): unittest.makeSuite(ImageInlineTest), unittest.makeSuite(ImageTagTest), unittest.makeSuite(ImageContainerTest), - unittest.makeSuite(InteractiveTest), + unittest.makeSuite(InteractiveTagTest), + unittest.makeSuite(InteractiveContainerTest), unittest.makeSuite(JinjaTest), unittest.makeSuite(PanelTest), unittest.makeSuite(SaveTitleTest),