From 079ea9a8fd28a770ad4a0c8f853579048af790f3 Mon Sep 17 00:00:00 2001 From: Joe Moceri Date: Sun, 1 Aug 2021 03:31:22 -0700 Subject: [PATCH] changes --- .../Io.JoeMoceri.FieldMapper.FieldMapper.html | 229 ------------------ docs/api/Io.JoeMoceri.FieldMapper.html | 119 --------- docs/articles/Examples.html | 17 +- docs/articles/FieldMapper.html | 2 + docs/articles/Overview.html | 2 + docs/manifest.json | 27 ++- .../FieldMapperForDotNet.csproj | 20 +- .../FieldMapperForDotNet.xml | 84 +++++++ src/FieldMapperForDotNet/articles/Examples.md | 17 +- .../articles/FieldMapper.md | 6 +- src/FieldMapperForDotNet/articles/Overview.md | 2 + 11 files changed, 156 insertions(+), 369 deletions(-) delete mode 100644 docs/api/Io.JoeMoceri.FieldMapper.FieldMapper.html delete mode 100644 docs/api/Io.JoeMoceri.FieldMapper.html create mode 100644 src/FieldMapperForDotNet/FieldMapperForDotNet.xml diff --git a/docs/api/Io.JoeMoceri.FieldMapper.FieldMapper.html b/docs/api/Io.JoeMoceri.FieldMapper.FieldMapper.html deleted file mode 100644 index a353129..0000000 --- a/docs/api/Io.JoeMoceri.FieldMapper.FieldMapper.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - Class FieldMapper - - - - - - - - - - - - - - - - -
-
- - - - -
- - - -
- - - - - - diff --git a/docs/api/Io.JoeMoceri.FieldMapper.html b/docs/api/Io.JoeMoceri.FieldMapper.html deleted file mode 100644 index ad4b758..0000000 --- a/docs/api/Io.JoeMoceri.FieldMapper.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - Namespace FieldMapperForDotNet - - - - - - - - - - - - - - - - -
-
- - - - -
- - - -
- - - - - - diff --git a/docs/articles/Examples.html b/docs/articles/Examples.html index 24f589a..1d92d96 100644 --- a/docs/articles/Examples.html +++ b/docs/articles/Examples.html @@ -77,10 +77,23 @@

Examples

Description

To see these in action, check out the Tests Project and Sample Project.

Field Mapper

-

Map values out of a given string.

-
public void Example()
+

Map a first name out of a given string.

+
public void MapFirstName()
 {
+    // Arrange
+    string key = "First Name:";
+    string value = "Joe";
 
+    var content = $"{key} {value}";
+    var mappings = new List<string>();
+    mappings.Add(key);
+
+    // Act
+    var parser = new FieldMapper();
+    var result = parser.Get(content, mappings);
+
+    // Assert
+    Assert.AreEqual(value, result[key]);
 }
 
diff --git a/docs/articles/FieldMapper.html b/docs/articles/FieldMapper.html index 18b7de5..8e9004f 100644 --- a/docs/articles/FieldMapper.html +++ b/docs/articles/FieldMapper.html @@ -69,6 +69,8 @@

Field Mapper

+

This class is used for parsing data out of plain-text and html body contact form submission emails. Given a set of mappings, it will identify values from left-to-right, map them, and return a dictionary as the result.

+

This class can be customized using Configurations. Right now this supports de-entitizing html body emails and allowing or disabling separating mappings with line breaks. Default settings are recommended. When using plain-text, disabling de-entitizing is helpful to keep mappings consisent.

diff --git a/docs/articles/Overview.html b/docs/articles/Overview.html index bcdda5c..3ec3ecf 100644 --- a/docs/articles/Overview.html +++ b/docs/articles/Overview.html @@ -76,7 +76,9 @@

Overview

  • Links
  • Field Mapper

    +

    C# .NET Library that will map out values from a given string. This is primarily used for parsing data out of html and plain-text body contact form submission emails, such as those from Contact Form 7 and WPForms on Wordpress. It will return a Dictionary with the mapping / value mapped as the key-value pair.

    Not Supported

    +

    Having the same key multiple times.

    Please see Examples for how to use.

    diff --git a/docs/manifest.json b/docs/manifest.json index e9f3bbb..6fb065d 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -4,6 +4,9 @@ "xrefmap": "xrefmap.yml", "files": [ { + "log_codes": [ + "DuplicateUids" + ], "type": "ManagedReference", "source_relative_path": "api/FieldMapperForDotNet.FieldMapper.yml", "output": { @@ -48,16 +51,13 @@ "output": { ".html": { "relative_path": "api/FieldMapperForDotNet.html", - "hash": "lvGTq4hloszGnQSRgsfhh9xCGP4TwHOlcFoNPODNPCM=" + "hash": "z9AciqKO654EA3CNCGU1qAaXPMpt8CqZ2aVKxjkdcvI=" } }, "is_incremental": true, "version": "" }, { - "log_codes": [ - "DuplicateUids" - ], "type": "ManagedReference", "source_relative_path": "api/Io.JoeMoceri.FieldMapper.FieldMapper.yml", "output": { @@ -75,7 +75,7 @@ "output": { ".html": { "relative_path": "api/Io.JoeMoceri.FieldMapper.html", - "hash": "ELWi8xJwwHsjMfBkSrSTSZSR/CUyXwjFJ+lf8fGjuuc=" + "hash": "caYIS1/FsGBoBFdM4Nlb9enwZxNNkZ3yn2WIle8Uu/I=" } }, "is_incremental": true, @@ -90,7 +90,7 @@ "hash": "DG4oVFNun0Ov6QJdqWiYg0wVxBSCJ/1EEmsI55E4CbI=" } }, - "is_incremental": false, + "is_incremental": true, "version": "" }, { @@ -123,19 +123,22 @@ "output": { ".html": { "relative_path": "articles/Examples.html", - "hash": "4zWfv/U/ycMv3HDDYgLOyzzu7GMUpmU2QL1aU2eOIsw=" + "hash": "SRa5am8cTHdATFm8geB0KsaTxLXVWsY2/pg8j7BAcwE=" } }, "is_incremental": true, "version": "" }, { + "log_codes": [ + "InvalidFileLink" + ], "type": "Conceptual", "source_relative_path": "articles/FieldMapper.md", "output": { ".html": { "relative_path": "articles/FieldMapper.html", - "hash": "34sMS6ef1BtnwxdIg1pUTJkEvYvKUw4TxxdAlN0Cb9M=" + "hash": "aqHHeGB784NXtd5UxELtzJtuf/+Ba3uDqzdkvNlYJFQ=" } }, "is_incremental": true, @@ -162,7 +165,7 @@ "hash": "jsehnRDgHK8xwmWZRTYIn10AWZvSsPz8snK7QVfVlHU=" } }, - "is_incremental": false, + "is_incremental": true, "version": "" }, { @@ -174,7 +177,7 @@ "output": { ".html": { "relative_path": "articles/Overview.html", - "hash": "obG6thNu9m0SSI1/ZWJSfwB1+uGhMxkJzjQAVOBXAQI=" + "hash": "lP6vbQdHI7BSowRzYrLV7srGq1N+X6xPAqZRHM4Bi6M=" } }, "is_incremental": true, @@ -262,7 +265,7 @@ "hash": "YBlqpWhXtN7xuc9cVdKV7xsQ4WhFRS0n9h+q0RLCS8s=" } }, - "is_incremental": false, + "is_incremental": true, "version": "" }, { @@ -291,7 +294,7 @@ "can_incremental": true, "incrementalPhase": "build", "total_file_count": 11, - "skipped_file_count": 8 + "skipped_file_count": 11 }, "ManagedReferenceDocumentProcessor": { "can_incremental": true, diff --git a/src/FieldMapperForDotNet/FieldMapperForDotNet.csproj b/src/FieldMapperForDotNet/FieldMapperForDotNet.csproj index c94d94c..b1a1334 100644 --- a/src/FieldMapperForDotNet/FieldMapperForDotNet.csproj +++ b/src/FieldMapperForDotNet/FieldMapperForDotNet.csproj @@ -4,17 +4,29 @@ Library net5.0 - https://github.com/jmoceri34/field-mapper + https://github.com/joemoceri/field-mapper-dotnet icon.png Joe Moceri - Field Mapper is a mapping tool built for C# .NET to parse a given string into key / value pairs using the keys as markers to identify values. Please see github repository for examples. - https://github.com/jmoceri34/field-mapper - parsing, mapping, csharp, net, string parsing, email + Field Mapper for .NET is a mapping library that can parse a given string into key / value pairs using the keys as markers to identify values. + https://github.com/joemoceri/field-mapper-dotnet + parsing, mapping, csharp, net, string parsing, email, forms, form fields, fields, mapping, utilities, tools, libraries, library true + true + snupkg + LICENSE + + + + $(MSBuildThisFileDirectory)\bin\$(Configuration)\$(TargetFramework)\FieldMapperForDotNet.xml + 1701;1702;1591 + + True + + diff --git a/src/FieldMapperForDotNet/FieldMapperForDotNet.xml b/src/FieldMapperForDotNet/FieldMapperForDotNet.xml new file mode 100644 index 0000000..0c3d51d --- /dev/null +++ b/src/FieldMapperForDotNet/FieldMapperForDotNet.xml @@ -0,0 +1,84 @@ + + + + FieldMapperForDotNet + + + + + This is the main class used for mapping fields + + + + + The configuration holds options that can change the behavior of the tool, such as choosing whether to DeEntitize the content first. + + + + + By default it uses + + + + + You can pass in your own + + + + + + Use this to see what the mappings should look like before they're mapped to values. + + The string content. + The mappings to apply to the content. + + + + + This is the main method for getting values out of a string with mappings. + + The string content. + The mappings. + + + + + Internal method used to handle various mapping issues when trying to retrieve the right index + + The string content. + The mappings. + The mapping it is looking for. + + + + + Use this class to customize the behavior of the field mapper. + + + + + You can modify the options to change how the field mapper works when running + + + + + By default initalizes the options with as true and as true. + + + + + These are the options used in the configuration for the field mapper. Use them to customize the behavior of the field mapper. + + + + + This will DeEntitize the content by stripping all html and other relevant characters. If you're pulling plain-text, you can set this to false most likely. If you're pulling html strings, you may want it true. + + + + + This keeps everything clean, recommend leaving as true + + + + diff --git a/src/FieldMapperForDotNet/articles/Examples.md b/src/FieldMapperForDotNet/articles/Examples.md index 51f132e..f7ee539 100644 --- a/src/FieldMapperForDotNet/articles/Examples.md +++ b/src/FieldMapperForDotNet/articles/Examples.md @@ -10,11 +10,24 @@ To see these in action, check out the [Tests Project](https://github.com/joemoce #### Field Mapper -Map values out of a given string. +Map a first name out of a given string. ```csharp -public void Example() +public void MapFirstName() { + // Arrange + string key = "First Name:"; + string value = "Joe"; + var content = $"{key} {value}"; + var mappings = new List(); + mappings.Add(key); + + // Act + var parser = new FieldMapper(); + var result = parser.Get(content, mappings); + + // Assert + Assert.AreEqual(value, result[key]); } ``` \ No newline at end of file diff --git a/src/FieldMapperForDotNet/articles/FieldMapper.md b/src/FieldMapperForDotNet/articles/FieldMapper.md index e4f89ca..ed4b550 100644 --- a/src/FieldMapperForDotNet/articles/FieldMapper.md +++ b/src/FieldMapperForDotNet/articles/FieldMapper.md @@ -1 +1,5 @@ -### Field Mapper \ No newline at end of file +### Field Mapper + +This class is used for parsing data out of plain-text and html body contact form submission emails. Given a set of mappings, it will identify values from left-to-right, map them, and return a dictionary as the result. + +This class can be customized using [Configurations](../api/FieldMapperForDotNet.FieldMapperConfiguration.html). Right now this supports de-entitizing html body emails and allowing or disabling separating mappings with line breaks. Default settings are recommended. When using plain-text, disabling de-entitizing is helpful to keep mappings consisent. \ No newline at end of file diff --git a/src/FieldMapperForDotNet/articles/Overview.md b/src/FieldMapperForDotNet/articles/Overview.md index f4f328a..6245ce6 100644 --- a/src/FieldMapperForDotNet/articles/Overview.md +++ b/src/FieldMapperForDotNet/articles/Overview.md @@ -7,9 +7,11 @@ ### Field Mapper +C# .NET Library that will map out values from a given string. This is primarily used for parsing data out of html and plain-text body contact form submission emails, such as those from Contact Form 7 and WPForms on Wordpress. It will return a Dictionary with the mapping / value mapped as the key-value pair. ### Not Supported +Having the same key multiple times. ### Links