Skip to content

Commit

Permalink
Merge pull request #1 from JamesPhillipsUK/0.0.1-dev
Browse files Browse the repository at this point in the history
0.0.1 Development
  • Loading branch information
JamesPhillipsUK authored Apr 9, 2019
2 parents aaf2fe5 + 54cb8bb commit 2e2c1ca
Show file tree
Hide file tree
Showing 12 changed files with 759 additions and 15 deletions.
5 changes: 5 additions & 0 deletions QuickDoc.sln
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@ Global
$3.IndentWidth = 2
$3.scope = text/plain
$0.StandardHeader = $4
$0.DotNetNamingPolicy = $5
$5.DirectoryNamespaceAssociation = PrefixedHierarchical
$0.VersionControlPolicy = $6
description = Quick and easy multi-language code documentation engine.
version = 0.0.1
EndGlobalSection
EndGlobal
44 changes: 44 additions & 0 deletions QuickDoc/CSSBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
namespace QuickDoc
{
/// <summary>
/// CSS Builder builds the CSS stylesheet file used by QuickDoc.
/// </summary>
public class CSSBuilder
{
/// <summary>
/// Initializes a new instance of the <see cref="T:QuickDoc.CSSBuilder"/> class.
/// </summary>
public CSSBuilder()
{
}
/// <summary>
/// Gets the CSS for the stylesheet file.
/// </summary>
/// <returns>The css.</returns>
public string[] GetCSS()
{
string[] css =
{
@"/** Stylesheet for QuickDoc documents. **/",
@"*{display:block;}",
@"document{background:white;width:100%;}",
@"file{width:95%;margin:2.5vw auto; padding:1.25vw 0;}",
@"file[codeType = CSharp]{background:lightskyblue;}",
@"file[codeType = C]{background:springgreen;}",
@"file[codeType = Java]{background:pink;}",
@"file[codeType = PHP]{background:cornsilk;}",
@"file[codeType = JavaScript]{background:lavender;}",
@"file[codeType = None]{background:lightgray;}",
@"header,methods{width:95%;margin:1.25vw auto; border:1px solid black;}",
@"documentedInfo,method{width:95%;margin:0.825vw auto; border:1px solid black;}",
@"methodCall:before{content:""METHOD / FUNCTION / PROCEDURE: "";}",
@"param:before{content:""PARAMETER: "";}",
@"method summary:before{content:""SUMMARY: "";}",
@"return:before{content:""RETURN VALUE: "";}",
@"see{content:attr(cref) "" "";display:inline;}",
};
return css;
}
}
}
38 changes: 38 additions & 0 deletions QuickDoc/Doc/CSSBuilder.cs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="./stylesheet.css"?>
<document>
<file name="CSSBuilder.cs" codeType="CSharp">
<header>
<sectionTitle>Header Information:</sectionTitle>
<fileName>File Name: CSSBuilder.cs</fileName>
<fileType>File Type: CSharp</fileType>
<documentedInfo>Developer-Documented Information:

<summary>
CSS Builder builds the CSS stylesheet file used by QuickDoc.
</summary>
</documentedInfo>
</header>
<body>
<methods>
<sectionTitle>Methods, Functions, and Procedures</sectionTitle>
<documentedInfo>Developer-Documented Information:

<method>
<methodCall>public CSSBuilder()</methodCall>
<summary>
Initializes a new instance of the <see cref="T:QuickDoc.CSSBuilder"/> class.
</summary>
</method>
<method>
<methodCall>public string[] GetCSS()</methodCall>
<summary>
Gets the CSS for the stylesheet file.
</summary>
<returns>The css.</returns>
</method>
</documentedInfo>
</methods>
</body>
</file>
</document>
39 changes: 39 additions & 0 deletions QuickDoc/Doc/DocumentationBuilder.cs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="./stylesheet.css"?>
<document>
<file name="DocumentationBuilder.cs" codeType="CSharp">
<header>
<sectionTitle>Header Information:</sectionTitle>
<fileName>File Name: DocumentationBuilder.cs</fileName>
<fileType>File Type: CSharp</fileType>
<documentedInfo>Developer-Documented Information:

<summary>
The Documentation Builder class. DocumentationBuilder calls the LanguageHandler, and builds an XML document about a given file.
</summary>
</documentedInfo>
</header>
<body>
<methods>
<sectionTitle>Methods, Functions, and Procedures</sectionTitle>
<documentedInfo>Developer-Documented Information:

<method>
<methodCall>private string[] BuildXML(string codeFileName)</methodCall>
<summary>
Builds the XML for the documentation.
</summary>
<returns>The xml.</returns>
<param name="codeFileName">Code file name.</param>
</method>
<method>
<methodCall>public void CreateDocumentation() </methodCall>
<summary>
Creates the documentation file, and populates it accordingly.
</summary>
</method>
</documentedInfo>
</methods>
</body>
</file>
</document>
64 changes: 64 additions & 0 deletions QuickDoc/Doc/LanguageHandler.cs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="./stylesheet.css"?>
<document>
<file name="LanguageHandler.cs" codeType="CSharp">
<header>
<sectionTitle>Header Information:</sectionTitle>
<fileName>File Name: LanguageHandler.cs</fileName>
<fileType>File Type: CSharp</fileType>
<documentedInfo>Developer-Documented Information:
No header information found.
</documentedInfo>
</header>
<body>
<methods>
<sectionTitle>Methods, Functions, and Procedures</sectionTitle>
<documentedInfo>Developer-Documented Information:

<method>
<methodCall>private void SetLanguageRules(int codeTypeValue)</methodCall>
<summary>
This sets which language rules are true for the given language.
</summary>
</method>
<method>
<methodCall>private void SetLanguage(int codeType)</methodCall>
<summary>
Sets the language of this instance based on it's code type.
</summary>
<param name="codeType">Code type.</param>
</method>
<method>
<methodCall>public string GetLanguage(string fileType)</methodCall>
<summary>
Gets the language of a file, and sets the language of this based on that of the file.
</summary>
<returns>The language.</returns>
<param name="fileType">File type.</param>
</method>
<method>
<methodCall>public string GetAllHeads()</methodCall>
<summary>
Gets all head comments from the code and returns them in XML format.
</summary>
<returns>The head comments.</returns>
</method>
<method>
<methodCall>public string GetAllMethods()</methodCall>
<summary>
Gets all methods.
</summary>
<returns>The comments about methods.</returns>
</method>
<method>
<methodCall>public LanguageHandler(string lCodeFilePath)</methodCall>
<summary>
Initializes a new instance of the <see cref="T:QuickDoc.LanguageHandler"/> class.
</summary>
<param name="lCodeFilePath">Code file path.</param>
</method>
</documentedInfo>
</methods>
</body>
</file>
</document>
39 changes: 39 additions & 0 deletions QuickDoc/Doc/Program.cs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="./stylesheet.css"?>
<document>
<file name="Program.cs" codeType="CSharp">
<header>
<sectionTitle>Header Information:</sectionTitle>
<fileName>File Name: Program.cs</fileName>
<fileType>File Type: CSharp</fileType>
<documentedInfo>Developer-Documented Information:

<summary>
This is the main controller for QuickDoc. Call this, and it'll handle everything else.
</summary>
</documentedInfo>
</header>
<body>
<methods>
<sectionTitle>Methods, Functions, and Procedures</sectionTitle>
<documentedInfo>Developer-Documented Information:

<method>
<methodCall>private static void HandleArgs(string[] args)</methodCall>
<summary>
Handles arguments passed to the program for the documentation folder and the file to be documented.
</summary>
<param name="args">The arguments.</param>
</method>
<method>
<methodCall>static void Main(string[] args)</methodCall>
<summary>
The entry point of the program, where the program control starts and ends. It just sends the work off to a handler function and tells the user when we're done.
</summary>
<param name="args">The command-line arguments.</param>
</method>
</documentedInfo>
</methods>
</body>
</file>
</document>
17 changes: 17 additions & 0 deletions QuickDoc/Doc/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/** Stylesheet for QuickDoc documents. **/
*{display:block;}
document{background:white;width:100%;}
file{width:95%;margin:2.5vw auto; padding:1.25vw 0;}
file[codeType = CSharp]{background:lightskyblue;}
file[codeType = C]{background:springgreen;}
file[codeType = Java]{background:pink;}
file[codeType = PHP]{background:cornsilk;}
file[codeType = JavaScript]{background:lavender;}
file[codeType = None]{background:lightgray;}
header,methods{width:95%;margin:1.25vw auto; border:1px solid black;}
documentedInfo,method{width:95%;margin:0.825vw auto; border:1px solid black;}
methodCall:before{content:"METHOD / FUNCTION / PROCEDURE: ";}
param:before{content:"PARAMETER: ";}
method summary:before{content:"SUMMARY: ";}
return:before{content:"RETURN VALUE: ";}
see{content:attr(cref) " ";display:inline;}
66 changes: 66 additions & 0 deletions QuickDoc/DocumentationBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using System.IO;
using System.Linq;

namespace QuickDoc
{
/// <summary>
/// The Documentation Builder class. DocumentationBuilder calls the LanguageHandler, and builds an XML document about a given file.
/// </summary>
public class DocumentationBuilder
{
private readonly string docFolderPath, codeFilePath;// Create instance variables of the documentation folder and the code file.
private readonly LanguageHandler language;// Handles the code, given it's language.

public DocumentationBuilder(string ldocFolderPath, string lcodeFilePath)// Constructor assigns the documentation folder and code file the user requires.
{
docFolderPath = ldocFolderPath;
codeFilePath = lcodeFilePath;
language = new LanguageHandler(codeFilePath);// Instantiate lagnuage as a LanguageHandler for your code.
}
/// <summary>
/// Builds the XML for the documentation.
/// </summary>
/// <returns>The xml.</returns>
/// <param name="codeFileName">Code file name.</param>
private string[] BuildXML(string codeFileName)
{
string[] xml =
{
@"<?xml version=""1.0"" encoding=""UTF-8""?>",
@"<?xml-stylesheet type=""text/css"" href=""./stylesheet.css""?>",
@"<document>",
@" <file name=""" + codeFileName + @""" codeType=""" + language.GetLanguage(codeFileName) + @""">",
@" <header>",
@" <sectionTitle>Header Information:</sectionTitle>",
@" <fileName>File Name: " + codeFileName + @"</fileName>",
@" <fileType>File Type: " + language.GetLanguage(codeFileName) + @"</fileType>",
@" <documentedInfo>Developer-Documented Information: ",
language.GetAllHeads(),
@" </documentedInfo>",
@" </header>",
@" <body>",
@" <methods>",
@" <sectionTitle>Methods, Functions, and Procedures</sectionTitle>",
@" <documentedInfo>Developer-Documented Information: ",
language.GetAllMethods(),
@" </documentedInfo>",
@" </methods>",
@" </body>",
@" </file>",
@"</document>"// Create the XML as a string literal.
};
return xml;// Return the XML string.
}
/// <summary>
/// Creates the documentation file, and populates it accordingly.
/// </summary>
public void CreateDocumentation()
{
string codeFileName = codeFilePath.Split("/").Last();
File.Create(docFolderPath + "/" + codeFileName + ".xml").Close();// Create the file.
string[] xml = BuildXML(codeFileName);
File.WriteAllLines(docFolderPath + "/" + codeFileName + ".xml",xml);// Populate the file.
}
}
}
Loading

0 comments on commit 2e2c1ca

Please sign in to comment.