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
Sitemap.xls and custom site_icon_meta_tags #362
Comments
From https://www.w3schools.com/tags/tag_link.asp:
The general consensus is to make code strict (XHTML) in plugins. I'll see if I can filter the tags with some regex to make them behave strictly. This includes attribute quoting. |
We'll fix this in a future update. It takes too long to test for the upcoming patch. With this fix, we're going to assume that all items in the filter are meta elements without content. Here's what I got for grabbing the closing tags: /<[^>]+?(\/?>)/ Here's what I got for strict attribute quoting, it's slow because we can't repeat-capture nested groups: /<[^>]+?\/?>/ # Grab tags first
/(\w+=([^"']+?)(\s|(\/?>)))/ # Grab unquoted elements for each of the tags... |
other way: https://regex101.com/r/zgKJUw/1
my favorite bullet-proof)
|
By just removing the <[^>]+(\/?>) |
|
Ah, yes, it doesn't grab the closing solidus. |
Keep in mind that we can't filter the outcome of the function without using output buffering (it introduces code smell). So, we're going to loop over the array. Whatever's faster over a single meta-tag line will be used. Keep maintainability and readability of the code in mind, too. 8 steps on a single line (112 over all those lines): /<[^\/>]+(?:\/?[^>\/]++)*?(\/?>)/ Thanks for your input, it helped me get to that 😃 |
If you want to find the ending of the tag, here: https://regex101.com/r/zgKJUw/3 You can simplify the processing, but in this case, we must understand that we will encounter a dirty code. Obviously, we can not be responsible for the dirty code. But you need to choose between a simple and fast code and a handler that will work even with dirty code. |
I don't think it's necessary to scrutinize and repair every single line. If it's invalid HTML that isn't supposed to be in the We'll only want to convert HTML to XHTML, whatever purpose the tag has. |
The easiest way is to notify users through the interface "the icon tags should be compatible with XHTML Strict, otherwise it will lead to style errors and a white window." |
Another way is to remove |
It's using a WordPress Core function for consistency. Turning off the filters or adding an option for the off-chance that someone adds non-XHTML code is too much of a chore for both developers and users alike. Let's just make it work as intended 👍 |
Simply looking end of tags https://regex101.com/r/zgKJUw/4 |
https://regex101.com/r/zgKJUw/5 |
Brilliant, thanks! That'll help with edge case scenarios too 👍 |
in the case of using regex, a rational option may be where the wait for link and meta tags. |
There are more restrictions set in XHTML, like only having lowercase elements and attributes names. For balancing tags, we should use WordPress' force_balance_tags(). This will also close the single tags that should be closed. I think it also lowercases elements. Alas, this doesn't strictly quote attributes nor lowercase the attribute names. Why reinvent the wheel? 😄 |
I wasn't able to fix attribute minimization due to time constraints. I must move on to TSF 3.2 ASAP for Gutenberg. Nevertheless, attribute minimization shouldn't be used in any context regarding meta tags anyway, which is why I feel save introducing the following commit. It should prevent errors showing in the XSL file when filtering |
Now work perfect. Thanks! |
Hi!
I use custom site icon meta tags through a filter:
And I get style errors for the sitemap. White page of sitemap. Console errors 'Opening and ending tag mismatch' for sitemap.xsl.
It was unexpected to meet my html5 tags in the xml file. Now I've closed the tags in my code snippet, but it's not entirely clear what to do with this in the future
The text was updated successfully, but these errors were encountered: