Skip to content

Commit

Permalink
use a better sort order for sub categories
Browse files Browse the repository at this point in the history
(mainly, list functions before member functions)
  • Loading branch information
zspitzer committed Nov 10, 2024
1 parent 8a68352 commit e4c5954
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
42 changes: 25 additions & 17 deletions builders/html/templates/category.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@
local.pages = args.docTree.sortPagesByType( local.pages );
local.currentPageType = "";
local.pageTypeTitles = {
"function" = "Functions",
"_method" = "Methods",
"_object" = "Objects",
"tag" = "Tags",
"category" = "Categories",
};
local.pageTypeTitles = [
"function" = { title="Functions", pages=0 },
"tag" = { title="Tags", pages=0 },
"_method" = { title="Methods", pages=0 },
"_object" = { title="Objects", pages=0 },
"category" = { title="Categories", pages=0 },
"page" = { title="Guides",pages=0 }
];
local.missingPageTypes = {};
loop array="#local.pages#" index="local.i" item="local.page" {
if ( !structKeyExists(local.pageTypeTitles, local.page.getPageType() ) ) {
throw "Unknown page type: [ #local.page.getPageType()# ]";
}
local.pageTypeTitles[local.page.getPageType()].pages++;
}
</cfscript>


Expand All @@ -25,18 +34,17 @@
<cfif not pages.len()>
<p><em>There are no pages tagged with this category.</em></p>
<cfelse>
<cfloop array="#local.pages#" index="local.i" item="local.page">
<cfif local.page.getPageType() != local.currentPageType>
<cfif local.currentPageType.len()>
</ul>
</cfif>
<cfset local.currentPageType = local.page.getPageType()>
<h2>#( local.pageTypeTitles[ local.page.getPageType() ] ?: "Guides" )#</h2>
<cfloop collection="#local.pageTypeTitles#" key="local.pageTypeKey" value="local.pageType">
<cfif local.pageType.pages gt 0>
<h2>#( local.pageType.title )#</h2>
<ul class="list-unstyled">
<cfloop array="#local.pages#" index="local.i" item="local.page">
<cfif local.pageTypeKey eq local.page.getPageType()>
<li>[[#htmleditformat(local.page.getId())#]] #htmleditformat( getMetaDescription(local.page, local.page.getBody()) )#</li>
</cfif>
</cfloop>
</ul>
</cfif>

<li>[[#htmleditformat(local.page.getId())#]] #htmleditformat( getMetaDescription(local.page, local.page.getBody()) )#</li>
</cfloop>
</ul>
</cfif>
</cfoutput>
5 changes: 3 additions & 2 deletions docs/05.categories/090.esapi/category.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: Encode/Decode
id: category-esapi
related:
categories:
- category-core
---

Enterprise Security API
Used to prevent XSS, these functions use the ESAPI (Enterprise Security API) library to safely handle user input.

0 comments on commit e4c5954

Please sign in to comment.