Skip to content

Commit 86d724e

Browse files
committed
Version 3
- Code reorganization - Template now uses flex box, and added space for a footer - Settings file is now properly indented when created - Folders without Folder.md will no longer present empty pages - Rewrote some of the documentation - Updated to .Net 6 and published as a single file
1 parent 8bfc26f commit 86d724e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+421
-227
lines changed
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width,initial-scale=1">
7+
<title>Wiki</title>
8+
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
9+
<link rel="stylesheet" href="./stylesheet.css" type="text/css">
10+
</head>
11+
12+
<body class="mainPageBody">
13+
<div class="wikiContent">
14+
<iframe src="./navigator.html" class="navigatorContainer"></iframe>
15+
<div class="fileContainer">
16+
<iframe id="file"></iframe>
17+
</div>
18+
</div>
19+
<div class="footer">
20+
🖥️ Check Generator on Github: <a href="https://github.com/Cryru/Generator/">https://github.com/Cryru/Generator/</a>
21+
</div>
22+
<script>
23+
window.addEventListener("message", message, false);
24+
var documentHolder = document.getElementById("file");
25+
26+
function GetURLParameter(sParam) {
27+
const sPageUrl = window.location.search.substring(1);
28+
const sUrlVariables = sPageUrl.split('&');
29+
for (let i = 0; i < sUrlVariables.length; i++) {
30+
const sParameterName = sUrlVariables[i].split('=');
31+
if (sParameterName[0] == sParam) {
32+
return sParameterName[1];
33+
}
34+
}
35+
}
36+
37+
function message(event) {
38+
const data = event.data;
39+
const dataSplit = data.split('$');
40+
if (dataSplit.length !== 2 || dataSplit[0] !== 'navigate') return;
41+
42+
console.log("Navigating to: " + dataSplit[1]);
43+
documentHolder.setAttribute("src", dataSplit[1]);
44+
window.history.replaceState(null, null, `?link=${dataSplit[1]}`);
45+
window.document.title = "Wiki - " + dataSplit[1];
46+
}
47+
48+
var startingLink = GetURLParameter("link");
49+
if (startingLink) {
50+
console.dir("Found starting link: " + startingLink);
51+
documentHolder.setAttribute("src", startingLink);
52+
window.document.title = "Wiki - " + startingLink;
53+
}
54+
</script>
55+
</body>
56+
57+
</html>

TestSource/Parent File.md Documentation/Source/Parent File.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
## Subheader!
44

55
> Quote!<br/>
6-
> [\t] custom tab extension
6+
> [\t] wow even escaped tabs work, isn't technology amazing?!
77
8-
Lorem Ipsum is simply dummy text of the printing and [[Missing Node Link]] industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a [[Existing Node Link]](Nested Parent Child) of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into [[Test Page]] typesetting, remaining essentially unchanged.
8+
Lorem Ipsum is simply dummy text of the printing and [[Missing Node Link]] industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a [[Existing Node Link]](Nested Parent Child) of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into [[Test Page]] typesetting, remaining essentially **unchanged**.
9+
10+
- This
11+
- is
12+
- a
13+
- list
14+
15+
## Warning
16+
17+
*Most of the references in this demo refer to the file structure, which can be found at [the github repository documentation folder](https://github.com/Cryru/Generator/tree/master/Documentation/Source)!*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I am a file inside that folder.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is the page of a folder that contains other folders.
2+
3+
The name of its node is taken from the folder name, while the content is taken from a special "Folder.md" file in the folder.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
I'm a file inside a folder inside a folder. Cool huh?
2+
3+
My folder is missing a Folder.md, so it just displays blank.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I'm first in the file structure (when sorted alphabetically which is the default), but because of the order in the "order.txt" in this directory I'm the last node.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
File C here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The children in this folder are orderly, because there is an "order.txt" file in it.
2+
3+
Well, that's one to do it...

Generator.csproj

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<SignAssembly>False</SignAssembly>
67
</PropertyGroup>
78

89
<ItemGroup>
@@ -11,22 +12,22 @@
1112

1213
<ItemGroup>
1314
<None Update="Templates\index.html">
14-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
15+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1516
</None>
1617
<None Update="Templates\markdownTemplate.html">
17-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1819
</None>
1920
<None Update="Templates\navigator.html">
20-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2122
</None>
2223
<None Update="Templates\normalize.css">
23-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2425
</None>
2526
<None Update="Templates\stylesheet.css">
26-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
27+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2728
</None>
2829
<None Update="Templates\treeview.css">
29-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
30+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3031
</None>
3132
</ItemGroup>
3233

Generator.csproj.user

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<_LastSelectedProfileId>D:\Dev\Projects\Generator\Properties\PublishProfiles\Win64.pubxml</_LastSelectedProfileId>
5+
</PropertyGroup>
6+
</Project>

Generator.sln.DotSettings

+2-1
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,9 @@
432432
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
433433
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
434434
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean>
435+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EUnitTestFramework_002EMigrations_002EEnableDisabledProvidersMigration/@EntryIndexedValue">True</s:Boolean>
435436
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EUnitTestFramework_002ESettings_002EMigrations_002ERemoveBuildPolicyAlwaysMigration/@EntryIndexedValue">True</s:Boolean>
436-
<s:Boolean x:Key="/Default/Environment/UnitTesting/DisabledProviders/=xUnit/@EntryIndexedValue">True</s:Boolean>
437+
437438
<s:String x:Key="/Default/Environment/UpdatesManger/LastUpdateCheck/@EntryValue">09/09/2019 23:25:23</s:String>
438439
<s:String x:Key="/Default/Environment/UserInterface/ShortcutSchemeName/@EntryValue">VS</s:String>
439440
<s:String x:Key="/Default/Environment/UserInterface/TypeDiagram/GroupingName/@EntryValue">Namespaces</s:String>
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<Configuration>Release</Configuration>
8+
<Platform>Any CPU</Platform>
9+
<PublishDir>bin\Release\net6.0\publish\win64</PublishDir>
10+
<PublishProtocol>FileSystem</PublishProtocol>
11+
<TargetFramework>net6.0</TargetFramework>
12+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
13+
<SelfContained>true</SelfContained>
14+
<PublishSingleFile>True</PublishSingleFile>
15+
<PublishReadyToRun>True</PublishReadyToRun>
16+
<PublishTrimmed>True</PublishTrimmed>
17+
</PropertyGroup>
18+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<History>True|2022-06-16T07:45:26.5235946Z;True|2022-06-16T10:27:22.3668534+03:00;True|2022-06-16T10:23:50.5663161+03:00;True|2022-06-16T10:20:47.1147363+03:00;True|2022-06-16T10:10:23.6319645+03:00;True|2022-06-16T08:41:03.2690048+03:00;False|2022-06-16T08:40:23.2696108+03:00;True|2022-06-16T08:34:39.2319672+03:00;</History>
8+
</PropertyGroup>
9+
</Project>

ReadMe.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ Generator is an application which creates static websites resembling a wiki from
66

77
## Usage
88

9-
*Get the latest release from the "Releases" section.*
9+
*Get the latest release from the ["Releases"](https://github.com/Cryru/Generator/releases) section.*
1010

11-
To use the application place your folder with markdown files in the same directory as the application and name it "Source". The path to this folder can be configured, refer to the "Configuration" section. Once placed there launch Generator.exe and you'll have a new folder called "Output" with your generated wiki (hopefully).
11+
Create a folder named "Source" and place your markdown files inside. The application .exe should be in the same folder as the "Source" folder. The name and path of this folder can be configured, refer to the "Configuration" section. Run Generator.exe and you'll have a new folder called "Output" with your generated wiki (hopefully).
1212

13-
Nodes will be generated from the folder structure inside your source folder, you can control the order by placing an "order.txt" file in the folder and listing the names of the files in the order you want them to appear. The markdown file for the folder node itself is read from a "Folder.md" if any.
13+
Pages will be generated from the folder structure inside your "Source"" folder, you can control the order by placing an "order.txt" file in the folder and listing the names of the files in the order you want them to appear. The markdown file for the folder node itself is read from a "Folder.md" if any.
1414

1515
If you launch "Generator.exe sentry" from the command line the generator will launch in "sentry mode", rebuilding the output directory when it detects a file has changed or has been added/removed from the source directory.
1616

17+
For an example check the Documentation/DemoSource folder in the repo.
18+
1719
## Configuration
1820

1921
The first time the application is launched it will generate a default settings file - "settings.xml"

Templates/index.html

+42-34
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,57 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html>
22
<html>
3+
34
<head>
45
<meta charset="UTF-8">
56
<meta name="viewport" content="width=device-width,initial-scale=1">
6-
<title>[Title]</title>
7+
<title>Wiki</title>
78
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
89
<link rel="stylesheet" href="./stylesheet.css" type="text/css">
910
</head>
10-
<body>
11-
<iframe src="./navigator.html" class="navigatorContainer"></iframe>
12-
<div class="fileContainer">
13-
<iframe id="file"></iframe>
14-
</div>
15-
<script>
16-
window.addEventListener("message", message, false);
17-
var documentHolder = document.getElementById("file");
1811

19-
function GetURLParameter(sParam) {
20-
const sPageUrl = window.location.search.substring(1);
21-
const sUrlVariables = sPageUrl.split('&');
22-
for (let i = 0; i < sUrlVariables.length; i++) {
23-
const sParameterName = sUrlVariables[i].split('=');
24-
if (sParameterName[0] == sParam) {
25-
return sParameterName[1];
12+
<body class="mainPageBody">
13+
<div class="wikiContent">
14+
<iframe src="./navigator.html" class="navigatorContainer"></iframe>
15+
<div class="fileContainer">
16+
<iframe id="file"></iframe>
17+
</div>
18+
</div>
19+
<div class="footer">
20+
21+
</div>
22+
<script>
23+
window.addEventListener("message", message, false);
24+
var documentHolder = document.getElementById("file");
25+
26+
function GetURLParameter(sParam) {
27+
const sPageUrl = window.location.search.substring(1);
28+
const sUrlVariables = sPageUrl.split('&');
29+
for (let i = 0; i < sUrlVariables.length; i++) {
30+
const sParameterName = sUrlVariables[i].split('=');
31+
if (sParameterName[0] == sParam) {
32+
return sParameterName[1];
33+
}
2634
}
2735
}
28-
}
2936

30-
function message(event) {
31-
const data = event.data;
32-
const dataSplit = data.split('$');
33-
if (dataSplit.length !== 2 || dataSplit[0] !== 'navigate') return;
37+
function message(event) {
38+
const data = event.data;
39+
const dataSplit = data.split('$');
40+
if (dataSplit.length !== 2 || dataSplit[0] !== 'navigate') return;
3441

35-
console.log("Navigating to: " + dataSplit[1]);
36-
documentHolder.setAttribute("src", dataSplit[1]);
37-
window.history.replaceState(null, null, `?link=${dataSplit[1]}`);
38-
window.document.title = "[Title] - " + dataSplit[1];
39-
}
42+
console.log("Navigating to: " + dataSplit[1]);
43+
documentHolder.setAttribute("src", dataSplit[1]);
44+
window.history.replaceState(null, null, `?link=${dataSplit[1]}`);
45+
window.document.title = "Wiki - " + dataSplit[1];
46+
}
4047

41-
var startingLink = GetURLParameter("link");
42-
if (startingLink) {
43-
console.dir("Found starting link: " + startingLink);
44-
documentHolder.setAttribute("src", startingLink);
45-
window.document.title = "[Title] - " + startingLink;
46-
}
47-
</script>
48+
var startingLink = GetURLParameter("link");
49+
if (startingLink) {
50+
console.dir("Found starting link: " + startingLink);
51+
documentHolder.setAttribute("src", startingLink);
52+
window.document.title = "Wiki - " + startingLink;
53+
}
54+
</script>
4855
</body>
56+
4957
</html>

Templates/markdownTemplate.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html>
22
<html lang="en-US">
33
<head>
44
<meta charset="UTF-8">
@@ -12,7 +12,7 @@
1212
</head>
1313
<body>
1414
<!-- ReSharper disable UnknownCssClass -->
15-
<div class="container-lg px-3 my-5 markdown-body">
15+
<div class="px-3 my-5 markdown-body">
1616
<p>[Content]</p>
1717
</div>
1818
<!-- ReSharper enable UnknownCssClass -->
@@ -42,4 +42,4 @@
4242
}
4343
</script>
4444
</body>
45-
</html>
45+
</html>

Templates/navigator.html

+22-19
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,28 @@
1111
<ul class="main-ul">
1212
<li>[Navigator]</li>
1313
</ul>
14-
<script>
15-
var links = document.getElementsByClassName("link");
16-
for (var i = 0; i < links.length; i++) {
17-
const link = links[i].getAttribute("link");
18-
links[i].addEventListener("click",
19-
function(e) {
20-
window.parent.postMessage("navigate$" + link, "*");
21-
e.stopPropagation();
22-
});
23-
}
14+
<script>
15+
var links = document.getElementsByClassName("link");
16+
for (var i = 0; i < links.length; i++) {
17+
const link = links[i];
18+
const linkAttr = link.getAttribute("link");
19+
if (linkAttr) {
20+
link.addEventListener("click",
21+
function(e) {
22+
window.parent.postMessage("navigate$" + linkAttr, "*");
23+
e.stopPropagation();
24+
});
25+
}
26+
}
2427

25-
var carets = document.getElementsByClassName("caret");
26-
for (var i = 0; i < carets.length; i++) {
27-
carets[i].addEventListener("click",
28-
function(e) {
29-
this.parentElement.querySelector(".active").classList.toggle("nested");
30-
this.classList.toggle("caret-down");
31-
});
32-
}
33-
</script>
28+
var carets = document.getElementsByClassName("caret");
29+
for (var i = 0; i < carets.length; i++) {
30+
carets[i].addEventListener("click",
31+
function(e) {
32+
this.parentElement.querySelector(".active").classList.toggle("nested");
33+
this.classList.toggle("caret-down");
34+
});
35+
}
36+
</script>
3437
</body>
3538
</html>

0 commit comments

Comments
 (0)