Skip to content

Commit

Permalink
Add special case for __call
Browse files Browse the repository at this point in the history
  • Loading branch information
evaera committed Jan 15, 2022
1 parent f0c8797 commit 6a55630
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docusaurus-plugin-moonwave/src/components/ClassMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function ClassMember({
readonly: readOnly,
source,
sourceUrl,
luaClassName,
}) {
return (
<>
Expand All @@ -32,7 +33,7 @@ export default function ClassMember({
textDecoration: deprecated ? "line-through" : "none",
}}
>
{name}
{name === "__call" ? <>{luaClassName}()</> : name}
</code>
</H3>

Expand Down
7 changes: 6 additions & 1 deletion docusaurus-plugin-moonwave/src/components/LuaClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ const ClassSection = ({
<>
<Title id={section}>{capitalize(section)}</Title>
{members.map((member, key) => (
<ClassMember key={key} {...member} sourceUrl={sourceUrl}>
<ClassMember
key={key}
luaClassName={luaClass.name}
{...member}
sourceUrl={sourceUrl}
>
<Component
luaClassName={luaClass.name}
{...member}
Expand Down
6 changes: 3 additions & 3 deletions docusaurus-plugin-moonwave/src/components/LuaFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export default function LuaFunction({
return (
<>
<div className={styles.memberString}>
<code>
<code className={name === "__call" && styles.green}>
{luaClassName}
{functionType === "static" ? "." : ":"}
{name !== "__call" ? (functionType === "static" ? "." : ":") : ""}
</code>
<code className={styles.green}>{name}</code>
{name !== "__call" && <code className={styles.green}>{name}</code>}
<PrOp>(</PrOp>
{params.length < 2 && (!params[0] || !params[0].desc) ? (
params[0] && <Param {...params[0]} />
Expand Down
9 changes: 7 additions & 2 deletions docusaurus-plugin-moonwave/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ function parseApiCategories(luaClass, apiCategories) {
.map((member) => {
return {
value:
getFunctionCallOperator(member.function_type) + member.name,
member.name === "__call"
? luaClass.name + "()"
: getFunctionCallOperator(member.function_type) + member.name,
id: member.name,
children: [],
level: 3,
Expand All @@ -142,7 +144,10 @@ function parseApiCategories(luaClass, apiCategories) {
!member.tags.some((tag) => apiCategories.includes(tag))
)
.map((member) => ({
value: getFunctionCallOperator(member.function_type) + member.name,
value:
member.name === "__call"
? luaClass.name + "()"
: getFunctionCallOperator(member.function_type) + member.name,
id: member.name,
children: [],
level: 3,
Expand Down

0 comments on commit 6a55630

Please sign in to comment.