Skip to content

Commit 2f6b366

Browse files
authored
Merge branch 'foundeo:master' into master
2 parents 4459748 + 81f7e4d commit 2f6b366

1,363 files changed

Lines changed: 13846 additions & 6887 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LUCEE_EXTENSIONS=37C61C0A-5D7E-4256-8572639BE0CF5838;name=ESAPI extension;version=2.2.4.13,B737ABC4-D43F-4D91-8E8E973E37C40D1B;name=Image extension;version=1.0.0.51

.fixinator.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignoreExtensions":["json","md"]
3+
}

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
workflow_dispatch:
10+
11+
env:
12+
TEST_RUNNER_URI: /tests/run.cfm?reporter=text
13+
14+
jobs:
15+
16+
cfmatrix:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
21+
#setup the matrix of CF Engines
22+
strategy:
23+
matrix:
24+
cfengine: ["lucee@5", "adobe@2018"]
25+
env:
26+
CFENGINE: ${{ matrix.cfengine }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Clone cfmatrix
31+
run: git clone --depth 1 https://github.com/foundeo/cfmatrix.git cfmatrix
32+
33+
- name: Install cfmatrix
34+
run: bash ./cfmatrix/install.sh
35+
36+
- name: Run Tests
37+
run: bash ./cfmatrix/run.sh
38+
39+
valid-json:
40+
runs-on: ubuntu-latest
41+
permissions:
42+
contents: read
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Install JSON Validator
46+
run: npm install -g ajv-cli
47+
- name: Make temp dir with files to check
48+
run: mkdir -p /tmp/cfdocs/
49+
- name: Copy files
50+
run: cp -r ./data/en/*.json /tmp/cfdocs/
51+
- name: Exclude index.json
52+
run: rm -f /tmp/cfdocs/index.json
53+
- name: Run JSON Validator
54+
run: ajv validate -s data/cfdocs.schema.json -d "/tmp/cfdocs/*.json" --use-defaults --errors=text --strict=log
55+
56+
fixinator:
57+
needs: valid-json
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
container:
62+
image: ghcr.io/foundeo/cfml-ci-tools/cfml-ci-tools:latest
63+
64+
steps:
65+
- uses: actions/checkout@v4
66+
- name: Run Fixinator
67+
run: box fixinator confidence=high
68+
env:
69+
FIXINATOR_API_KEY: ${{ secrets.FIXINATOR_API_KEY }}
70+

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ tests/.exitcode
88
WEB-INF/
99
.editorconfig
1010
server-cfdocs.json
11+
server-*.json
1112
server.json
1213
*.sublime-workspace
1314
*.sublime-project
15+
/.vscode
16+
.env
17+
assets/img/opengraph/

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: java
22
sudo: false
33
jdk:
4-
- oraclejdk8
4+
- openjdk8
55
env:
66
global:
77
- TEST_RUNNER_URI=/tests/run.cfm?reporter=text

Application.cfc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
<cfset application.categories[local.cat].items = local.catData.related>
2121
</cfif>
2222
</cfloop>
23-
<cfset application.guides = {}>
23+
<cfset var _guides = {}>
24+
<cfset application.guides = structNew('ordered')>
2425
<cfloop array="#application.index.guides#" index="local.guide">
2526
<cfset local.fileObj = fileOpen(ExpandPath("./guides/en/#local.guide#.md"),"read")>
2627
<cfset local.title = fileReadLine(local.fileObj)>
@@ -30,9 +31,11 @@
3031
<cfelse>
3132
<cfset local.title = local.guide>
3233
</cfif>
33-
<cfset application.guides[local.guide] = local.title>
34+
<cfset local._guides[local.guide] = local.title>
35+
</cfloop>
36+
<cfloop array="#structSort(local._guides, "textnocase", "asc")#" index="local.guide">
37+
<cfset application.guides[local.guide] = local._guides[local.guide]>
3438
</cfloop>
35-
3639
</cfif>
3740
<cfset request.content = "">
3841
<!--- cache for one day --->
@@ -45,9 +48,9 @@
4548

4649
<cfsavecontent variable="request.content"><cfinclude template="#arguments.targetPage#"></cfsavecontent>
4750
<cfparam name="request.cacheControlMaxAge" default="604800" type="integer">
48-
<cfheader name="Cache-Control" value="max-age=#Int(request.cacheControlMaxAge)#">
51+
<cfheader name="Cache-Control" value="public, max-age=#Int(request.cacheControlMaxAge)#">
4952
<cfif len(showError)><cfoutput>#showError#</cfoutput><cfflush></cfif>
50-
<cfcontent reset="true" type="text/html"><cfinclude template="views/layout.cfm">
53+
<cfinclude template="views/layout.cfm">
5154
</cffunction>
5255

5356
<cffunction name="linkTo" output="false">
@@ -63,19 +66,19 @@
6366
<cfif NOT len(arguments.exclude) AND structKeyExists(url, "name")>
6467
<cfset arguments.exclude = url.name>
6568
</cfif>
66-
<cfif ReFindNoCase("[^""]https?://", arguments.content)>
69+
<cfif find("://", arguments.content) AND ReFindNoCase("[^""]https?://", arguments.content)>
6770
<cfset arguments.content = ReReplaceNoCase(arguments.content, "([^""])(https?://[a-zA-Z0-9._/=&%?##+-]+)", "\1<a href=""\2"">\2</a>", "ALL")>
6871
</cfif>
69-
<cfif ReFindNoCase("\bApplication\.cfc\b", arguments.content)>
72+
<cfif findNoCase("Application", arguments.content) AND ReFindNoCase("\bApplication\.cfc\b", arguments.content)>
7073
<cfset arguments.content = ReReplaceNoCase(arguments.content, "\bApplication\.cfc\b", "<a href=""#linkTo('application-cfc')#"">Application.cfc</a>", "ALL")>
7174
</cfif>
7275
<cfloop array="#application.index.tags#" index="i">
73-
<cfif i IS NOT arguments.exclude>
76+
<cfif findNoCase(i, arguments.content) AND i IS NOT arguments.exclude>
7477
<cfset arguments.content = ReReplaceNoCase(arguments.content, "[ ](#i#)([ .!,])", " <a href=""#linkTo(i)#"">\1</a>\2", "all")>
7578
</cfif>
7679
</cfloop>
7780
<cfloop array="#application.index.functions#" index="i">
78-
<cfif i IS NOT arguments.exclude AND NOT ListFindNoCase("insert,include,now,invoke,array,query,each,second", i)>
81+
<cfif findNoCase(i, arguments.content) AND i IS NOT arguments.exclude AND NOT ListFindNoCase("insert,include,now,invoke,array,query,each,second", i)>
7982
<cfset arguments.content = ReReplaceNoCase(arguments.content, "([ >])(#i#)([< .!,])", "\1<a href=""#linkTo(i)#"">\2</a>\3", "all")>
8083
</cfif>
8184
</cfloop>
@@ -84,7 +87,7 @@
8487
<cfset arguments.content = ReReplace(arguments.content, "CF([0-9.]+\+)", "<span class=""label label-acf"" title=""Requires ColdFusion \1"">CF \1</span>", "ALL")>
8588
</cfif>
8689
<!--- add Luceex+ badge --->
87-
<cfif REFind("Lucee[0-9.]+\+", arguments.content)>
90+
<cfif findNoCase("lucee", arguments.content) AND REFind("Lucee[0-9.]+\+", arguments.content)>
8891
<cfset arguments.content = ReReplace(arguments.content, "Lucee([0-9.]+\+)", "<span class=""label label-lucee"" title=""Requires Lucee \1"">Lucee \1</span>", "ALL")>
8992
</cfif>
9093
<!--- replace \n with br tags --->
@@ -93,7 +96,9 @@
9396
</cfif>
9497
<!--- replace backticks with code tag block --->
9598
<cfset arguments.content = replace(arguments.content, "&##x60;", "`", "ALL")>
96-
<cfset arguments.content = ReReplace(arguments.content, "`([^`]+)`", "<code>\1</code>", "ALL")>
99+
<cfif find("`", arguments.content)>
100+
<cfset arguments.content = ReReplace(arguments.content, "`([^`]+)`", "<code>\1</code>", "ALL")>
101+
</cfif>
97102
<cfreturn arguments.content>
98103
</cffunction>
99104

@@ -144,7 +149,7 @@
144149
</div>
145150
</cfsavecontent>
146151

147-
<cfcontent reset="true" type="text/html"><cfheader statuscode="500" statustext="Server Error"><cfinclude template="views/layout.cfm">
152+
<cfcontent reset="true" type="text/html"><cfheader statuscode="500"><cfinclude template="views/layout.cfm">
148153
</cffunction>
149154

150155
</cfcomponent>

CONTRIBUTING.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,49 @@
99

1010
### Where can I find documentation about the JSON file format used?
1111

12-
It's documented in the [main README](/foundeo/cfdocs#json-file-documentation).
12+
It's documented in the [main README](https://github.com/foundeo/cfdocs#json-file-documentation).
13+
14+
### How do I add a new tag or function
15+
16+
All of the tags and functions are defined in a JSON file located in the [data/en](https://github.com/foundeo/cfdocs/tree/master/data/en) folder.
17+
18+
1. Check the [data/en](https://github.com/foundeo/cfdocs/tree/master/data/en) folder to make sure no one else has already added it
19+
2. Check the open [Pull Requests](https://github.com/foundeo/cfdocs/pulls) to make sure someone else has not already submitted it.
20+
3. Create a new JSON file, take a look at an existing [function](https://github.com/foundeo/cfdocs/edit/master/data/en/arraylen.json) or [tag](https://github.com/foundeo/cfdocs/edit/master/data/en/cfcase.json) and use the [JSON format documentation](https://github.com/foundeo/cfdocs#json-file-documentation) for reference. Make sure there are links to official documentation (if there is no official documentation, explain this in the pull request comment)
21+
4. Name it in all lowercase (eg `awesomefunction.json` or `cfawesome.json`)
22+
5. Locate the new file in the [data/en](https://github.com/foundeo/cfdocs/tree/master/data/en) folder
23+
6. Create a pull request
1324

1425
### What version of CF should the cfdocs CFML code work on?
1526

16-
It should run on Adobe ColdFusion 10+ or Lucee 4.5+ please make sure any changes
17-
made to the codebase work on these platforms. Sadly that means you can't use member
18-
functions at this time.
27+
It should run on Adobe ColdFusion 2016+ or Lucee 5+ please make sure any changes
28+
made to the codebase work on these platforms.
1929

2030
### Should I use tabs or spaces?
2131

2232
Tabs.
2333

24-
### For boolean values should I use `yes`/`no` or `true`/`false`
34+
### For boolean values should I use `yes`/`no` or `true`/`false` or `1`/`0`?
2535

2636
Use `true`/`false`
2737

38+
### Should I use implicit or explicit notation for arrays and structs?
39+
40+
Example:
41+
42+
arr = []; // implicit
43+
// is the same as
44+
arr = arrayNew(1);
45+
46+
unorderedStruct = {};
47+
orderedStruct = [:];
48+
// is the same as
49+
unorderedStruct = structNew();
50+
orderedStruct = structNew('ordered');
51+
52+
53+
Use implicit.
54+
2855
### How are my contributions licensed?
2956

3057
Please see the [LICENSE](https://github.com/foundeo/cfdocs/blob/master/LICENSE) file.

README.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# CFDocs
22

3-
CFDocs is a community maintained CFML reference tool available at [cfdocs.org](http://cfdocs.org). It features:
3+
CFDocs is a community maintained CFML reference tool available at [cfdocs.org](https://cfdocs.org). It features:
44
* Hosting on Amazon CloudFront CDN for fast responses around the globe. Sponsored by [Foundeo Inc.](http://foundeo.com).
5-
* Easy to use urls like: [cfdocs.org/hash](http:cfdocs.org/hash) just hit /tag-name or /function-name.
6-
* Publicly maintained on [GitHub](http://github.com/foundeo/cfdocs)
7-
8-
[![Build Status](https://travis-ci.org/foundeo/cfdocs.svg?branch=master)](https://travis-ci.org/foundeo/cfdocs)
5+
* Easy to use urls like: [cfdocs.org/hash](https://cfdocs.org/hash) just hit /tag-name or /function-name.
6+
* Publicly maintained on [GitHub](https://github.com/foundeo/cfdocs)
97

8+
[![CI](https://github.com/foundeo/cfdocs/actions/workflows/ci.yml/badge.svg)](https://github.com/foundeo/cfdocs/actions/workflows/ci.yml)
109

1110
## How reference data is structured
1211

13-
All of the tag and function documentation are defined in json files under [*data/en/functionname.json*](https://github.com/foundeo/cfdocs/tree/master/data/en) [function example](https://github.com/foundeo/cfdocs/blob/master/data/en/sessioninvalidate.json) [tag example](https://github.com/foundeo/cfdocs/blob/master/data/en/cfhtmltopdf.json).
12+
All of the tag and function documentation are defined in JSON files under [*data/en/functionname.json*](https://github.com/foundeo/cfdocs/tree/master/data/en) [function example](https://github.com/foundeo/cfdocs/blob/master/data/en/sessioninvalidate.json) [tag example](https://github.com/foundeo/cfdocs/blob/master/data/en/cfhtmltopdf.json).
1413

1514
This makes the documentation super easy to edit and allows developers to run a local version of the site "out of the box" since no database setup is required.
1615

@@ -22,46 +21,50 @@ This makes the documentation super easy to edit and allows developers to run a l
2221
The cfdocs.org site can run locally very easily thanks to CommandBox.
2322

2423
1. Go download [CommandBox](https://www.ortussolutions.com/products/commandbox) if you do not have it already.
25-
2. Download this repository and extract it to a folder, or clone it from this repository. If you are going to be making changes to the docs I would suggest you fork it, see Adam Tuttle's guide: [GitHub tip for your first pull request](https://adamtuttle.codes/your-first-github-pull-request/)
26-
3. Run `box server start` from Command Prompt or Terminal in the root directory.
24+
2. Download this repository and extract it to a folder, or clone it from this repository.
25+
3. Make a copy of `.env.example` and name it `.env`. This contains required environment variables. [learn more](https://github.com/commandbox-modules/commandbox-dotenv)
26+
4. Run `box server start` from Command Prompt or Terminal in the root directory.
2727

2828
CommandBox will start an embedded CFML server on port 8411, and you can browse to [http://localhost:8411/](http://localhost:8411/) to view the docs.
2929

30-
If you don't want to go the commandbox route you can simply download it and unzip it to a web root and try it out (requires CF10+ or Lucee 4.5+), but you will probably spend more time trying to get it working than the 1-2 minutes it will take to download and learn how to use commandbox.
30+
If you don't want to go the CommandBox route you can simply download it and unzip it to a web root and try it out (requires CF10+ or Lucee 4.5+), but you will probably spend more time trying to get it working than the 1-2 minutes it will take to download and learn how to use CommandBox.
3131

3232
## How to contribute
3333

34+
If you are interested in contributing going I suggest you fork it, see Adam Tuttle's guide: [GitHub tip for your first pull request](https://adamtuttle.codes/blog/2014/your-first-github-pull-request/)
35+
3436
If you are interested in helping you can just copy a tag or function and write up some documentation. The documentation doesn't need to be super wordy and should not be a copy of Adobe's documentation word for word.
3537

3638
CFDocs.org is meant to be a quick reference so keep it short and sweet. E.g. attribute names / function arguments and one two sentence descriptions.
3739

3840
#### The easy way to edit the docs
3941

40-
1. Browse the [data/en/](https://github.com/foundeo/cfdocs/tree/master/data/en) folder of this repository on github and find the tag or function you want to edit.
42+
1. Browse the [data/en/](https://github.com/foundeo/cfdocs/tree/master/data/en) folder of this repository on GitHub and find the tag or function you want to edit.
4143
2. Click the edit button (pencil)
42-
3. Commit / Send a pull request.
44+
3. Commit
45+
4. Send a pull request to merge your change with this repository.
4346

4447
#### The better way to edit the docs
4548

46-
1. fork the project to your GitHub account *need help? read this: [GitHub tip for your first pull request](http://fusiongrokker.com/post/github-tip-for-your-first-pull-request)*
49+
1. fork the project to your GitHub account *need help? read this: [GitHub tip for your first pull request](https://adamtuttle.codes/blog/2014/your-first-github-pull-request/)*
4750
2. clone it locally
4851
3. make your changes
49-
4. test it locally using commandbox (see above)
52+
4. test it locally using CommandBox (see above)
5053
4. once you are done you can send a pull request, and I'll merge it into the main repository.
5154

5255
### Not sure what you can contribute?
5356

5457
We need help expanding existing tag and function documentation. Look through the reference pages till you find one needing more definitions or examples. Also see:
5558

56-
* [Missing Descriptions](http://cfdocs.org/reports/missing-descriptions.cfm)
57-
* [Missing Examples](http://cfdocs.org/reports/missing-examples.cfm)
58-
* [Missing Related Links](http://cfdocs.org/reports/missing-related.cfm)
59-
* [Missing Functions](http://cfdocs.org/reports/todo.cfm)
59+
* [Missing Descriptions](https://cfdocs.org/reports/missing-descriptions.cfm)
60+
* [Missing Examples](https://cfdocs.org/reports/missing-examples.cfm)
61+
* [Missing Related Links](https://cfdocs.org/reports/missing-related.cfm)
62+
* [Missing Functions](https://cfdocs.org/reports/todo.cfm)
6063

6164
### JSON File Documentation
6265

6366
{
64-
"name":"NameOfTagOrFunction",
67+
"name":"nameOfTagOrFunction",
6568
"type":"function|tag",
6669
"syntax":"Tag(arg)|<cftag attr=1>",
6770
"member":"item.memberFunction([args])",
@@ -72,14 +75,14 @@ We need help expanding existing tag and function documentation. Look through the
7275
"function"
7376
],
7477
"description":"A short description that describes what the tag or function does.",
75-
"discouraged":"Only add this key if this tag/function is discouraged by the community.",
78+
"discouraged":"Only add this key if this tag/function is discouraged by the community. Displays a warning.",
7679
"params":[
77-
{"name":"funcArgNameOrTagAttributeName", "description":"What it does", "required":true, "default":"false", "type":"boolean", "values":["true", "false"]}
80+
{"name":"funcArgNameOrTagAttributeName", "description":"What it does", "required":true, "default":"false", "type":"boolean", "values":[]}
7881
],
7982
"engines":{
8083
"coldfusion":{"minimum_version":"10", "notes":"CF Specific Info Here", "docs":"http://learn.adobe.com/wiki/display/coldfusionen/function"},
81-
"railo":{"minimum_version":"4.1", "notes":"Railo Specific Here", "docs":"http://railodocs.org/index.cfm/function/sessionrotate"},
82-
"lucee":{"minimum_version":"4.5", "notes":"Lucee Specific Info Here", "docs":"http://docs.lucee.org/reference/functions/name.html"}
84+
"lucee":{"minimum_version":"4.5", "notes":"Lucee Specific Info Here", "docs":"https://docs.lucee.org/reference/functions/name.html"},
85+
"railo":{"minimum_version":"4.1", "notes":"Railo Specific Here", "docs":"http://railodocs.org/index.cfm/function/sessionrotate"}
8386
},
8487
"links":[
8588
{
@@ -106,7 +109,7 @@ The name of the tag or function, use lowercase.
106109

107110
##### type
108111

109-
Either `function` or `tag` or `listing` a *listing* is how categories are made, they simply contain a `name`, `description`, and a list of `related`
112+
Either `function` or `tag` or `listing` a *listing* is how categories are made, they simply contain a `name`, `description`, and a list of `related` items.
110113

111114
##### syntax
112115

@@ -122,7 +125,7 @@ For functions, shows the available member function syntax.
122125

123126
##### returns
124127

125-
The returntype of a function.
128+
The returntype of a function. Valid options are: `any`, `array`, `binary`, `boolean`, `date`, `function`, `guid`, `numeric`, `query`, `string`, `uuid`, `variableName`, `void`, `xml`. Default value is `void`.
126129

127130
##### related
128131

@@ -152,7 +155,7 @@ Use this to link to blog entries or other useful related content.
152155

153156
Show example code. It is very helpful to readers to use the `result` to show the expected result of the code sample when applicable. This has to be JSON, so you can to do `\n` for newline, double quotes must be escaped `\"`. The `runnable` is a boolean that determines if the _Run Code_ button shows up next to the example.
154157

155-
We have an [example JSON utility](http://cfdocs.org/utilities/json/) that can be used to create the JSON by filling out a form.
158+
We have an [example JSON utility](https://cfdocs.org/utilities/json/) that can be used to create the JSON by filling out a form.
156159

157160
Please see the [cfdocs contributor guide](CONTRIBUTING.md) for frequently asked questions.
158161

@@ -183,6 +186,4 @@ command! -nargs=0 CFdocs :call CFDocsSearch()
183186

184187
#### CFEclipse
185188

186-
Hit `F1` when the cursor is on a tag or function to be taken to the cfdocs.org doc. <http://cfeclipse.org/>
187-
188-
189+
Hit `F1` when the cursor is on a tag or function to be taken to the cfdocs.org doc.

0 commit comments

Comments
 (0)