Skip to content

Commit 2bd149d

Browse files
committed
First commit
0 parents  commit 2bd149d

34 files changed

+14619
-0
lines changed

.vs/LennahSSG/v16/.suo

34 KB
Binary file not shown.

.vs/LennahSSG/v16/Browse.VC.db

18.9 MB
Binary file not shown.
Binary file not shown.

Debug/LennahSSG.exe

235 KB
Binary file not shown.

Debug/LennahSSG.pdb

2.58 MB
Binary file not shown.

LennahSSG.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31624.102
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LennahSSG", "LennahSSG\LennahSSG.vcxproj", "{4869845F-B8DA-43BA-931C-F2E2B6B786DF}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{4869845F-B8DA-43BA-931C-F2E2B6B786DF}.Debug|x64.ActiveCfg = Debug|x64
17+
{4869845F-B8DA-43BA-931C-F2E2B6B786DF}.Debug|x64.Build.0 = Debug|x64
18+
{4869845F-B8DA-43BA-931C-F2E2B6B786DF}.Debug|x86.ActiveCfg = Debug|Win32
19+
{4869845F-B8DA-43BA-931C-F2E2B6B786DF}.Debug|x86.Build.0 = Debug|Win32
20+
{4869845F-B8DA-43BA-931C-F2E2B6B786DF}.Release|x64.ActiveCfg = Release|x64
21+
{4869845F-B8DA-43BA-931C-F2E2B6B786DF}.Release|x64.Build.0 = Release|x64
22+
{4869845F-B8DA-43BA-931C-F2E2B6B786DF}.Release|x86.ActiveCfg = Release|Win32
23+
{4869845F-B8DA-43BA-931C-F2E2B6B786DF}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {7D109598-4658-4500-ABF5-F197FE634C37}
30+
EndGlobalSection
31+
EndGlobal

LennahSSG/Debug/LennahSSG.exe.recipe

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
<ProjectOutputs>
4+
<ProjectOutput>
5+
<FullPath>C:\Users\Joshua\source\repos\LennahSSG\Debug\LennahSSG.exe</FullPath>
6+
</ProjectOutput>
7+
</ProjectOutputs>
8+
<ContentFiles />
9+
<SatelliteDlls />
10+
<NonRecipeFileRefs />
11+
</Project>

LennahSSG/Debug/LennahSSG.ilk

1.33 MB
Binary file not shown.

LennahSSG/Debug/LennahSSG.log

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
 LennahSSG.cpp
2+
LennahSSG.vcxproj -> C:\Users\Joshua\source\repos\LennahSSG\Debug\LennahSSG.exe

LennahSSG/Debug/LennahSSG.obj

935 KB
Binary file not shown.
828 Bytes
Binary file not shown.
23.9 KB
Binary file not shown.
536 Bytes
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:
2+
Debug|Win32|C:\Users\Joshua\source\repos\LennahSSG\|
Binary file not shown.
3.36 KB
Binary file not shown.
524 Bytes
Binary file not shown.

LennahSSG/Debug/vc142.idb

195 KB
Binary file not shown.

LennahSSG/Debug/vc142.pdb

684 KB
Binary file not shown.

LennahSSG/LennahSSG.cpp

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#include <iostream>
2+
#include <fstream>
3+
#include <string>
4+
#include <direct.h>
5+
#include <filesystem>
6+
#include <sys/stat.h>
7+
#define VERSION 1.0
8+
9+
using namespace std;
10+
11+
void help_message();
12+
void version_message();
13+
void readTxt(string path);
14+
15+
int main(int argc, char** argv)
16+
{
17+
if (argc < 2) {
18+
help_message();
19+
return 1;
20+
}
21+
else if (argc == 2) {
22+
std::string arg = argv[1];
23+
if ((arg == "-v") || (arg == "--version")) {
24+
version_message();
25+
return 0;
26+
}
27+
else if ((arg == "-h") || (arg == "--help")) {
28+
help_message();
29+
return 0;
30+
}
31+
else {
32+
cout << "Not using proper arguments";
33+
}
34+
}
35+
else if (argc == 3) {
36+
std::string arg = argv[1];
37+
std::string argDetail = argv[2];
38+
if ((arg == "-i") || (arg == "--input")) {
39+
40+
//Delete folder if already exists
41+
std::filesystem::remove_all("./dist");
42+
//Create New Folder
43+
if (_mkdir("./dist") != 0) {
44+
exit(1);
45+
}
46+
47+
//Check if argument is Folder or txt File
48+
size_t isFile = argDetail.find(".txt");
49+
if (isFile != string::npos) {
50+
cout << "Converting: " << argDetail << endl;
51+
readTxt(argDetail);
52+
}
53+
else {
54+
using fileIterator = filesystem::recursive_directory_iterator;
55+
for (const auto& dirEntry : fileIterator(argDetail)) {
56+
string path = dirEntry.path().string();
57+
size_t isTxt = path.find(".txt");
58+
if (isTxt != string::npos) {
59+
cout << "Converting: " << path << endl;
60+
readTxt(path);
61+
}
62+
}
63+
}
64+
65+
66+
}
67+
}
68+
69+
return 0;
70+
}
71+
72+
static void help_message() {
73+
std::cout << "LENNAH - a static site generator" << endl;
74+
std::cout << "-----------------------------------" << endl;
75+
std::cout << "Arguments:" << endl;
76+
std::cout << "-i/--input <file/folder path>" << endl;
77+
std::cout << "-h/--help" << endl;
78+
std::cout << "-v/--version" << endl;
79+
}
80+
81+
static void version_message() {
82+
std::cout << "LENNAH V" << VERSION;
83+
}
84+
85+
static void readTxt(string path) {
86+
string line;
87+
string title, line1, line2, line3;
88+
89+
ifstream inputFile;
90+
inputFile.open(path);
91+
92+
if (!inputFile) {
93+
cout << "File not found. Please try again";
94+
exit(1);
95+
}
96+
97+
//Creating Output file and inital html
98+
string base_filename = path.substr(path.find_last_of("/\\") + 1);
99+
string::size_type const p(base_filename.find_last_of('.'));
100+
string file_without_extension = base_filename.substr(0, p);
101+
string newHTML = "./dist/" + file_without_extension + ".html";
102+
ofstream outputFile(newHTML);
103+
104+
title = file_without_extension;
105+
106+
if (inputFile.is_open()) {
107+
108+
109+
//Getting Title
110+
outputFile << "<!doctype html>\n"
111+
<< "<html lang = \"en\">\n"
112+
<< "<head>\n"
113+
<< "<meta charset=\"utf-8\">\n"
114+
<< "<title>";
115+
116+
getline(inputFile, line1);
117+
getline(inputFile, line2);
118+
getline(inputFile, line3);
119+
120+
if (line1 != "" && line2 == "" && line3 == "") {
121+
title = line1;
122+
}
123+
124+
outputFile << title;
125+
126+
outputFile << "</title>\n"
127+
<< "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
128+
<< "</head>\n"
129+
<< "<body>\n";
130+
131+
outputFile << "<h1>" << title << "</h1>\n";
132+
133+
//Reading input file
134+
string prevLine;
135+
while (getline(inputFile, line)) {
136+
if (prevLine == "" && line != "") {
137+
outputFile << "<p>\n"
138+
<< line << "\n";
139+
}
140+
else if (prevLine != "" && line == "") {
141+
outputFile << "</p>\n";
142+
}
143+
else {
144+
outputFile << line << "\n";
145+
}
146+
147+
prevLine = line;
148+
}
149+
150+
inputFile.close();
151+
}
152+
153+
154+
outputFile << "</body>\n"
155+
<< "</html>";
156+
157+
outputFile.close();
158+
}

LennahSSG/LennahSSG.vcxproj

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>16.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{4869845f-b8da-43ba-931c-f2e2b6b786df}</ProjectGuid>
25+
<RootNamespace>LennahSSG</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>Application</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v142</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>Application</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v142</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>Application</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v142</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v142</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<LinkIncremental>true</LinkIncremental>
75+
</PropertyGroup>
76+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
77+
<LinkIncremental>false</LinkIncremental>
78+
</PropertyGroup>
79+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
80+
<LinkIncremental>true</LinkIncremental>
81+
</PropertyGroup>
82+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
83+
<LinkIncremental>false</LinkIncremental>
84+
</PropertyGroup>
85+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
86+
<ClCompile>
87+
<WarningLevel>Level3</WarningLevel>
88+
<SDLCheck>true</SDLCheck>
89+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
90+
<ConformanceMode>true</ConformanceMode>
91+
<LanguageStandard>stdcpp17</LanguageStandard>
92+
</ClCompile>
93+
<Link>
94+
<SubSystem>Console</SubSystem>
95+
<GenerateDebugInformation>true</GenerateDebugInformation>
96+
</Link>
97+
</ItemDefinitionGroup>
98+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
99+
<ClCompile>
100+
<WarningLevel>Level3</WarningLevel>
101+
<FunctionLevelLinking>true</FunctionLevelLinking>
102+
<IntrinsicFunctions>true</IntrinsicFunctions>
103+
<SDLCheck>true</SDLCheck>
104+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
105+
<ConformanceMode>true</ConformanceMode>
106+
</ClCompile>
107+
<Link>
108+
<SubSystem>Console</SubSystem>
109+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
110+
<OptimizeReferences>true</OptimizeReferences>
111+
<GenerateDebugInformation>true</GenerateDebugInformation>
112+
</Link>
113+
</ItemDefinitionGroup>
114+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
115+
<ClCompile>
116+
<WarningLevel>Level3</WarningLevel>
117+
<SDLCheck>true</SDLCheck>
118+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
119+
<ConformanceMode>true</ConformanceMode>
120+
</ClCompile>
121+
<Link>
122+
<SubSystem>Console</SubSystem>
123+
<GenerateDebugInformation>true</GenerateDebugInformation>
124+
</Link>
125+
</ItemDefinitionGroup>
126+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
127+
<ClCompile>
128+
<WarningLevel>Level3</WarningLevel>
129+
<FunctionLevelLinking>true</FunctionLevelLinking>
130+
<IntrinsicFunctions>true</IntrinsicFunctions>
131+
<SDLCheck>true</SDLCheck>
132+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
133+
<ConformanceMode>true</ConformanceMode>
134+
</ClCompile>
135+
<Link>
136+
<SubSystem>Console</SubSystem>
137+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
138+
<OptimizeReferences>true</OptimizeReferences>
139+
<GenerateDebugInformation>true</GenerateDebugInformation>
140+
</Link>
141+
</ItemDefinitionGroup>
142+
<ItemGroup>
143+
<ClCompile Include="LennahSSG.cpp" />
144+
</ItemGroup>
145+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
146+
<ImportGroup Label="ExtensionTargets">
147+
</ImportGroup>
148+
</Project>

LennahSSG/LennahSSG.vcxproj.filters

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="LennahSSG.cpp">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>

LennahSSG/LennahSSG.vcxproj.user

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
4+
<LocalDebuggerCommandArguments>-i ./textfiles</LocalDebuggerCommandArguments>
5+
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
6+
</PropertyGroup>
7+
</Project>

0 commit comments

Comments
 (0)