Skip to content

Commit 80a14e6

Browse files
Merge pull request #67 from delegateas/tst/xml-docs
docs: Added xml comments to some functions to generate function documentation
2 parents 66daffc + 76dc7e9 commit 80a14e6

21 files changed

+461
-16
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,28 @@ jobs:
4444
- name: Build solution
4545
run: dotnet build -o build/${{ matrix.dotnet }} -c Release --no-restore -m:1 -f ${{ matrix.dotnet }}
4646

47-
- name: Cache artifactes
47+
- name: Cache build artifacts
4848
uses: actions/cache@v2
4949
with:
50-
path: build
51-
key: ${{ runner.os }}-build-${{ env.cache-name }}-temp
50+
path: build/${{ matrix.dotnet }}
51+
key: ${{ runner.os }}-build-${{ matrix.dotnet }}
5252

5353
publish:
5454
runs-on: windows-latest
5555
name: Generate docs and publish artifacts
5656
needs: ['build']
5757
steps:
58-
- name: Get cache
58+
- name: Get cache - net5.0
5959
uses: actions/cache@v2
6060
with:
61-
path: build
62-
key: ${{ runner.os }}-build-${{ env.cache-name }}-temp
63-
64-
- run: dir
61+
path: build/net5.0
62+
key: ${{ runner.os }}-build-net5.0
6563

66-
- run: dir build
64+
- name: Get cache - netcoreapp3.1
65+
uses: actions/cache@v2
66+
with:
67+
path: build/netcoreapp3.1
68+
key: ${{ runner.os }}-build-netcoreapp3.1
6769

6870
- uses: actions/setup-dotnet@v1
6971
with:
@@ -73,7 +75,7 @@ jobs:
7375
run: dotnet new tool-manifest && dotnet tool install EAVFW.Extensions.Docs.TransformToMarkdown
7476

7577
- name: Generate docs
76-
run: dotnet tool run tomd --input build/netcoreapp3.1/ExpressionEngine.xml --output Documentation.md
78+
run: dotnet tool run tomd --input build/net5.0/ExpressionEngine.xml --output Documentation.md
7779

7880
- name: Archive build to artifacts
7981
uses: actions/upload-artifact@v2.3.1
@@ -82,5 +84,10 @@ jobs:
8284
path: |
8385
build/netcoreapp3.1/
8486
build/net5.0/
85-
Documentation.md
8687
retention-days: 5
88+
89+
- name: Archive documentation to artifacts
90+
uses: actions/upload-artifact@v2.3.1
91+
with:
92+
name: Documentation
93+
path: Documentation.md

ExpressionEngine/Functions/Implementations/StringFunctions/ConcatFunction.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,30 @@ public ConcatFunction() : base("concat")
1111
{
1212
}
1313

14+
/// <functionName>concat</functionName>
15+
/// <summary>
16+
/// Combine two or more strings, and return the combined string.
17+
/// </summary>
18+
/// <definition>
19+
/// concat('$lttext1$gt', '$lttext2$gt', ...)
20+
/// </definition>
21+
/// <parameters>
22+
/// <parameter def="$lttext1$gt, $lttext2$gt, ..." required="Yes" type="String">At least two strings to combine</parameter>
23+
/// </parameters>
24+
/// <returns>
25+
/// <value>$lttext1$gt, $lttext2$gt, ...</value>
26+
/// <type>String</type>
27+
/// <description>The string created from the combined input strings. <br/><br/> Note: The length of the result must not exceed 104,857,600 characters.</description>
28+
/// </returns>
1429
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1530
{
1631
if (parameters.Length < 2)
1732
{
1833
throw new ArgumentError("Too few arguments");
1934
}
2035

21-
return new ValueTask<ValueContainer>(new ValueContainer(parameters.Aggregate("", (current, value) => current + AuxiliaryMethods.VcIsString(value))));
36+
return new ValueTask<ValueContainer>(new ValueContainer(parameters.Aggregate("",
37+
(current, value) => current + AuxiliaryMethods.VcIsString(value))));
2238
}
2339
}
2440
}

ExpressionEngine/Functions/Implementations/StringFunctions/EndsWithFunction.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ public EndsWithFunction() : base("endsWith")
1010
{
1111
}
1212

13+
/// <functionName>endsWith</functionName>
14+
/// <summary>
15+
/// Check whether a string ends with a specific substring. Return true when the substring is found, or return false when not found. This function is not case-sensitive.
16+
/// </summary>
17+
/// <definition>
18+
/// endsWith('$lttext$gt', '$ltsearchText$gt')
19+
/// </definition>
20+
/// <parameters>
21+
/// <parameter def="$lttext$gt" required="Yes" type="String">The string to check</parameter>
22+
/// <parameter def="$lttext$gt" required="Yes" type="String">The ending substring to find</parameter>
23+
/// </parameters>
24+
/// <returns>
25+
/// <value>true or false</value>
26+
/// <type>Boolean</type>
27+
/// <description>Return true when the ending substring is found. Return false when not found.</description>
28+
/// </returns>
1329
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1430
{
1531
if (parameters.Length < 2)

ExpressionEngine/Functions/Implementations/StringFunctions/FormatNumberFunction.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ public FormatNumberFunction() : base("formatNumber")
1111
{
1212
}
1313

14+
/// <functionName>formatNumber</functionName>
15+
/// <summary>
16+
/// Return a number as a string that's based on the specified format.
17+
/// </summary>
18+
/// <definition>
19+
/// formatNumber($ltnumber$gt, $ltformat$gt, $ltlocale$gt)
20+
/// </definition>
21+
/// <parameters>
22+
/// <parameter def="$ltnumber$gt" required="Yes" type="Integer or Double">The value that you want to format.</parameter>
23+
/// <parameter def="$ltformat$gt" required="Yes" type="String">A composite format string that specifies the format that you want to use. For the supported numeric format strings, see Standard numeric format strings, which are supported by number.ToString($ltformat$gt, $ltlocale$gt).</parameter>
24+
/// <parameter def="$ltlocale$gt" required="Mo" type="String">The locale to use as supported by <c>number.ToString($ltformat$gt, $ltlocale$gt)</c>. If not specified, the default value is <c>en-us</c>.</parameter>
25+
/// </parameters>
26+
/// <returns>
27+
/// <value>$ltformatted-number$gt</value>
28+
/// <type>String</type>
29+
/// <description>The specified number as a string in the format that you specified. You can cast this return value to an <c>int</c> or <c>float</c>.</description>
30+
/// </returns>
1431
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1532
{
1633
if (parameters.Length < 2 || parameters.Length > 3)

ExpressionEngine/Functions/Implementations/StringFunctions/LengthFunction.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ public LengthFunction() : base("length")
1313
{
1414
}
1515

16+
/// <functionName>length</functionName>
17+
/// <summary>
18+
/// Return the number of items in a collection.
19+
/// </summary>
20+
/// <definition>
21+
/// length('$ltcollection$gt')
22+
/// length([$ltcollection$gt])
23+
/// </definition>
24+
/// <parameters>
25+
/// <parameter def="$ltcollection$gt" required="Yes" type="String or Array">The collection with the items to count</parameter>
26+
/// </parameters>
27+
/// <returns>
28+
/// <value>$ltlength-or-count$gt</value>
29+
/// <type>Integer</type>
30+
/// <description>The number of items in the collection</description>
31+
/// </returns>
1632
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1733
{
1834
if (parameters.Length != 1)

ExpressionEngine/Functions/Implementations/StringFunctions/ReplaceFunction.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ public ReplaceFunction() : base("replace")
1010
{
1111
}
1212

13+
14+
/// <functionName>replace</functionName>
15+
/// <summary>
16+
/// Replace a substring with the specified string, and return the result string. This function is case-sensitive.
17+
/// </summary>
18+
/// <definition>
19+
/// replace('$lttext$gt', '$ltoldText$gt', '$ltnewText$gt')
20+
/// </definition>
21+
/// <parameters>
22+
/// <parameter def="$lttext$gt" required="Yes" type="String">The string that has the substring to replace</parameter>
23+
/// <parameter def="$ltoldText$gt" required="Yes" type="String">The substring to replace</parameter>
24+
/// <parameter def="$ltnewtext$gt" required="Yes" type="String">The replacement string</parameter>
25+
/// </parameters>
26+
/// <returns>
27+
/// <value>$ltupdated-text$gt</value>
28+
/// <type>String</type>
29+
/// <description>The updated string after replacing the substring<br/>If the substring is not found, return the original string.</description>
30+
/// </returns>
1331
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1432
{
1533
if (parameters.Length < 3)

ExpressionEngine/Functions/Implementations/StringFunctions/SplitFunction.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ public SplitFunction() : base("split")
1212
{
1313
}
1414

15+
/// <functionName>split</functionName>
16+
/// <summary>
17+
/// Return an array that contains substrings, separated by commas, based on the specified delimiter character in the original string.
18+
/// </summary>
19+
/// <definition>
20+
/// split('$lttext$gt', '$ltdelimiter$gt')
21+
/// </definition>
22+
/// <parameters>
23+
/// <parameter def="$lttext$gt" required="Yes" type="String">The string to separate into substrings based on the specified delimiter in the original string</parameter>
24+
/// <parameter def="$lttext$gt" required="Yes" type="String">The character in the original string to use as the delimiter</parameter>
25+
/// </parameters>
26+
/// <returns>
27+
/// <value>[$ltsubstring1$gt,$ltsubstring2$gt,...]</value>
28+
/// <type>Array</type>
29+
/// <description>An array that contains substrings from the original string, separated by commas</description>
30+
/// </returns>
31+
// [ArguementAttribute()]
32+
// [ArguementAttribute()]
1533
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1634
{
1735
if (parameters.Length < 2)

ExpressionEngine/Functions/Implementations/StringFunctions/StartsWithFunction.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,36 @@ public StartsWithFunction() : base("startsWith")
1010
{
1111
}
1212

13+
/// <functionName>startsWith</functionName>
14+
/// <summary>
15+
/// Check whether a string starts with a specific substring. Return true when the substring is found, or return false when not found. This function is not case-sensitive.
16+
/// </summary>
17+
/// <definition>
18+
/// startsWith('$lttext$gt', '$ltsearchText$gt')
19+
/// </definition>
20+
/// <parameters>
21+
/// <parameter def="$lttext$gt" required="Yes" type="String">The string to check</parameter>
22+
/// <parameter def="$ltsearchText$gt" required="Yes" type="String">The starting string to find</parameter>
23+
/// </parameters>
24+
/// <returns>
25+
/// <value>true or false</value>
26+
/// <type>Boolean</type>
27+
/// <description>Return true when the starting substring is found. Return false when not found.</description>
28+
/// </returns>
29+
/// <example>
30+
/// This example checks whether the "hello world" string starts with the "hello" substring:
31+
/// <code>
32+
/// startsWith('hello world', 'hello')
33+
/// </code>
34+
/// And returns this result: <c>true</c>
35+
///
36+
///
37+
/// This example checks whether the "hello world" string starts with the "greetings" substring:
38+
/// <code>
39+
/// startsWith('hello world', 'greetings')
40+
/// </code>
41+
/// And returns this result: <c>false</c>
42+
/// </example>
1343
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1444
{
1545
if (parameters.Length < 2)

ExpressionEngine/Functions/Implementations/StringFunctions/SubstringFunction.cs

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,34 @@ public SubstringFunction() : base("substring")
1010
{
1111
}
1212

13+
14+
/// <functionName>substring</functionName>
15+
/// <summary>
16+
/// Return characters from a string, starting from the specified position, or index. Index values start with the number 0.
17+
/// </summary>
18+
/// <definition>
19+
/// substring('$lttext$gt', $ltstartIndex$gt, $ltlength$gt)
20+
/// </definition>
21+
/// <parameters>
22+
/// <parameter def="$lttext$gt" required="Yes" type="String">The string whose characters you want</parameter>
23+
/// <parameter def="$ltstartIndex$gt" required="Yes" type="Integer">A positive number equal to or greater than 0 that you want to use as the starting position or index value</parameter>
24+
/// <parameter def="$ltlength$gt" required="Yes" type="Integer">A positive number of characters that you want in the substring</parameter>
25+
/// </parameters>
26+
/// <note>
27+
/// Make sure that the sum from adding the startIndex and length parameter values is less than the length of the string that you provide for the text parameter. Otherwise, you get an error, unlike similar functions in other languages where the result is the substring from the startIndex to the end of the string. The length parameter is optional and if not provided, the substring() function takes all the characters beginning from startIndex to the end of the string.
28+
/// </note>
29+
/// <returns>
30+
/// <value>$ltsubstring-result$gt</value>
31+
/// <type>String</type>
32+
/// <description>A substring with the specified number of characters, starting at the specified index position in the source string</description>
33+
/// </returns>
34+
/// <example>
35+
/// This example creates a five-character substring from the specified string, starting from the index value 6:
36+
/// <code>
37+
/// substring('hello world', 6, 5)
38+
/// </code>
39+
/// And returns this result: <c>"world"</c>
40+
/// </example>
1341
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1442
{
1543
if (parameters.Length < 2 || parameters.Length > 3)
@@ -20,9 +48,10 @@ public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[
2048
var str = parameters[0].GetValue<string>();
2149
var startIndex = parameters[1].GetValue<int>();
2250

23-
if (parameters.Length <= 2) return new ValueTask<ValueContainer>(new ValueContainer(str.Substring(startIndex)));
24-
25-
51+
if (parameters.Length <= 2)
52+
return new ValueTask<ValueContainer>(new ValueContainer(str.Substring(startIndex)));
53+
54+
2655
var length = parameters[2].GetValue<int>();
2756

2857
if (startIndex + length > str.Length)

ExpressionEngine/Functions/Implementations/StringFunctions/ToLowerFunction.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ public ToLowerFunction() : base("toLower")
1010
{
1111
}
1212

13+
/// <functionName>toLower</functionName>
14+
/// <summary>
15+
/// Return a string in lowercase format. If a character in the string doesn't have a lowercase version, that character stays unchanged in the returned string.
16+
/// </summary>
17+
/// <definition>
18+
/// toLower('$lttext$gt')
19+
/// </definition>
20+
/// <parameters>
21+
/// <parameter def="$lttext$gt" required="Yes" type="String">The string to return in lowercase format</parameter>
22+
/// </parameters>
23+
/// <returns>
24+
/// <value>$ltlowercase-text$gt</value>
25+
/// <type>String</type>
26+
/// <description>The original string in lowercase format</description>
27+
/// </returns>
28+
/// <example>
29+
/// This example converts this string to lowercase:
30+
/// <code>
31+
/// toLower('Hello World')
32+
/// </code>
33+
/// And returns this result: <c>"hello world"</c>
34+
/// </example>
1335
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
1436
{
1537
if (parameters.Length != 1)

0 commit comments

Comments
 (0)