Skip to content

Commit bbcc5ea

Browse files
committed
Fix whitespaces in OOP Syntax method
1 parent 3f9c4f7 commit bbcc5ea

1 file changed

Lines changed: 11 additions & 21 deletions

File tree

web/src/pages/reference/[func].astro

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ const oopList = Array.isArray(funcInfo.oop)
108108
: funcInfo.oop
109109
? [funcInfo.oop]
110110
: [];
111+
112+
const renderOOPMethod = (oopItem: any) => {
113+
const targetName = oopItem.static
114+
? getFixedStaticOOPClass(oopItem.element)
115+
: oopItem.element;
116+
const separator = oopItem.static ? "." : ":";
117+
118+
return `<li><strong>Method</strong>: <a href="/reference/${oopItem.element}">${targetName}</a>${separator}${oopItem.method}(...)</li>`;
119+
};
111120
---
112121

113122
<StarlightPage
@@ -226,16 +235,7 @@ const oopList = Array.isArray(funcInfo.oop)
226235
) : (
227236
<>
228237
{oopItem.method && (
229-
<li>
230-
<strong>Method</strong>:
231-
<a href={`/reference/${oopItem.element}`}>
232-
{oopItem.static
233-
? getFixedStaticOOPClass(oopItem.element)
234-
: oopItem.element}
235-
</a>
236-
{oopItem.static ? "." : ":"}
237-
{oopItem.method}(...)
238-
</li>
238+
<Fragment set:html={renderOOPMethod(oopItem)} />
239239
)}
240240
{oopItem.variable && (
241241
<li>
@@ -272,18 +272,8 @@ const oopList = Array.isArray(funcInfo.oop)
272272
) : (
273273
<>
274274
{oopList[0].method && (
275-
<li>
276-
<strong>Method</strong>:
277-
<a href={`/reference/${oopList[0].element}`}>
278-
{oopList[0].static
279-
? getFixedStaticOOPClass(oopList[0].element)
280-
: oopList[0].element}
281-
</a>
282-
{oopList[0].static ? "." : ":"}
283-
{oopList[0].method}(...)
284-
</li>
275+
<Fragment set:html={renderOOPMethod(oopList[0])} />
285276
)}
286-
287277
{oopList[0].variable && (
288278
<li>
289279
<strong>Variable</strong>: .{oopList[0].variable}

0 commit comments

Comments
 (0)