Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/NaiveStaticGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
CopyImgFolderToFinalWebsite();
CopyCName();
CopyRobots();
TurnOffJekyll();
GenerateSitemap();
GenerateLlmsTxt();

Expand Down Expand Up @@ -214,7 +215,7 @@
}


static string PathUp(string content, string relativeName, string subPath)

Check warning on line 218 in src/NaiveStaticGenerator/Program.cs

View workflow job for this annotation

GitHub Actions / RunJobs (windows-latest)

The local function 'PathUp' is declared but never used

Check warning on line 218 in src/NaiveStaticGenerator/Program.cs

View workflow job for this annotation

GitHub Actions / RunJobs (ubuntu-latest)

The local function 'PathUp' is declared but never used

Check warning on line 218 in src/NaiveStaticGenerator/Program.cs

View workflow job for this annotation

GitHub Actions / RunJobs (macos-latest)

The local function 'PathUp' is declared but never used
=> content.Replace("/" + subPath,
string.Join("",
Enumerable.Range(0, relativeName.Count(c => c == '\\')
Expand Down Expand Up @@ -261,7 +262,7 @@
}
}

void CopyWikiImagesToFinalWebsite()

Check warning on line 265 in src/NaiveStaticGenerator/Program.cs

View workflow job for this annotation

GitHub Actions / RunJobs (windows-latest)

The local function 'CopyWikiImagesToFinalWebsite' is declared but never used

Check warning on line 265 in src/NaiveStaticGenerator/Program.cs

View workflow job for this annotation

GitHub Actions / RunJobs (ubuntu-latest)

The local function 'CopyWikiImagesToFinalWebsite' is declared but never used

Check warning on line 265 in src/NaiveStaticGenerator/Program.cs

View workflow job for this annotation

GitHub Actions / RunJobs (macos-latest)

The local function 'CopyWikiImagesToFinalWebsite' is declared but never used
{
DirectoryCopy(RootP._("wiki"), FinalOutputP._("wiki"), copySubDirs: false, _ => true);
}
Expand All @@ -286,6 +287,14 @@
File.Copy(RootP._("robots.txt"), FinalOutputP._("robots.txt"), true);
}

// GitHub Pages runs a branch through Jekyll unless it holds a .nojekyll, and Jekyll leaves out
// every file whose name starts with '#', '_' or '.'. The pages here are finished HTML with no
// front matter, so Jekyll had nothing to do but drop them: each constructor's page, #ctor.html.
void TurnOffJekyll()
{
File.WriteAllText(FinalOutputP._(".nojekyll"), "");
}

// Every page of the website, for search engines, which robots.txt points to. A page that is a
// folder's index.html is served at the folder, so it is listed as the folder.
void GenerateSitemap()
Expand Down
53 changes: 53 additions & 0 deletions src/Yadg.NET.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
diff --git a/Yadg.NET/WebsiteBuilder.cs b/Yadg.NET/WebsiteBuilder.cs
index 3e808a7..9c5666d 100644
--- a/Yadg.NET/WebsiteBuilder.cs
+++ b/Yadg.NET/WebsiteBuilder.cs
@@ -21,7 +21,16 @@ namespace YadgNet
public WebsiteBuilder(IPageSave saver)
=> this.saver = saver;

+ // The compiler names a constructor #ctor, and writes the dots in the name of an
+ // explicitly implemented interface member as '#'. In a link that character begins the
+ // fragment, so the browser asked for the path before it; it is written %23.
+ internal static string InLink(string name)
+ => name.Replace("#", "%23");
+
internal static string? GetLinkWithinAsmByName(string cref)
+ => LinkWithinAsmByName(cref) is { } link ? InLink(link) : null;
+
+ private static string? LinkWithinAsmByName(string cref)
=> (cref[..2], cref[2..]) switch
{
(_, var containsSystem) when NameParser.GetMethodName(cref).Contains("System")
diff --git a/Yadg.NET/WebsiteBuilder/MemberListBuilder.cs b/Yadg.NET/WebsiteBuilder/MemberListBuilder.cs
index 5024e8f..1924ab8 100644
--- a/Yadg.NET/WebsiteBuilder/MemberListBuilder.cs
+++ b/Yadg.NET/WebsiteBuilder/MemberListBuilder.cs
@@ -42,23 +42,23 @@ namespace YadgNet
?

p(
- a($"./{cls.Name}/{method.Name}.html", h3(SplitWrapWordsMethod(method.Name + method.Overloads.First().Parameters))) + "Method"
+ a($"./{cls.Name}/{WebsiteBuilder.InLink(method.Name)}.html", h3(SplitWrapWordsMethod(method.Name + method.Overloads.First().Parameters))) + "Method"
)

:

p(
- a($"./{cls.Name}/{method.Name}.html", h3(method.Name)) + "Method and its overloads"
+ a($"./{cls.Name}/{WebsiteBuilder.InLink(method.Name)}.html", h3(method.Name)) + "Method and its overloads"
)
)
,
DocProperty property =>
p(
- a($"./{cls.Name}/{property.Name}.html", h3(property.Name)) + "Property"
+ a($"./{cls.Name}/{WebsiteBuilder.InLink(property.Name)}.html", h3(property.Name)) + "Property"
),
DocField field =>
p(
- a($"./{cls.Name}/{field.Name}.html", h3(field.Name)) + "Field"
+ a($"./{cls.Name}/{WebsiteBuilder.InLink(field.Name)}.html", h3(field.Name)) + "Field"
),
_ => throw new Exception()
}
diff --git a/Yadg.NET/WebsiteBuilder/MemberPageBuilder.cs b/Yadg.NET/WebsiteBuilder/MemberPageBuilder.cs
index 3caa5da..36ed5fe 100644
--- a/Yadg.NET/WebsiteBuilder/MemberPageBuilder.cs
Expand Down
Loading