-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from JamesPhillipsUK/0.0.1-dev
0.0.1 Development
- Loading branch information
Showing
12 changed files
with
759 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
} | ||
} | ||
} |
Oops, something went wrong.