Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a examples for lucee docs #887

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions docs/03.reference/01.functions/esapiencode/_examples.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
```luceescript+trycf
enc=ESAPIEncode("html","<table>");//html

enc = ESAPIEncode("html","<table>");//html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enc = ESAPIEncode("html","<table>");//html
enc = ESAPIEncode("html", "<table>");//html

writeDump(enc);
enc=ESAPIEncode('url','https://download.lucee.org/?type=releases');//URL
enc = ESAPIEncode("url",'https://download.lucee.org/?type=releases');//URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enc = ESAPIEncode("url",'https://download.lucee.org/?type=releases');//URL
enc = ESAPIEncode("url", "https://download.lucee.org/?type=releases");//URL

writeDump(enc);
enc = ESAPIEncode("xml","foo()");
writeDump(enc);
enc = ESAPIEncode("xml_attr","foo'()");
writeDump(enc);
enc = ESAPIEncode("ldap","foo'()");
writeDump(enc);
enc = ESAPIEncode("javascript","foo()");
writeDump(enc);
enc = ESAPIEncode("DN","foo(),foo");
writeDump(enc);
```


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

```lucee+trycf
<cfoutput>
<div style="color:#ESAPIEncode("css","red")#">Example for encodeforcss</div>
</cfoutput>
<cfoutput><div title="#ESAPIEncode("html_attr","<test>")#"></div></cfoutput>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

```
18 changes: 17 additions & 1 deletion docs/03.reference/01.functions/lsnumberformat/_examples.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
*There are currently no examples for this function.*

```lucee+trycf
<cfloop list="ar_AE,ar_JO,ar_SY,hr_HR,fr_BE,es_PA,mt_MT,es_VE,bg,zh_TW,it,ko,uk,lv,da_DK,es_PR,vi_VN,en_US,sr_ME,sv_SE,es_BO,en_SG,ar_BH,pt,ar_SA,sk,ar_YE,hi_IN,ga,en_MT" index="i" delimiters=",">
<cfset oldlocale = setLocale(i)>
<cfoutput><p><b><i>#i#</i></b><br />
#lsNumberFormat(-1234.5678, "_________")#<br />
#lsNumberFormat(-1234.5678, "_________.___")#<br />
#lsNumberFormat(1234.5678, "_________")#<br />
#lsNumberFormat(1234.5678, "_________.___")#<br />
#lsNumberFormat(1234.5678, "$_(_________.___)")#<br />
#lsNumberFormat(-1234.5678, "$_(_________.___)")#<br />
#lsNumberFormat(1234.5678, "+_________.___")#<br />
#lsNumberFormat(1234.5678, "-_________.___")#<br />
</cfoutput>
</cfloop>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

```
6 changes: 3 additions & 3 deletions docs/03.reference/01.functions/queryfilter/_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Dump( var=people, label="people - origional query" );
*/

//filter - older than 21
qryPeopleOldEnough = people.filter(function(row, rowNumber, qryData){
qryPeopleOldEnough = queryfilter(people,function(row, rowNumber, qryData){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
qryPeopleOldEnough = queryfilter(people,function(row, rowNumber, qryData){
qryPeopleOldEnough = queryfilter(people, function(row, rowNumber, qryData){

return DateDiff('yyyy', row.dob, Now()) > 21
});
dump(var=qryPeopleOldEnough, label='qryPeopleOldEnough - older than 21');
Expand Down Expand Up @@ -61,7 +61,7 @@ dump(var=qryPeopleOldEnough, label='qryPeopleOldEnough - older than 21');

<cftimer type="outline" label="query.filter() with scoped variables">
<cfscript>
q2 = q.filter(function(row){
q2 = queryfilter(q,function(row){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
q2 = queryfilter(q,function(row){
q2 = queryfilter(q, function(row){

return (arguments.row.description contains s);
});
</cfscript>
Expand All @@ -70,7 +70,7 @@ dump(var=qryPeopleOldEnough, label='qryPeopleOldEnough - older than 21');

<cftimer type="outline" label="query.filter() without unscoped variables">
<cfscript>
q3 = q.filter(function(row){
q3 = queryfilter(q,function(row){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
q3 = queryfilter(q,function(row){
q3 = queryfilter(q, function(row){

return (row.description contains s);
});
</cfscript>
Expand Down
25 changes: 24 additions & 1 deletion docs/03.reference/01.functions/structmap/_examples.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
*There are currently no examples for this function.*
###Struct map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
###Struct map
### Struct map


```luceescript+trycf

original = {
"one": {
1: "tahi"
},
"two": {
2: "rua"
},
"three": {
3: "toru"
},
"four": {
4: "wha"
}
};
function mapOriginal(k,v) {
return v[ListFirst(v.keyList())];
}
fixed = structMap(original,mapOriginal);
writeDump([original, fixed]);
```
13 changes: 12 additions & 1 deletion docs/03.reference/02.tags/insert/_examples.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
*There are currently no examples for this tag.*
###CFINSERT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
###CFINSERT
### CFINSERT


### Script syntax
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Script syntax
### Script syntax

```luceescript
cfinsert( datasource="myDsn", tablename="users", formFields="firstName,lastName,emailAddress" );

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

```
### CFML syntax
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### CFML syntax
### CFML syntax

```lucee
<cfinsert tablename="test" datasource="datasource1" formfields="#ffilist#">

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

```
1 change: 0 additions & 1 deletion docs/03.reference/05.objects/struct/map/_examples.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

```luceescript+trycf
original = {
"one": {
Expand Down