Skip to content

Commit

Permalink
Merge pull request #6 from jeremy-farrance/AccuTheme-AccuKit11
Browse files Browse the repository at this point in the history
Ignore the Branch name; worked on DocFX
  • Loading branch information
jeremy-farrance authored Nov 8, 2023
2 parents 57f3d26 + f9641ba commit 0e456ee
Show file tree
Hide file tree
Showing 177 changed files with 10,044 additions and 45 deletions.
31 changes: 6 additions & 25 deletions Libraries/AccuLadder/Accu/DevHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Accuraty.Libraries.AccuLadder
public partial class Accu
{
/// <summary>
/// Accu.Dev Helper - Tools, utilities, and shortcuts for DNN and 2SC projects
/// Accu.Dev Helper - Tools, utilities, and shortcuts to assist with developing stuff inside DNN and 2SC projects
/// </summary>
public class Dev
{
Expand Down Expand Up @@ -139,29 +139,6 @@ public static string CombinePathSegments(string pathSeparator = "/", params stri
return combinedPath;
}

/// <summary>
/// Turn any text or title in to a URL Slug
/// </summary>
/// <param name="phrase">Any string to be converted to a Slug</param>
/// <remarks>Source: https://stackoverflow.com/questions/2920744/url-slugify-algorithm-in-c</remarks>
/// <remarks>TODO find better version that does more (with hyphens; multiples and trailing)</remarks>
public static string ToSlug(string phrase)
{
byte[] bytes = Encoding.GetEncoding("Cyrillic").GetBytes(phrase);
string str = Encoding.ASCII.GetString(bytes);
str = str.ToLower();
// invalid chars
str = Regex.Replace(str, @"[^a-z0-9\s-]", "");
// convert multiple spaces into one space
str = Regex.Replace(str, @"\s+", " ").Trim();
// cut and trim
str = str.Substring(0, str.Length <= 45 ? str.Length : 45).Trim();
str = Regex.Replace(str, @"\s", "-"); // space to hyphen
str = Regex.Replace(str, @"-{2,}", "-"); // multiple hyphens to one hyphen
str = str.Trim('-'); // trim hyphens from ends
return str;
}

/// <summary>
/// Get the version of an installed DLL in /bin
/// </summary>
Expand Down Expand Up @@ -241,8 +218,12 @@ public static string GetIpAddressFromHost(string host)
}
return ip;
}
}

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
[Obsolete("Deprecated, instead use: Accu.Web.ToSlug(phrase)")]
public static string ToSlug(string phrase) { return Accu.Web.ToSlug(phrase); }

}

} // class Accu
} // end of namespace Accuraty.Libraries.AccuLadder
5 changes: 2 additions & 3 deletions Libraries/AccuLadder/Accu/DnnHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ namespace Accuraty.Libraries.AccuLadder
/// </summary>
public partial class Accu
{
/// <summary>
/// Accu.Dnn Helper - Tools, utilities, and shortcuts for DNN-specific things
/// </summary>

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public partial class Dnn
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Libraries/AccuLadder/Accu/IconHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Accuraty.Libraries.AccuLadder
public partial class Accu
{
/// <summary>
/// Accu.Dnn Helper - Tools, utilities, and shortcuts for DNN-specific things
/// Accu.Icon Helper - Simple syntax to an Icon on the page
/// </summary>
public partial class Icon
{
Expand Down
2 changes: 1 addition & 1 deletion Libraries/AccuLadder/Accu/NxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public partial class Accu
{

/// <summary>
/// Accu.Nx Helper - Experimental Tools, utilities, and shortcuts for 2sxc-specific things
/// Accu.Nx Helper - Experimental Tools, utilities, and shortcuts for DNN or 2sxc things
/// </summary>
public class Nx
{
Expand Down
27 changes: 26 additions & 1 deletion Libraries/AccuLadder/Accu/WebHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Web;
using System.Drawing; // TODO Remove this dependency? But what to replace it with? Microsoft's System.Drawing.Common? Open Source ImageSharp?
using System.Text.RegularExpressions;
using System.Text;

namespace Accuraty.Libraries.AccuLadder
{
Expand All @@ -10,10 +12,33 @@ public partial class Accu
{

/// <summary>
/// Accu.Sxc Helper - Tools, utilities, and shortcuts for 2sxc-specific things
/// Accu.Web Helper - Tools, utilities, and shortcuts for web-specific things
/// </summary>
public class Web
{
/// <summary>
/// Turn any text or title in to a URL Slug
/// </summary>
/// <param name="phrase">Any string to be converted to a Slug</param>
/// <remarks>Source: https://stackoverflow.com/questions/2920744/url-slugify-algorithm-in-c</remarks>
/// <remarks>TODO find better version that does more (with hyphens; multiples and trailing)</remarks>
public static string ToSlug(string phrase)
{
byte[] bytes = Encoding.GetEncoding("Cyrillic").GetBytes(phrase);
string str = Encoding.ASCII.GetString(bytes);
str = str.ToLower();
// invalid chars
str = Regex.Replace(str, @"[^a-z0-9\s-]", "");
// convert multiple spaces into one space
str = Regex.Replace(str, @"\s+", " ").Trim();
// cut and trim
str = str.Substring(0, str.Length <= 45 ? str.Length : 45).Trim();
str = Regex.Replace(str, @"\s", "-"); // space to hyphen
str = Regex.Replace(str, @"-{2,}", "-"); // multiple hyphens to one hyphen
str = str.Trim('-'); // trim hyphens from ends
return str;
}

/// <summary>
/// Get the width from an image file
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Libraries/AccuLadder/Accu/_CompatibilityHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class AccuKit
public static HtmlString BootstrapIcon(string iconName) { return Accu.Theme.BootstrapIcon(iconName); }
[Obsolete("Deprecated, instead use: Accu.Dnn.IsSuper()")]
public static bool isSuperUser() { return Accu.Dnn.IsSuper(); }
[Obsolete("Deprecated, instead use: Accu.Dev.ToSlug(phrase)")]
public static string ToSlug(string phrase) { return Accu.Dev.ToSlug(phrase); }
[Obsolete("Deprecated, instead use: Accu.Web.ToSlug(phrase)")]
public static string ToSlug(string phrase) { return Accu.Web.ToSlug(phrase); }
/// <summary>Obsolete: Deprecated, use: Accu.Dev.GetIpAddress() instead</summary>
[Obsolete("Deprecated, instead use: Accu.Dev.IsAccuratyIp()")]
public static bool isAccuratyIP() { return Accu.Dev.IsAccuratyIp(); }
Expand Down
20 changes: 16 additions & 4 deletions Libraries/AccuLadder/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# AccuLadder

## How to Generate the Docs
## How to Generate the Docs (DocFX)

On REMOTE101, PowerShell or command line to C:\dev\gen\
Then, run the following command: `docfx .\docfx\docfx.json --serve`
PowerShell or command line to C:\dev\gen\docfx
Then, run the following command: `docfx build docfx.json [--serve]`
Then, browse to http://localhost:8080/

TODO: Add a script to do this automatically and public to GitHub Pages
It builds into `C:\dev\gh.io\jeremy-farrance\AccuLadder` which is git remote for
https://github.com/jeremy-farrance/jeremy-farrance.github.io

To publish, open the VS Code project and publish main directly to the remote repo.

Key files:
- docfx.json
- templates/modern/
- layout/_master.tmpl
- public/main.css
- others?

TODO: Automate all the above on Release builds

[Current Documentation (WIP v1.0.8)](https://jeremy-farrance.github.io/AccuLadder/api/Accuraty.Libraries.AccuLadder.html)

Expand Down
8 changes: 8 additions & 0 deletions Libraries/AccuLadder/releasenotes.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@

<h2>AccuLadder Libraries Extension for DNN</h2>

<p>Version 01.00.09</p>
<ul>
<li>Add IconHelper; works, but needs think, renaming, refactoring</li>
<li>Fixed .ToSlug; moved from Accu.Dev to Accu.Web</li>
<li>Got DocFX working well, slightly customized the theme</li>
<li>Added How To Generate Docs details in README.md</li>
<li>Minor clean ups, other trivial fixes like capitalization</li>
</ul>
<p>Version 01.00.08</p>
<ul>
<li>including 01.00.07.00 (.06 thru .07.02)</li>
Expand Down
13 changes: 12 additions & 1 deletion docfx/articles/intro.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# Add your introductions here!
# AccuLadder Examples

- ACCU4: More / [AccuLadder](https://www.accu4.com/AccuThings/AccuLadder)
- ACCU4: More / [AccuLadder Experiments](https://www.accu4.com/More-/AccuLadder-Experiments)

# Initial Projects using AccuLadder v1.x Alpha and Beta

- [ACCU4.COM](https://accu4.com)
- BEACN2023 (VPN/WEBSVR4)
- FASS/AETA2023
- FASS/ARPAS2023
- CCFP2023
14 changes: 10 additions & 4 deletions docfx/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,21 @@
]
}
],
"output": "_site",
"output": "../../gh.io/jeremy-farrance/AccuLadder",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default",
"modern"
"templates/default",
"templates/modern"
],
"globalMetadata": {
// Other metadata...
"_appTitle": " Open Source by Accuraty Solutions",
"_appFooter": "Note: a clear blue sky is just the surface of the ocean of the universe.",
"_appLogoPath": "images/accu-logo.svg"
},
"postProcessors": [],
"keepFileLink": false,
"disableGitFeatures": false
}
}
}
1 change: 1 addition & 0 deletions docfx/images/accu-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 91 additions & 3 deletions docfx/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,92 @@
# This is the **HOMEPAGE**.
Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files.
# AccuLadder v1.0.9+
This is the basic reference for Accuraty's common library of tools, utilities, and doohickies for DNN+2sxc projects.
This replaces AccuKit so far and will also replace RazorKit, AccuKit11, and other libraries that are used in
Accuraty's DNN+2sxc projects (usually in the /App_Code folder).

## Quick Start Notes:
1. Add images to the *images* folder if the file is referencing an image.

### Installation
Install the latest release from the project's [GitHub Release](https://github.com/jeremy-farrance/AccuratySolutions-2023/releases) page in the usual DNN way.
> [!CAUTION]
> This applies to Accuraty projects only. Intallation on projects with old libraries in the /App_Code folder require some additional steps;
this was expected, see JRF. More on this <mark>below</mark>.
### Upgrade
Install a newer version, its a normal DNN extension install, it will just upgrade the existing version.

## Alpha and Experimental
This project is in alpha and experimental. Any release marked `Latest` is good for production use. It is not recommended for use in any project that is not under active development by a developer who is familiar with the code and is able to fix any issues that may arise.

## How to Use
Once AccuLadder is installed, you can use it in your C# code like this

### .cs files
```csharp
using Accuraty.Libraries.AccuLadder;

string phoneNumber = Accu.Text.FormatPhone("914.555.1212");
// result: (914) 555-1212
```

### .cshtml files (2sxc Views or RazorHost)
```csharp
@using Accuraty.Libraries.AccuLadder

@{
string urlSlug = Accu.Web.ToSlug("** Special ** Board Meeting -- Nov 2022);
// result: special-board-meeting-nov-2022
}
```

### .ascx files (Theme files and user controls)
```csharp
<%@ Import Namespace="Accuraty.Libraries.AccuLadder" %>

<p class="small mt-2 mb-0"
title="Current User is Super: <%=Accu.Dnn.IsSuper() %>"
>
```

<hr>

## AccuKit Notes
<mark>AccuKit (in the /App_Code folder) is no longer needed.</mark>
AccuLadder replaces it. To make the transition easy, compatability was added to AccuLadder to support
the old namespace (AccuKit.) and classes. This means that you can and should install AccuLadder, but
you need to:
1. Delete `/App_Code/AccuKit.cshtml`
2. Search through the project and find all occurrence of `AccuKit.`
3. At the top each page where it was used, add a `using` statement for `Accuraty.Libraries.AccuLadder` (see examples above)
4. No other changes should be necessary, see JRF is issues arise

### What about RazorKit, AccuKit11, and others?
No conflict so far, but in the future, when "replacement compatibility" is added to AccuLadder, the same process
(as AccuKit above) will apply.

## Roadmap Possibilites and Ideas
- [ ] How did we lose .IsUrlSpecial() and what is the new method name?
- [ ] Add more documentation
- [ ] Add replacement compatibility for RazorKit, AccuKit11, and others
- [ ] How do we handle /App_Code/AccuTheme.cshtml in the AccuTheme* projects?
- [ ] Add AccuComponents.Buttons (or move forward on Stencil web components version of AccuComponents)?
- [ ] .Dev.Log(); add non-ephemeral logging to [files, database, other]? (or use 2sxc logging? or something else (Serilog?))?
- [ ] .Dnn.[roles]; helpers that work the way Accuraty does
- [ ] see IsSM() in BEACN2023; one-offs that define a permission grouping
- [ ] new .IsInRoles() that work for lists of RoleId or RoleNames
- [ ] above need to support both && and || logic (all or any)
- [ ] .GetRoleNameById() and .GetRoleIdByName()
- [ ] modernize the project as compositional interfaces, IAccuWeb, IAccuText, etc.?
- [ ] setup so using AccuLadder can be done via Dependency Injection
- [ ] setup so using AccuLadder can be done using NuGet
- [ ] Can we implement a terser syntax w/o adding (maintenance) complexity?
- [ ] Are we really a billion years away from plant/animal semiosis?

## Links to self-docs in the project
- [README.md](https://github.com/jeremy-farrance/AccuratySolutions-2023/blob/main/Libraries/AccuLadder/README.md)
- [Release Notes](https://github.com/jeremy-farrance/AccuratySolutions-2023/blob/main/Libraries/AccuLadder/releasenotes.txt)
- more?

## Accuraty Solutions
- [Accuraty](https://accuraty.com)
- [ACCU4](https://accu4.com) - Accuraty's DNN+2sxc reminders, learnings, and related stuff
- [GitHub/Accuraty](https://github.com/Accuraty)
2 changes: 2 additions & 0 deletions docfx/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
These started life as exports 20231107 JRF
https://github.com/mapbox/mapbox-unity-sdk/issues/14#issuecomment-295596387
Loading

0 comments on commit 0e456ee

Please sign in to comment.