Comments (7)
Many thanks, @mirekdlugosz and @kdeldycke. I pushed a few follow-up changes but still need to give the README a once-over before anointing the new release. Will update here when that's all done. ✅
from liquid-tags.
Liquid Tags v1.0.0 has been published and is now available on PyPI. Many thanks to @mirekdlugosz and @kdeldycke for helping make that possible! 🎉
from liquid-tags.
Thanks @mirekdlugosz for your great work!
I'm re-opening the issue: if the main
branch is now is good state for 1.0.0, we still need @justinmayer to setup the GitHub actions workflow and push a 1.0.0 build of liquid-tags
on PyPi.
from liquid-tags.
This issue was particularly exciting to watch closely over the last week, not gonna lie! Thanks to everyone involved :)
from liquid-tags.
@kdeldycke @justinmayer
I wanted to discuss one problem with you.
liquid_tags contain both framework for registering tags, and library of tags. Historically, you had to define specific tags as plugins in your pelicanconf: PLUGINS = ['liquid_tags.include_code']
.
I managed to bring plugin to somewhat decent shape, where all tests pass, linter doesn't complain, package can be installed and is recognized by pelican-plugins
. The problem is, right now it only registers framework. So while plugin is available, it won't recognize any tags in posts.
I can think of 3 solutions, and I wanted to get your opinion on how we should proceed. Of course other ideas are welcome, too.
1. Expose all tags in plugin __init__.py
This way, installing plugin will enable all tags. This is potentially backwards-incompatible - if you wrote {% spotify %}
in post without including liquid_tags.spotify
, liquid tags would leave it as is. Now it would translate this string to spotify block.
As far as I can tell, tags that require additional modules (like pygalcharts) tend to import them when tag is processed, so people who aren't using these special tags will not need to install additional packages in their website venv.
This solution will also require refactoring of all the tests, as from . import audio
will return audio function instead of audio.py
module.
2. Teach pelican to look for namespaced plugins modules when processing PLUGINS
setting
pelican/plugins/_utils.py::load_legacy_plugin
will try to import package, but does not consider that dotted plugin name may refer to module inside namespaced plugin. I have PoC patch that changes that.
The main benefit is that namespaced plugin will continue to work with legacy settings. In fact, it will require legacy setting to be present. The main problem is that we will need to hold plugin release until pelican version with patch is released.
3. Introduce new setting to specify which tags to load
During registration, plugin can look into some new setting variable, and automatically import tags specified there. I had initial success with something like LIQUID_TAGS = ['img', 'youtube', 'video']
. Main drawback is that we force users to update their settings when switching to namespaced plugin, but we kind of encourage it right now anyway.
from liquid-tags.
Sorry @mirekdlugosz for the delayed answer!
I'm not (yet) a user of that plugin so I'm not in the best position to provide feedback on the different proposals.
Here are some comments on each point:
-
I did not realized some plugins requires extra dependencies like. I guess you can add these in the
pyproject.toml
file, with their own section. See: -
That can be more or less emulated by the plugin itself. At initialization, you can peek into Pelican contextual configuration and hack your way into the
PLUGINS
settings I guess. That what I'm currently doing in my Plumage theme to setup third party plugins I depends on. See: https://github.com/kdeldycke/plumage/blob/d8f16000a2cbfc8f758903d8e8b4d7df6788cc5e/plumage/__init__.py#L171 . But this might be a little bit too fragile. -
This seems like a reasonable solution. It makes tag activation explicit and simple. And you already started working in that direction. With the re-packaging of the plugin and the upcoming v1.0.0 release, feel free to introduce new options or new behaviour. It is OK to introduce some breaking changes to pave out the future of the plugin.
from liquid-tags.
@kdeldycke I was leaning towards solution number 3, and this is what I ended up implementing. I feel this is safest option, as doesn't require everyone to install all dependencies of all tags.
I have now raised PR with all my work, #6
from liquid-tags.
Related Issues (15)
- pip cannot find pelican-liquid-tags HOT 3
- Separate notebook embedding into separate feature HOT 1
- What are liquid tags? HOT 2
- Youtube tag configuration has no effect
- Error after fresh install HOT 3
- gram tag is no longer working
- Add an option to wrap <img> into <figure>?
- `Encountered unknown tag` when building HOT 4
- [notebook] Doesn't use plugin as source of templates
- Python 3.11 compatibility
- LiquidTags.extendMarkdown() missing 1 required positional argument: 'md_globals' HOT 3
- [notebook] Fails to render some content when markdown toc extension is enabled
- [include_code] Hardcodes `content` as content path
- Create single source of truth for in-tree tags documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liquid-tags.