Code Monkey home page Code Monkey logo

liquid-tags's People

Contributors

azd325 avatar botpub avatar calfzhou avatar cclauss avatar dorneanu avatar drorata avatar hrw avatar isms avatar jakevdp avatar joergdietrich avatar jseabold avatar justinmayer avatar kdeldycke avatar krischer avatar lioman avatar lucas-c avatar minrk avatar mirekdlugosz avatar mothsart avatar natim avatar nt3rp avatar pauloxnet avatar pre-commit-ci[bot] avatar pseyfert avatar snay avatar solomonhuang avatar talha131 avatar ulikoehler avatar xsteadfastx avatar ysard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

liquid-tags's Issues

[notebook] Fails to render some content when markdown toc extension is enabled

On my test website, following pelican configuration:

MARKDOWN = {
    'extension_configs': {
        'markdown.extensions.toc': {'anchorlink': True},
    },
    'output_format': 'html',
}

LIQUID_TAGS = ["notebook"]

causes multiple (but not all) pages to fail with following error message:

ERROR: Could not process pages/site-policy.md
  | append() argument must be xml.etree.ElementTree.Element, not Element
  |___
  | Traceback (most recent call last):
  |   File "/tmp/venv-website/lib/python3.9/site-packages/pelican/generators.py", line 721, in generate_context
  |     page = self.readers.read_file(
  |   File "/tmp/venv-website/lib/python3.9/site-packages/pelican/readers.py", line 573, in read_file
  |     content, reader_metadata = reader.read(path)
  |   File "/tmp/venv-website/lib/python3.9/site-packages/pelican/readers.py", line 337, in read
  |     content = self._md.convert(text)
  |   File "/tmp/venv-website/lib/python3.9/site-packages/markdown/core.py", line 268, in convert
  |     newRoot = treeprocessor.run(root)
  |   File "/tmp/venv-website/lib/python3.9/site-packages/markdown/extensions/toc.py", line 295, in run
  |     self.add_anchor(el, el.attrib["id"])
  |   File "/tmp/venv-website/lib/python3.9/site-packages/markdown/extensions/toc.py", line 218, in add_anchor
  |     c.append(anchor)
  | TypeError: append() argument must be xml.etree.ElementTree.Element, not Element

Not using toc markdown extension or not using notebook liquid tag makes all pages render again, which means that these two sometimes interact in unexpected way.

Root cause should be identified and issue must be fixed, so users are free to use both toc extension and notebook tag on their blogs.

[notebook] Doesn't use plugin as source of templates

Notebook tag contains couple of templates for various IPython versions; however, new-ish IPython seems to resolve template names relative to one of many pre-specified directories, and liquid_tags plugin directory is not on that list.

Relevant code has been commented out (see pelican/plugins/liquid_tags/notebook.py line 330) to allow tag to work at all, but support for templates should be brought back.

Error after fresh install

  • Install a new Pelican with Markdown
  • Create a skeleton site with pelican-quickstart
  • Add a 1 or 2 line content file as test.md
  • Install this plugin with pip and set the PLUGINS var
    Generate the site with pelican .

Generates an error:
ERROR Could not process content/test.md log.py:96
LiquidTags.extendMarkdown() missing 1 required positional argument: 'md_globals'
Done: Processed 0 articles, 0 drafts, 0 hidden articles, 0 pages, 0 hidden pages and 0 draft pages in 0.09 seconds.

What are liquid tags?

Is it possible to include an explanation about liquid tags and what is so special about them in the project description (README.md)?

It looks like a tag addition, but I can't extract their clear purpose from the description.

I hope this is a simple request, it will be useful and informational to the user unfamilair with liquid tags.

Thanks.

pip cannot find pelican-liquid-tags

I followed the installation instructions with the command:

python -m pip install pelican-liquid-tags

and received the following output:

ERROR: Could not find a version that satisfies the requirement pelican-liquid-tags
ERROR: No matching distribution found for pelican-liquid-tags

I'm running:

  • pelican 4.6.0
  • python 3.6.13
  • pip 21.0.1

[include_code] Hardcodes `content` as content path

pelican/plugins/liquid_tags/include_code.py line 100 refers to content directory, assuming it is name of main directory where Pelican will look for content. It should use PATH variable from Pelican settings. However, tags don't have access to all Pelican settings.

A solution should be found, so tag works with path as specified in pelicanconf.py, and not only default Pelican content path.

Add an option to wrap <img> into <figure>?

I am using liquid_tags for embedded YT videos (or rather their thumbnails) and 'yafg' Markdown extension to handle images.

This way Markdown snippet:

![NEC PC-8001A with peripherals](/files/2018/07/nec-pc-8001a-700x.jpg "NEC PC-8001A with peripherals")

Turns into:

<figure id="__yafg-figure-12">
<img alt="NEC PC-8001A with peripherals" src="[/files/2018/07/nec-pc-8001a-700x.jpg](view-source:http://localhost:8000/files/2018/07/nec-pc-8001a-700x.jpg)" title="NEC PC-8001A with peripherals">
<figcaption><span class="caps">NEC</span> <span class="caps">PC</span>-8001A with peripherals</figcaption>
</figure>

Which then looks like this (with a bit of CSS used):

obraz

figcaption {
	text-align: center;
}

figure {
	margin: 0 0 0.5em 0;
	padding: 0 0.5em 0.5em 0.5em;
	border: 1px solid lightgray;
}

But that's duplication of code in Pelican setup so maybe adding <figure> support into liquid_tags.img would be a better option?

Python 3.11 compatibility

After adding Python 3.11 to CI versions, run failed:

Traceback (most recent call last):
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/bin/invoke", line 8, in <module>
    sys.exit(program.run())
             ^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/program.py", line 373, in run
    self.parse_collection()
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/program.py", line 465, in parse_collection
    self.load_collection()
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/program.py", line 699, in load_collection
    module, parent = loader.load(coll_name)
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/loader.py", line 76, in load
    module = imp.load_module(name, fd, path, desc)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/imp.py", line 235, in load_module
    return load_source(name, filename, file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/imp.py", line 172, in load_source
    module = _load(spec)
             ^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 721, in _load
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/runner/work/liquid-tags/liquid-tags/tasks.py", line 25, in <module>
    @task
     ^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 331, in task
    return klass(args[0], **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 76, in __init__
    self.positional = self.fill_implicit_positionals(positional)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 167, in fill_implicit_positionals
    args, spec_dict = self.argspec(self.body)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 153, in argspec
    spec = inspect.getargspec(func)
           ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
Error: Process completed with exit code 1.

This issue needs to be investigated and fixed.

Create single source of truth for in-tree tags documentation

Right now, in-tree tags documentation is duplicated in Readme.md and each tag source file docstring. As is usually a case for duplicated content, of course it has diverged over time

  • There are 18 or 19 tags in tree (depending if you count "generic" as real tag), but 13 listed in Readme. Which means that 5 tags are hard to discover and require reading source file to understand how they work
  • docstrings often do better work at documentation, by providing more examples and example HTML output
  • sometimes Readme provides better documentation, like in youtube tag (where Readme explains YOUTUBE_THUMB_ONLY and YOUTUBE_THUMB_SIZE variables)

This issue can be closed when we have single source of truth for all tags documentation, and that documentation is up to date.

Personally I would explore generating all docs from docstrings using sphinx, and creating readthedocs account to store that, but I am open to other solutions, too.

LiquidTags.extendMarkdown() missing 1 required positional argument: 'md_globals'

I'm getting this error on a site created with blog-o-matic template.

(pelican) C:\Users\Matt\web\mhw.com-elegant>pelican
[10:01:44] WARNING  Removed extraneous trailing slash from SITEURL.                                                                                                                         log.py:91
           WARNING  Feeds generated without SITEURL set properly may not be valid                                                                                                           log.py:91
           ERROR    Cannot register plugin `tipue_search`                                                                                                                                   log.py:96
                    module 'tipue_search' has no attribute 'register'
[10:01:46] ERROR    Could not process Linux\change-dir-name-case.md                                                                                                                         log.py:96
                    LiquidTags.extendMarkdown() missing 1 required positional argument: 'md_globals'
           ERROR    Could not process Projects\Canvec\Using_CanVec.md                                                                                                                       log.py:96
                    LiquidTags.extendMarkdown() missing 1 required positional argument: 'md_globals'

...repeats for each document in content.

Versions:

  • Python 3.10.8
  • markdown 3.4.1

I don't know how to get the installed liquid_tags version, so can't tell if the fix in #20 is present.

Youtube tag configuration has no effect

Hi, the settings YOUTUBE_THUMB_ONLY and YOUTUBE_THUMB_SIZE of the Youtube tag have no effect on the behavior of the plugin, in fact they have not been declared in the file mdx_liquid_tags as for the other plugins.
In the documentation it is noted that these parameters must be added to the Pelican configuration but not in the form "Out-of-tree tag".

Release pelican-liquid-tags v1.0.0 on PyPI

This is a ticket to keep track of the packaging and PyPi distribution of the next version:

  • Move legacy plugin from monorepo. Done at #6 by @mirekdlugosz.
  • Fix tests (as of 2021-01-05, there are 8 failures)
  • Fix functional issues with migrated plugin, if any
  • Apply code style conventions to new repo
  • Update new repo README
  • Setup CI/CD by the way of GitHub workflows.
  • Release v1.0.0 on PyPI.
  • Flag the plugin as migrated by merging getpelican/pelican-plugins#1316

`Encountered unknown tag` when building

Python: 3.10.8
Pelican: 4.8.0
liquid-tags: 1.0.3

Plugins that I enabled:

PLUGINS = [
    "pelican.plugins.liquid_tags.notebook",
    "pelican.plugins.liquid_tags.include_code",
    "pelican.plugins.jinja_filters",
    "pelican.plugins.jinja2content",
    "pelican.plugins.simple_footnotes",
    "pelican.plugins.render_math",
    "pelican.plugins.webassets",
    "minify",
]

Accordingly liquid tags:

LIQUID_TAGS = [
    "notebook",
    "include_code",
]

And then I created code subfolder under content, and add this line to a post

{% include_code test.py %}

when building such content, pelican raised an warning that:

Could not process Cate/test-post.md
Encountered unknown tag 'include_code'.

And I've tested on several other tags, and none of them would work. Really don't have an idea about what's going wrong

gram tag is no longer working

Instagram tag uses old API endpoint, that has been discontinued by Facebook in October 2020. There are supported alternatives, including (new) oEmbed API and Basic Display API, but they are more involved than old API - apparently they require registering your app within Facebook.

Someone with Instagram account is needed to port tag to new API, and document new procedure of using the tag.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.