@@ -12,6 +12,9 @@ component accessors=true {
1212 property name = " directlyRelatedMap" type = " struct" ;
1313 property name = " threads" type = " numeric" ; // tracks references
1414 property name = " recipeDates" type = " struct" ; // tracks the git created dates for recipes for latest content
15+ property name = " syspropEnvvars" type = " array" ; // all system properties and environment variables
16+ property name = " syspropByTag" type = " struct" ; // sysprops indexed by tag name
17+ property name = " syspropByFunction" type = " struct" ; // sysprops indexed by function name
1518
1619 public any function init ( required string rootDirectory , required numeric threads ) {
1720 variables .rootDir = arguments .rootDirectory ;
@@ -37,6 +40,9 @@ component accessors=true {
3740 setCategoryMap ( [: ] );
3841 setReferenceMap ( [: ] );
3942 setDirectlyRelatedMap ( [: ] );
43+ setSyspropEnvvars ( [] );
44+ setSyspropByTag ( [: ] );
45+ setSyspropByFunction ( [: ] );
4046 }
4147
4248 public void function updateTree () {
@@ -226,6 +232,7 @@ component accessors=true {
226232
227233 _buildTreeHierarchy (false );
228234 _updateRecipeDates ();
235+ _loadSyspropEnvvars ();
229236 _parseTree ();
230237 }
231238 }
@@ -522,19 +529,87 @@ component accessors=true {
522529 " README.md" : true
523530 };
524531 var folder = " docs\recipes\" ;
525-
532+
526533 setRecipeDates (gitReader .getDatesForFolder ( repoRoot , folder , server .luceeDocsRecipeDateCache ?: {}, skip ));
527534 server .luceeDocsRecipeDateCache = duplicate (getRecipeDates ()); // this is expensive and docTree gets blown away on reload, plus applicationStop()
528535 request .logger (" Scanned git logs for recipes dates in #getTickCount ()- s #ms, found #structCount (getRecipeDates ()) # recipes" );
529536 }
530537
538+ private void function _loadSyspropEnvvars () {
539+ var s = getTickCount ();
540+
541+ // Get all sysprops/envvars from Lucee
542+ var allProps = getSystemPropOrEnvVar ();
543+ setSyspropEnvvars ( allProps );
544+
545+ // Build indexes by tag and function
546+ var byTag = {};
547+ var byFunction = {};
548+
549+ for ( var prop in allProps ) {
550+ // Index by tags (strip cf prefix for docs compatibility)
551+ if ( structKeyExists ( prop , " tags" ) && isArray ( prop .tags ) ) {
552+ for ( var tag in prop .tags ) {
553+ // Strip cf prefix if present (cfquery -> query)
554+ var tagKey = left ( tag , 2 ) == " cf" ? mid ( tag , 3 ) : tag ;
555+ if ( ! structKeyExists ( byTag , tagKey ) ) {
556+ byTag [ tagKey ] = [];
557+ }
558+ arrayAppend ( byTag [ tagKey ], prop );
559+ }
560+ }
561+
562+ // Index by functions
563+ if ( structKeyExists ( prop , " functions" ) && isArray ( prop .functions ) ) {
564+ for ( var func in prop .functions ) {
565+ if ( ! structKeyExists ( byFunction , func ) ) {
566+ byFunction [ func ] = [];
567+ }
568+ arrayAppend ( byFunction [ func ], prop );
569+ }
570+ }
571+ }
572+
573+ setSyspropByTag ( byTag );
574+ setSyspropByFunction ( byFunction );
575+
576+ request .logger ( " Loaded #arrayLen (allProps ) # sysprops/envvars in #getTickCount ()- s #ms" );
577+ }
578+
579+ public array function getSyspropsByTag ( required string tagName ) {
580+ var byTag = getSyspropByTag ();
581+ return structKeyExists ( byTag , arguments .tagName ) ? byTag [ arguments .tagName ] : [];
582+ }
583+
584+ public array function getSyspropsByFunction ( required string functionName ) {
585+ var byFunction = getSyspropByFunction ();
586+ return structKeyExists ( byFunction , arguments .functionName ) ? byFunction [ arguments .functionName ] : [];
587+ }
588+
531589 // hack first cut
532- public function renderContent ( required string content , boolean markdown = false ) {
533- switch (arguments .content ){
590+ public function renderContent ( required string content , required struct args , boolean markdown = false ) {
591+ // Extract hash parameter if present (e.g., "sysprop-envvar#LUCEE_ADMIN_ENABLED")
592+ var contentType = arguments .content ;
593+ var hashParam = " " ;
594+
595+ if ( find ( " ## " , contentType ) ) {
596+ hashParam = listLast ( contentType , " ## " );
597+ contentType = listFirst ( contentType , " ## " );
598+ }
599+
600+ switch (contentType ){
534601 case " latest-recipies" :
535- return new api .rendering .content .recipes ().render (this , content , getRecipeDates (), arguments .markdown );
602+ return new api .rendering .content .recipes ().render (this , contentType , getRecipeDates (), arguments .markdown );
603+ case " sysprop-envvar-listing" :
604+ return new api .rendering .content .syspropEnvvar ().render (this , contentType , arguments .args , arguments .markdown );
605+ case " sysprop-envvar" :
606+ return new api .rendering .content .syspropEnvvarInline ().render (this , contentType , arguments .args , hashParam , arguments .markdown );
607+ case " sysprop-envvar-for-tag" :
608+ return new api .rendering .content .syspropEnvvarForTag ().render (this , contentType , arguments .args , arguments .markdown );
609+ case " sysprop-envvar-for-function" :
610+ return new api .rendering .content .syspropEnvvarForFunction ().render (this , contentType , arguments .args , arguments .markdown );
536611 default :
537- throw (" unknown content type: " & arguments . content );
612+ throw (" unknown content type: " & contentType );
538613 }
539614 }
540615}
0 commit comments