Inner links

This commit is contained in:
Mike Phares 2025-02-02 14:12:21 -07:00
parent 3c4e465084
commit c64143f320
3 changed files with 49 additions and 21 deletions

2
.gitignore vendored
View File

@ -335,3 +335,5 @@ ASALocalRun/
.vscode/.UserSecrets/secrets.json
.vscode/jsonl/*
.vscode/.year-season-source
.vscode/.year-season-destination

31
.vscode/tasks.json vendored
View File

@ -89,8 +89,8 @@
"problemMatcher": "$msCompile"
},
{
"label": "dockerLogin",
"command": "docker",
"label": "podmanLogin",
"command": "podman",
"type": "process",
"args": [
"login",
@ -99,19 +99,20 @@
"problemMatcher": "$msCompile"
},
{
"label": "dockerBuild",
"command": "docker",
"label": "podmanBuild",
"command": "podman",
"type": "process",
"args": [
"build",
"-t",
"kanbn-to-quartz"
"kanbn-to-quartz",
"."
],
"problemMatcher": "$msCompile"
},
{
"label": "dockerImageList",
"command": "docker",
"label": "podmanImageList",
"command": "podman",
"type": "process",
"args": [
"image",
@ -120,8 +121,8 @@
"problemMatcher": "$msCompile"
},
{
"label": "dockerRun",
"command": "docker",
"label": "podmanRun",
"command": "podman",
"type": "process",
"args": [
"run",
@ -129,24 +130,24 @@
"5001:5001",
"--name",
"kanbn-to-quartz-api-001",
"cb5bbb2e84e7"
"a3de856b5731"
],
"problemMatcher": "$msCompile"
},
{
"label": "dockerTag",
"command": "docker",
"label": "podmanTag",
"command": "podman",
"type": "process",
"args": [
"tag",
"b84c1f73de01",
"a3de856b5731",
"gitea.phares.duckdns.org:443/phares3757/kanbn-to-quartz:latest"
],
"problemMatcher": "$msCompile"
},
{
"label": "dockerPush",
"command": "docker",
"label": "podmanPush",
"command": "podman",
"type": "process",
"args": [
"push",

View File

@ -19,6 +19,8 @@ public class CopyService
string path;
string fileB;
string pathB;
string pathC;
string pathD;
string textB;
string? text;
Record record;
@ -26,6 +28,7 @@ public class CopyService
string[] lines;
string pathName;
string directory;
string[] segments;
string destination;
string relativePath;
string directoryName;
@ -55,13 +58,33 @@ public class CopyService
relativeDirectory = Path.GetRelativePath(sourceDirectoryName, directoryName);
for (int i = 0; i < lines.Length; i++)
{
if (!lines[i].StartsWith(textBFindReplace))
if (!lines[i].Contains(textBFindReplace))
continue;
path = lines[i].Substring(textBFindReplace.Length, lines[i].Length - 1 - textBFindReplace.Length);
pathB = string.IsNullOrEmpty(directoryBFindReplace[0]) ? path : path.Replace(directoryBFindReplace[0], directoryBFindReplace[1]);
pathName = Path.GetFileName(pathB);
relativePath = Path.GetRelativePath(sourceDirectoryName, pathB);
lines[i] = $"- [{pathName}]({relativePath})";
if (!lines[i].EndsWith(')') && !lines[i].EndsWith(")~~"))
continue;
if (lines[i].StartsWith(textBFindReplace))
path = lines[i].Substring(textBFindReplace.Length, lines[i].Length - 1 - textBFindReplace.Length);
else
{
segments = lines[i].Split("~~");
if (segments.Length < 2 || !segments[1].StartsWith(textBFindReplace))
continue;
path = segments[1].Substring(textBFindReplace.Length, segments[1].Length - 1 - textBFindReplace.Length);
}
if (string.IsNullOrEmpty(directoryBFindReplace[0]))
{
pathD = path;
pathName = Path.GetFileName(path);
}
else
{
pathB = path.Replace(directoryBFindReplace[0], directoryBFindReplace[1]);
pathC = directoryBFindReplace[1][0] != '/' ? pathB : pathB.Replace('\\', '/');
pathName = Path.GetFileName(pathC);
pathD = $"{pathC}{directoryFindReplace[1]}{pathName}";
}
relativePath = Path.GetRelativePath(sourceDirectoryName, pathD);
lines[i] = lines[i].Replace($"{textBFindReplace}{path}", $"- [{pathName}]({relativePath}");
}
textB = string.Join(Environment.NewLine, lines);
text = textB.Replace(textFindReplace[0], textFindReplace[1].Replace("%", relativeDirectory));
@ -91,6 +114,8 @@ public class CopyService
public void CopyDirectory()
{
if (!Directory.Exists(_AppSettings.Source))
_ = Directory.CreateDirectory(_AppSettings.Source);
if (Directory.Exists(_AppSettings.Destination))
Directory.Delete(_AppSettings.Destination, recursive: true);
ReadOnlyCollection<Record> records = GetRecords(_AppSettings);