Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions _data/ref/alpha/jobsystem-c.json
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@
"namespace": "JobSystem",
"notes": [],
"path": "engine/dlib/src/dmsdk/dlib/jobsystem.h",
"type": "Defold C"
"type": "Defold C",
"include": "dmsdk/dlib/jobsystem.h"
}
}
}
5 changes: 3 additions & 2 deletions _data/ref/beta/jobsystem-c.json
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@
"namespace": "JobSystem",
"notes": [],
"path": "engine/dlib/src/dmsdk/dlib/jobsystem.h",
"type": "Defold C"
"type": "Defold C",
"include": "dmsdk/dlib/jobsystem.h"
}
}
}
10 changes: 6 additions & 4 deletions _includes/api_c.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@ <h2 id="{{ ref.info.name | slugify }}" data-pagefind-weight="7">{{ ref.info.name
<th></th>
<th></th>
</tr>
{%- if ref.info.language == "C++" and ref.info.namespace != "" -%}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only show namespace if it's an actual namespace.

The "namespace" field has been overtaken by other functions as well, so we can't simply check if it's not empty.

{%- unless global_namespaces contains ref.info.namespace -%}
<tr>
{%- unless global_namespaces contains ref.info.namespace -%}
{%- if ref.info.namespace != "" -%}
<td>Namespace:</td>
<td><code>{{ ref.info.namespace }}</code></td>
{%- endif -%}
{%- endunless -%}
</tr>
{%- endunless -%}
{%- endif -%}
{%- if ref.info.include and ref.info.include != "" -%}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The include field wasn't set, thus the link was shown, but with no text.

To make it clearer, only show an include, if it actually has one.

<tr>
<td>Include:</td>
<td><code>#include &lt;<a href="https://github.com/defold/defold/blob/dev/{{ ref.info.path }}">{{ ref.info.include }}</a>&gt;</code></td>
</tr>
{%- endif -%}

</table>

Expand Down
10 changes: 5 additions & 5 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,26 +1147,26 @@ def process_refdoc(download = False):
api["info"]["language"] = "Lua"
# sys.exit(5)

# set api type
api["info"]["type"] = "Defold " + api["info"]["language"]
language = api["info"]["language"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny cleanup to avoid getting it again later on.


# set api type
api["info"]["type"] = "Defold " + language

# make sure file is only the filename and no path
if api["info"]["file"] == "":
api["info"]["file"] = os.path.basename(api["info"]["path"])
elif str.find(api["info"]["file"], "/") != -1:
api["info"]["file"] = os.path.basename(api["info"]["file"])

# generate include path for C++ files
if language == "C++":
# generate include path for C/C++ files
if language in ("C++", "C"):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix for the include file link for C files.

dmsdk_index = str.find(api["info"]["path"], "dmsdk/")
api["info"]["include"] = api["info"]["path"]
if dmsdk_index != -1:
api["info"]["include"] = api["info"]["path"][dmsdk_index:]

# create the key by which we index and collect APIs
namespace_key = namespace
language = api["info"]["language"]
if language == "C++":
# namespace_key = namespace_key + "-cpp"
namespace_key = api["info"]["path"].replace("..", "").replace("/", "-").replace(".", "-")
Expand Down