Closed noseshimself closed 1 year ago
Looked into this and fixed a couple of things.
Now the state is:
{% with 0 as enableHtmlInTexts %}
to the value 1
.I expect this to be fixed for now, until work happens on #152
Great work!
- You can use html tags in pretext, posttext and the item descriptions.
Working perfectly. And even working in catalogs. Although I don't think you expected it, look at this:
It does not work when inserting item templates into documents:
and will lose all formatting as soon as it has been transferred:
- They are not rendered in the document previews in Kraft, but in the PDF.
(It's also the reason why I was asking for Markdown -- either write your stuff in a Markdown editor or live with its textual representation.)
- html tags only work with Weasyprint.
I expected that much; I'm still strongly in favour of making weasyprint the default.
- You need to enable the html tags in the template file setting
{% with 0 as enableHtmlInTexts %}
to the value1
.
... in the default gtmpl (template)...
btw. Line 95 to 99 might not be exactly what you want
{% if enableHtmlInTexts %}
{{ doc.preText|safe|linebreaks }}
{% else %}
{{ doc.preTextHtml|safe }}
{% endif %}
I guess you meant {{ doc.preText|linebreaks }}
I have to admit that using the linebreaks filter is a great idea compared to me having to fix that with white-space: pre-line;
in my CSS-
- Expect changes in the CSS of the template needed.
Expect to change the templates themselves, too.
- Expect funny wrong renderings.
only if you mess up your HTML
I expect this to be fixed for now, until work happens on #152
Tried and tested.
ok, that was not correct. As soon as the catalog item is reopened the same thing that happened to document items before will happen here:
It's probably necessary to copy the changes to the code for catalogs, too.
Catalogs should now also be fixed with the commit above.
Catalogs are working as expected.
I found a really strange quirk:
As soon as a field (e.g. preText) is starting with valid HTML markup like
opening the document again will get that contents rendered as HTML (without getting access to the mark up). Adding HTML tags on any other line will have no effect. Checking the contents of the database shows that the contents of the fields did not change at all.
As the CSS of the displayed fields seems not to contain
white-space: pre-line;
line breaks are lost and have to be replaced bytags (which will "vanish" after saving the changes.
Now the best part of it: If text is added to the beginning of the field all markups are removed and the text is looking like before (minus the HTML tags) (and checking the database shows that all the HTML tags are gone).
I would really like to keep my input the way it was and to be able to modify it; it is working quite well in printed documents.
(For the record: I would still prefer MarkDown. 8-) )