-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
859 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
Inline Image | ||
####################################### | ||
|
||
**Processor name:** ``image-inline`` | ||
|
||
.. note:: | ||
|
||
The inline image tag allows for the use of images inside tables, *etc* without causing style errors. The tag functions almost exactly the same as the ``image`` tag except for the alignment argument. | ||
|
||
You can include an inline image using the following text tag: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_basic_usage.md | ||
:language: none | ||
|
||
Required Tag Parameters | ||
*************************************** | ||
|
||
- ``file-path`` - The path to the image. | ||
|
||
- Each file-path provided is added to the ``images`` set in required files stored by Verto. The set of filepaths can be accessed after conversion, see :ref:`accessing_verto_data`. | ||
- **Note:** If the given link is a relative (a link that doesn't start with ``http:``), the link will be rendered with a Django static command. For example, the link ``images/example.png`` would be rendered as ``{% static 'images/example.png' %}`` This can be overriden, see the override section below. | ||
|
||
Optional Tag Parameters | ||
*************************************** | ||
|
||
- ``alt`` - Description text of the image used when an image is not displayed, or can be read when using a screen reader (for those with reading difficulties). | ||
- ``caption`` - Lists the given text as a caption under the image. | ||
- ``caption-link`` (requires caption parameter) - Converts the caption text into a link to the given caption link URL. | ||
- ``source`` (optional) - Adds the text 'Source' under the image with a link to the given source URL. Displays after the caption if a caption is given. | ||
- ``hover-text`` - Additional text to be displayed when the user hovers their cursor over the image (note this won't appear on touch devices so use sparingly). | ||
|
||
The default HTML for image is: | ||
|
||
.. literalinclude:: ../../../verto/html-templates/image-inline.html | ||
:language: css+jinja | ||
|
||
Using the following example tag: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_basic_usage.md | ||
:language: none | ||
|
||
The resulting HTML would be: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_basic_usage_expected.html | ||
:language: html | ||
|
||
Overriding HTML for Images | ||
*************************************** | ||
|
||
When overriding the HTML for images, the following Jinja2 placeholders are available: | ||
|
||
- ``{{ file_path }}`` - The location for the path to the URL. | ||
- ``{{ alt }}`` - The alternative text for the image. | ||
- ``{{ hover_text }}`` - The text to display when the user hovers over the image (see `image title attribute <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title>`_). | ||
- ``{{ caption }}`` - The text for the image caption. | ||
- ``{{ caption_link }}`` - The URL for the caption link . | ||
- ``{{ source_link }}`` - The URL for the source . | ||
|
||
If the ``file_path`` provided is a relative link, the link is passed through the ``relative-file-link.html`` template. | ||
The default HTML for relative images is: | ||
|
||
.. literalinclude:: ../../../verto/html-templates/relative-file-link.html | ||
:language: css+jinja | ||
|
||
For example, providing the following HTML: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_override_html_template.html | ||
:language: css+jinja | ||
|
||
with the following tag: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_override_html.md | ||
:language: none | ||
|
||
would result in: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/image-inline/doc_example_override_html_expected.html | ||
:language: html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
Scratch (Inline) | ||
####################################### | ||
|
||
**Processor name:** ``scratch-inline`` | ||
|
||
.. note:: | ||
|
||
The inline scratch processor works similarly to the default :doc:`scratch` processor except that it matches inline codeblocks instead and requires a colon after the scratch tag. | ||
|
||
.. danger:: | ||
|
||
Scratch blocks require an understanding of the Scratch programming language and how Verto is integrated with other systems. The use of this processor requires co-ordination between authors and developers to achieve the desired functionality. | ||
|
||
.. note:: | ||
|
||
The following examples assume usage of the fenced code extension, by having | ||
``markdown.extensions.fenced_code`` in the list of extensions given to Verto. | ||
|
||
You can include an image of Scratch blocks using | ||
`Scratch Block Plugin notation`_ using the following notation: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/scratch-inline/doc_example_basic_usage.md | ||
:language: none | ||
|
||
to produce the following image with the ``scratch:`` stripped: | ||
|
||
.. image:: ../images/scratch_inline_example.png | ||
|
||
which is inserted between the paragraph text. | ||
|
||
|
||
You can test the output of your Scratch block text at | ||
`scratchblocks.github.io`_. | ||
You can also generate Scratch block text from a published Scratch project at | ||
`scratchblocks.github.io/generator/`_. | ||
|
||
.. warning:: | ||
|
||
Verto doesn't create the Scratch images, but saves data for another system | ||
(for example: Django) to create the images. | ||
See :ref:`accessing-scratch-image-data` section in the scratch documentation. | ||
|
||
|
||
The default HTML for scratch blocks is: | ||
|
||
.. literalinclude:: ../../../verto/html-templates/scratch-inline.html | ||
:language: css+jinja | ||
|
||
Using the following example tag: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/scratch-inline/doc_example_basic_usage.md | ||
:language: none | ||
|
||
The resulting HTML would be: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/scratch-inline/doc_example_basic_usage_expected.html | ||
:language: html | ||
|
||
|
||
Overriding HTML for Scratch | ||
*************************************** | ||
|
||
When overriding the HTML for Scratch code, the following Jinja2 placeholders are available: | ||
|
||
- ``{{ hash }}`` - The hash of the Scratch code-blocks used in the expected filename. | ||
|
||
**Example** | ||
|
||
For example, providing the following HTML: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/scratch-inline/doc_example_override_html_template.html | ||
:language: css+jinja | ||
|
||
with the following tag: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/scratch-inline/doc_example_override_html.md | ||
:language: none | ||
|
||
would result in: | ||
|
||
.. literalinclude:: ../../../verto/tests/assets/scratch-inline/doc_example_override_html_expected.html | ||
:language: html | ||
|
||
.. _Scratch Block Plugin notation: https://wiki.scratch.mit.edu/wiki/Block_Plugin | ||
.. _scratchblocks.github.io: https://scratchblocks.github.io/#when%20flag%20clicked%0Aclear%0Aforever%0Apen%20down%0Aif%20%3C%3Cmouse%20down%3F%3E%20and%20%3Ctouching%20%5Bmouse-pointer%20v%5D%3F%3E%3E%20then%0Aswitch%20costume%20to%20%5Bbutton%20v%5D%0Aelse%0Aadd%20(x%20position)%20to%20%5Blist%20v%5D%0Aend%0Amove%20(foo)%20steps%0Aturn%20ccw%20(9)%20degrees | ||
.. _scratchblocks.github.io/generator/: https://scratchblocks.github.io/generator/ | ||
.. _scratchblocks: https://github.com/scratchblocks/scratchblocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
# Required dependencies for Verto (installed automatically in setup.py) | ||
markdown==2.6.8 | ||
beautifulsoup4==4.5.3 | ||
Jinja2==2.9.6 | ||
python-slugify==1.2.4 | ||
setuptools==35.0.2 | ||
|
||
# Required dependencies for building documentation | ||
sphinx==1.5.5 | ||
sphinx==1.6.1 | ||
sphinx_rtd_theme==0.2.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# flake8: noqa | ||
from .Verto import Verto | ||
|
||
__version__ = '0.5.3' | ||
__version__ = '0.6.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div> | ||
<img src="{{ file_path }}" | ||
{% if alt %} alt="{{ alt }}" {% endif -%} | ||
{%- if hover_text %} title="{{ hover_text }}" {% endif -%}> | ||
{% if caption and caption_link -%} | ||
<p><a href="{{ caption_link }}">{{ caption }}</a></p> | ||
{%- elif caption -%} | ||
<p>{{ caption }}</p> | ||
{%- endif -%} | ||
{%- if source_link -%} | ||
<p><a href="{{ source_link }}">Source</a></p> | ||
{%- endif -%} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<object type="image/svg+xml" data="{% autoescape false -%}{{ "{% static '" }}scratch-blocks-{{ hash }}.svg{{ "' %}" }}{%- endautoescape %}"></object> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.