This repository has been archived by the owner on Jul 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Use xhp for html rendering #27
Open
lexidor
wants to merge
37
commits into
hhvm:main
Choose a base branch
from
lexidor:use-xhp-for-html-rendering
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
This library contain many non-final classes, all of which may have been extended elsewhere. Accept that this library doesn't meet this strict standard and move on.
This library contains classes with duplicate names. Example: ``` use type Facebook\Markdown\Block\ThematicBreak as ASTNode; class ThematicBreak {} ``` The alias to ASTNode allows the UnparsedBlocks\ThematicBreak to refer to the other. A use statement without an alias would create a name collision with the declaration. One could choose to always refer to the other node using a qualified name: Blocks\ThematicBreak
This linter found `$offset;`, but I can't imagine what this was supposed to do. It's an int, so what the intent to increment / decrement it? Thank you @ryangreenberg for adding this linter to hhast.
XHP renders `disabled={true}` as `disabled`, but the spec expects `disabled=""`. It would be a shame if this small incompatibility would block xhp adoption. Let's make the spec tests allow these stringless boolean attributes.
The HTMLXHPRenderer still needs to be written.
All methods have been extracted from Renderer<T>. We need this interface to write tests again HTML(XHP)?Renderer. This itnerface allows us to reference them as `IRenderer<XHPChild>`.
Requires disabling child validation. Some of the specs expect invalid html.
One fewer "magic" type system lie! Explicitly use the `->forceAttribute()` api. This is the proper way to tell lies and will be caught when xhp attributes become sound.
We can't simply switch the HTMLRender to use HTMLXHPRenderer under the hood. The xhp renderer has slightly different output: - Boolean attributes are rendered as `attr` instead of `attr=""`. - Void elements don't include a trailing solidus (backslash) in their open tag. I'd not want to break test suites , bust caches, or break naive parsers. This change should be opt-in, but low friction.
HTMLXHPRenderer had a `$node !== ''` comparison. This is always false, but we don't case about the filter anyhow. Joining an empty string has the same effect as not joining it. Optimization also applied in HTMLRenderer.
Wrapping a vec of nodes in a frag is not needed if embedded in a node. The node would unpack the frag immediately and appended the children. This is what it does for a vec too.
The hhvm version is laughably out of date. We don't need hhvm-autoload, HH\Facts will do.
lexidor
commented
May 27, 2023
)[]: string { | ||
// https://stackoverflow.com/posts/1732454/revisions | ||
// #pragma enable module(guard(superstition)) | ||
return Regex\replace_with($html, re'#<img .+?>#', $he_comes ==> { |
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.
If this joke is a little much, let me know and I'll rewrite the git history so it was never here to begin with.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
fixes #1
fixes #14
Fixes: