Skip to content

Commit

Permalink
Two small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
savetheclocktower committed Jun 13, 2024
1 parent b5845b7 commit 41c3368
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion layouts/api/method.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let customName = item.customData?.name
%>
<section class="api-entry">
<h4 class="api-entry__name" data-name="<%= customName ?? "" %>" id="<%= anchorize(item.name) %>">
<h4 class="api-entry__name" data-name="<%= customName ?? item.name %>" id="<%= anchorize(item.name) %>">
<% if (item.customData?.signature) { %>
<a href="#<%= fragment %>"><%= item.customData.signature %></a>
<% } else { %>
Expand Down
20 changes: 12 additions & 8 deletions pulsar-api/src/json2html.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const mdRender = require("./md.js");
const LAYOUT_DIR = path.resolve(__dirname, "../../layouts/api");
const ROOT_LAYOUT_DIR = path.resolve(__dirname, "../../layouts");

const hasNoSection = (ele) => ele.sectionName === null;

function convert(name, content, version) {

let file = "";
Expand Down Expand Up @@ -63,14 +65,16 @@ function lookupSection(sectionName, prop, content, env) {
}

function lookupNullSections(content, env, hasOtherSections) {
// Originally this directive in the Atom docs would only grab uncategorized methods
// but we will look for everything
let nullClassMethods = content.classMethods.filter((ele) => ele.sectionName === null);
let nullInstanceMethods = content.instanceMethods.filter((ele) => ele.sectionName === null);
let nullClassProperties = content.classProperties.filter((ele) => ele.sectionName === null);
let nullInstanceProperties = content.instanceProperties.filter((ele) => ele.sectionName === null);

let totalCount = nullClassProperties.length + nullInstanceMethods.length + nullClassProperties.length + nullInstanceProperties.length;
// Originally this directive in the Atom docs would only grab uncategorized
// methods — but we will look for everything.
let nullClassMethods = content.classMethods.filter(hasNoSection);
let nullInstanceMethods = content.instanceMethods.filter(hasNoSection);
let nullClassProperties = content.classProperties.filter(hasNoSection);
let nullInstanceProperties = content.instanceProperties.filter(hasNoSection);


// Skip rendering anything unless we have at least one uncategorized thing.
let totalCount = nullClassMethods.length + nullInstanceMethods.length + nullClassProperties.length + nullInstanceProperties.length;
if (totalCount === 0) return "";

let file = "";
Expand Down

0 comments on commit 41c3368

Please sign in to comment.