All HTMLAttrDef and HTMLAttrXRef macros are removed mdn/content #347
Closed
schalkneethling
announced in
Announcements
Replies: 2 comments 2 replies
-
A small nit: Converted {{HTMLAttrDef("abc")}} to `abc` |
Beta Was this translation helpful? Give feedback.
1 reply
-
I found there are some cases that the macro are wrapped with inline-code. We may need to use regexp like |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From @OnkarRuikar
We've removed all
HTMLAttrDef
andHTMLAttrXRef
macros from mdn/content. They've been converted to either markdown links or anchor tags. They are being marked deprecated in yari.Henceforth use markdown style links or anchor tags:
a. For
{{htmlattrxref("lang")}}
use[lang](/en-US/docs/Web/HTML/Global_attributes#lang)
in Markdown and<a href="/en-US/docs/Web/HTML/Global_attributes#lang)"><code>lang</code></a>
in HTML tables.b. For
{{htmlattrxref("srcset", "img")}}
use[srcset](/en-US/docs/Web/HTML/Element/img#srcset)
in Markdown<a href="/en-US/docs/Web/HTML/Element/img#srcset)"><code>srcset</code></a>
in HTML tables.The conversion was not as straightforward as I thought it would be. Thanks to @teoli2003, we solved the issues quickly.
Here is what we did:
{{HTMLAttrDef("abc")}}
toabc
attr-
from URL fragments/en-US/docs/Web/HTML/Element/tag#attr-abc
a. Converted 1 argument instances to
/en-US/docs/Web/HTML/Global_attributes#lang
. Later we decided to convert these to/en-US/docs/Web/HTML/Global_attributes/lang
(instead of a fragment, use the direct link)b. Converted 3 and 4 argument instances. Because there was not a lot of these, I did it manually.
c. Converted 2 arg instances from
{{HTMLAttrXref("attr", "tag")}}
to[attr](/en-US/docs/HTML/Element/tag#attr)
.[abc](#abc)
<a href="/en-US/../tag#attr)"><code>attr</code><a>
I used the following RegExes to semi-automate the task.
a. Convert 1 param macros:
Search:
\{\{ ?htmlattrxref ?\( ?["']([^,]*?)["']\)\}\}
Replacement:
[$1](/en-US/docs/Web/HTML/Global_attributes#$1)
b. Convert 2 param macros:
Search:
\{\{ ?htmlattrxref ?\( ?["']([^,\n}]*?)["'], ?["']([^,\n}]*?)["']\)\}\}
Replacement:
[$1](/en-US/docs/Web/HTML/Element/$2#$1)
Then to update markdown style links in HTML tables:
Search:
(?<=<td>)(([\s\S](?!/td))*?)\[(.*)\]\((.*)\)
Replacement:
$1<a href="$4"><code>$3</code></a>
Beta Was this translation helpful? Give feedback.
All reactions