Skip to content

Commit 1a03b64

Browse files
committed
LDEV-5850 Improve SysProp / Env Var documentation, use lucee content, render inline
1 parent 70ff463 commit 1a03b64

29 files changed

+754
-1175
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
with:
4242
webroot: ${{ github.workspace }}
4343
execute: /build-all.cfm
44-
luceeVersion: 7.0.0.381-SNAPSHOT
44+
luceeVersion: 7.0.1.15-SNAPSHOT
4545
# redis, chart, lucene, form. ajax, chart, argon2, websocket, ec2, json
4646
extensions: 60772C12-F179-D555-8E2CD2B4F7428718;version=3.0.0.54-SNAPSHOT,D46B46A9-A0E3-44E1-D972A04AC3A8DC10,EFDEB172-F52E-4D84-9CD1A1F561B3DFC8,FAD67145-E3AE-30F8-1C11A6CCF544F0B7,6E2CB28F-98FB-4B51-B6BE6C64ADF35473,DF28D0A4-6748-44B9-A2FDC12E4E2E4D38,7891D723-8F78-45F5-B7E333A22F8467CA,07082C66-510A-4F0B-B5E63814E2FDF7BE,261114AC-7372-4CA8-BA7090895E01682D,A03F4335-BDEF-44DE-946FB16C47802F96,3F9DFF32-B555-449D-B0EB5DB723044045
4747
- name: Upload Artifact

api/data/DocTree.cfc

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

api/lib/flexmark-0.32.20.jar

-377 KB
Binary file not shown.
-1.55 MB
Binary file not shown.
-33.1 KB
Binary file not shown.
-60 KB
Binary file not shown.
-70.9 KB
Binary file not shown.
-31.9 KB
Binary file not shown.
-6.69 KB
Binary file not shown.

api/lib/flexmark-util-0.32.20.jar

-285 KB
Binary file not shown.

0 commit comments

Comments
 (0)