Skip to content

Commit

Permalink
Merge pull request #3309 from 2sic/develop
Browse files Browse the repository at this point in the history
V17.02
  • Loading branch information
iJungleboy committed Feb 22, 2024
2 parents a0708da + 5ab3768 commit 5e26f9e
Show file tree
Hide file tree
Showing 132 changed files with 2,496 additions and 797 deletions.
95 changes: 95 additions & 0 deletions Src/Build/ToSic.Sxc.BuildTasks/ModifyXmlDocumentation.cs
@@ -0,0 +1,95 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace ToSic.Sxc.BuildTasks
{
public class ModifyXmlDocumentation : Task
{
[Required]
public string XmlDocumentationPath { get; set; }

public override bool Execute()
{
// Launches a dialog asking if you want to attach a debugger
//System.Diagnostics.Debugger.Launch();

try
{
var content = File.ReadAllText(XmlDocumentationPath);

var modifiedContent = ReplaceXrefsWithLinks(content);

modifiedContent = AddDocsLinkToTypesAndProperties(modifiedContent);

File.WriteAllText(XmlDocumentationPath, modifiedContent);
Log.LogMessage(MessageImportance.High, $"XML documentation modified successfully at: {XmlDocumentationPath}");
}
catch (Exception ex)
{
Log.LogErrorFromException(ex);
return false;
}

return true;
}

private static string ReplaceXrefsWithLinks(string content)
{
// regex pattern to handle method signatures with parentheses
var pattern = @"\[(.*?)\]\(xref:((?:[^()]+|\((?:[^()]+|\([^()]*\))*\))*)\)";

// Replacement method defined as a local function
string Replacement(Match m)
{
var label = m.Groups[1].Value;
var reference = m.Groups[2].Value;
// Use label if provided, otherwise use reference as label
var linkText = !string.IsNullOrEmpty(label) ? label : reference;
return $@"<a href=""https://go.2sxc.org/xref17?xref={reference}"">{linkText}</a>";
}

var modifiedContent = Regex.Replace(content, pattern, new MatchEvaluator(Replacement));
return modifiedContent;
}

private string AddDocsLinkToTypesAndProperties(string content)
{
var xdoc = XDocument.Parse(content);
foreach (var member in xdoc.Descendants("member"))
{
try
{
var memberName = member.Attribute("name")?.Value;

if (memberName == null
|| !(memberName.StartsWith("T:") || memberName.StartsWith("P:"))
|| memberName.Contains(".Internal.")
|| memberName.Contains(".Integration.")) continue;

var summary = member.Element("summary");
if (summary == null) continue;

var summaryContent = summary.Value;
if (summaryContent.Contains("📖")) continue;

var reference = memberName.Substring(2);
// if it's a generic type, we need to remove the generic part and append *
//if (reference.Contains("`")) reference = reference.Substring(0,reference.LastIndexOf('`')) + "*";

var label = reference.Substring(reference.LastIndexOf('.') + 1);

summary.Add(new XElement("para", new XElement("a", new XAttribute("href", $"https://go.2sxc.org/xref17?xref={reference}"), "📖 " + label)));
}
catch (Exception ex)
{
Log.LogErrorFromException(ex);
}
}
return xdoc.ToString();
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 6 additions & 1 deletion Src/Data/App_Data/new-app/app.json
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.2sxc.org/app/v14/app.json",
"$schema": "https://schemas.2sxc.org/app/v17/app.json",
/*
This is a JSON file but it is treated like a JSONC (with comments).

Expand Down Expand Up @@ -29,5 +29,10 @@
// "package-lock.json",
// "nuget.config",
]
},
"editions": {
"": {
"description": "The default edition of the app",
}
}
}
Binary file not shown.
20 changes: 20 additions & 0 deletions Src/Data/App_Data/new-apps/templates.json
@@ -0,0 +1,20 @@
[
{
"id": 0,
"name": "Completely Empty App",
"teaser": "Completely empty app, without any code or content",
"internalNotes": "should create an app using the previous mechanism",
"zip": null,
"appName": null,
"folder": null
},
{
"id": 1,
"name": "App Template Basic",
"teaser": "A basic app template with simple instructions and a first razor template",
"internalNotes": "should import the zip, reset the GUID, rename the App and folder",
"zip": "2sxcApp_AppTemplateBasic_0.17.0.zip",
"appName": "AppTemplateBasic",
"folder": "app-template-basic"
}
]
62 changes: 48 additions & 14 deletions Src/Data/App_Data/system/bundles/system-queries.json
Expand Up @@ -193,7 +193,7 @@
},
{
"Id": 42938,
"Version": 10,
"Version": 18,
"Guid": "95041b6d-8669-4941-a516-47725acfe6ec",
"Type": {
"Id": "DataPipeline",
Expand All @@ -217,7 +217,7 @@
"en-us": "018a942b-1bad-4124-978c-0d0c35633be1:Default>Out:Default"
},
"TestParameters": {
"en-us": "[Module:ModuleID]=6936\n[QueryString:ContentTypeName]=@All"
"en-us": "[QueryString:ContentTypeName]=@All,@Entity"
},
"VisualDesignerData": {
"en-us": "{\"ShowDataSourceDetails\":true}"
Expand All @@ -236,7 +236,7 @@
"Metadata": [
{
"Id": 42980,
"Version": 5,
"Version": 9,
"Guid": "018a942b-1bad-4124-978c-0d0c35633be1",
"Type": {
"Id": "DataPipelinePart",
Expand Down Expand Up @@ -2427,7 +2427,7 @@
},
{
"Id": 182535,
"Version": 3,
"Version": 13,
"Guid": "ca79c11d-0c2e-422a-8bcb-0a89d493ecc0",
"Type": {
"Id": "DataPipeline",
Expand All @@ -2436,41 +2436,41 @@
"Attributes": {
"String": {
"Description": {
"*": ""
"en-us": "Entity picker for UI with special security, as security is handled in the data source. "
},
"Name": {
"*": "System.EntityPicker"
"en-us": "System.EntityPicker"
},
"Params": {
"*": ""
"en-us": ""
},
"StreamsOut": {
"*": "Default,Header"
"en-us": "Default,Header"
},
"StreamWiring": {
"*": "d0fac9fe-78ce-464a-8696-57fb5f69646d:Default>Out:Default"
"en-us": "d0fac9fe-78ce-464a-8696-57fb5f69646d:Default>Out:Default"
},
"TestParameters": {
"*": ""
"en-us": "[QueryString:TypeNames]=SystemExportDecorator,@All\n[QueryString:xx-ItemIds]=42930,42931"
},
"VisualDesignerData": {
"*": "{\"ShowDataSourceDetails\":true}"
"en-us": "{\"ShowDataSourceDetails\":true}"
}
},
"Boolean": {
"AllowEdit": {
"*": true
"en-us": true
},
"HiddenInQueryPicker": {
"*": false
"en-us": false
}
}
},
"Owner": "dnn:userid=41",
"Metadata": [
{
"Id": 182537,
"Version": 2,
"Version": 7,
"Guid": "d0fac9fe-78ce-464a-8696-57fb5f69646d",
"Type": {
"Id": "DataPipelinePart",
Expand Down Expand Up @@ -2522,6 +2522,40 @@
"TargetType": 4,
"Guid": "ca79c11d-0c2e-422a-8bcb-0a89d493ecc0"
}
},
{
"Id": 183752,
"Version": 1,
"Guid": "c324500c-8dd9-41ec-a7ae-b30809384e2f",
"Type": {
"Id": "PermissionConfiguration",
"Name": "PermissionConfiguration"
},
"Attributes": {
"String": {
"Condition": {
"en-us": "SecurityAccessLevel.View"
},
"Grant": {
"en-us": "r"
},
"Identity": {
"en-us": ""
},
"PermissionType": {
"en-us": ""
},
"Title": {
"en-us": "Allow Anonymous Access with View Permission"
}
}
},
"Owner": "dnn:userid=41",
"For": {
"Target": "Entity",
"TargetType": 4,
"Guid": "ca79c11d-0c2e-422a-8bcb-0a89d493ecc0"
}
}
]
}
Expand Down

0 comments on commit 5e26f9e

Please sign in to comment.