-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Hotfix Expression language example lower than #17587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
alamirault
wants to merge
1
commit into
symfony:5.4
from
alamirault:hotfix/expression-language-example
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we should fix this, too, right?
I am wondering if we should keep the
>
and not use<
and fix the docs builder instead, because we are in a.. code-block:: text
.WDYT @weaverryan ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woh. This is kind of "spooky". On the target page - https://symfony.com/doc/current/components/expression_language.html#how-can-the-expression-engine-help-me - the
>
renders fine here. It even renders as>
in the page source. It is only the<
below that is missing - completely unrendered on the page.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikophil as you worked a lot on the docs-builder, maybe do you have an idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi! sorry for the late answer here 😊
I really don't know, it's been literally years that I have not worked on this 🤷
that's really strange this is not rendered the same way locally and on symfony.com: the variable is used the same way in both templates:
{{ code|raw }}
(see here and here)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be a highlight.js issue ?
<pre class="hljs text">
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I found where the problem is coming from in the docs builder.
For symfony.com, files are rendered as
fjson
files: we loop on each html file, take the content of the<body>
tag thanks tosymfony/dom-crawler
and put it in afjson
file.The symbol
<
disappears after the crawler step (it might assume it is an error in the html syntax? don't really know 🤷)Here, the content of
file_get_contents()
has the symbol, but it's not present anymore in$crawler->filter('body')->html()
There may be two solutions for this:
symfony/dom-crawler
(ie: don't modify code inside<pre>
tags?)<body>
tag content without dom crawler@weaverryan any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<pre>product.stock < 15 </pre>
seems to be an invalid html (tested on https://jsonformatter.org/html-validator)Here we use code-block text but when it's
code-block
isxml
<
is encoded.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😮
W3C validator says the same thing:
<
is invalid inside a<pre>
whereas>
is validI was always thinking
<pre>
would allow everythinghttps://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre
maybe the right thing to do would be to automate this replacement in code blocks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've provided a fix on the builder:
symfony-tools/docs-builder#145
actually the problem only occurred on
.. code-block:: text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 😃