Comments (5)
In case XML syntax is desired shouldn't user just use XML mode? HTML allows for unclosed tags and actually deprecates self closing tags, but if I remember correctly kajiki XML mode does actually what you want to achieve.
from kajiki.
There are a couple of things that don't really cope well with the differences between HTML and XML (when delivered with an XML content type to the browser), e.g. some third-party Javascript modules expect tags to be uppercase in the DOM.
HTML5 explicitly allows self-closing void start tags, so I guess I'm in the clear there (except maybe for the suggested shortcut to using FontAwesome icons, i.e. a self-closing <i ... />
tag, but there's a licit alternative in <embed ... />
).
Is there a way to use Kajiki XML mode in Turbogears and have it delivered as text/html
? If so, I haven't found the way to do it.
from kajiki.
I'm not saying that self closed tags are wrong, jus that they are not required and they are actually just ignored for void elements, so kajiki is doing the right thing in HTML mode as those tags are self closing in any case.
Regarding how to switch kajiki to xml mode setting in turbogears templating.kajiki.force_mode = xml
in your app_cfg.py
should do what you are looking for. (See http://turbogears.readthedocs.io/en/latest/reference/config-options.html#tg.renderers.kajiki.KajikiRenderer) hope that helps!
from kajiki.
They're not required for HTML, but they're good if you want the rendered content not make stuff expecting XML go belly up (say the XML mode of your editor trying to balance out tags, or indent things intelligently 😉). I'm not expecting Kajiki to self-close all void start tags, only to preserve it if I do it in the template.
I'll try what you suggested about forcing Kajiki to use XML mode in TG, but as I said above, it needs to be delivered with content type text/html
so client-side doesn't have the changes in DOM etc. that make other things (JS libraries) break.
from kajiki.
So, setting base_config['templating.kajiki.force_mode'] = 'xml'
rendered void elements with self-closing start tags (not so with e.g. <script>
but that is expected with what the HTML standard says about it), and delivers the page as text/html
. That works for me and trims down this issue to "playing loose with whitespace" but that's not a huge problem (unless you optimize for bytes sent ;).
That leaves me only issue #21 before I can make the switch :).
from kajiki.
Related Issues (20)
- Python 3.8 support HOT 3
- Many HTML entities don't work HOT 5
- Python2 support using nine HOT 8
- py:if and "lower than" comparison
- XML comments outside root node cause py:else to raise XMLTemplateCompileError
- XML template with declaration <?xml version="1.0"?> becomes invalid due to internal Kajiki manipulation
- Python 3.10 compatibility error HOT 4
- travis-ci.org shutting down HOT 2
- migrate to pytest? HOT 1
- drop support for Python 2.6, 2.7, 3.0-3.3? HOT 4
- Kajiki needs a new owner? HOT 12
- 0.9.0: pytest is failing HOT 10
- kajiki fails to build with Python 3.11
- kajiki IDE suppprt HOT 2
- simple extends examples HOT 5
- XMLTemplate not working HOT 3
- Unit tests are failing on Python 3.11 HOT 2
- There is no code.co_endlinetable and code.co_columntable in python3.11 HOT 2
- kajiki 0.9.2 requires python-3.11 according to linetable dependency HOT 4
- API use of pkg_resources is deprecated
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 kajiki.