Skip to content

Commit 877014d

Browse files
committed
Implemented Core Documentation Framework.
1 parent 99e4803 commit 877014d

File tree

13 files changed

+364
-27
lines changed

13 files changed

+364
-27
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
55
# User-specific stuff:
66
.idea/
7+
docsource/project/Data/
8+
docs/

docsource/api/index.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

docsource/builddocs.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perl builddocs.pl

docsource/builddocs.pl

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
#!/usr/bin/perl
2+
use strict;
3+
use warnings;
4+
use IPC::System::Simple qw(system);
5+
use Markdent::Simple::Document;
6+
use Markdent::Simple::Fragment;
7+
use File::Map qw(map_file);
8+
use File::Path qw(make_path);
9+
10+
use constant false => 0;
11+
use constant true => 1;
12+
13+
main();
14+
15+
sub main{
16+
# Create output directories if the don't exists
17+
make_path("../docs");
18+
19+
# Execute NaturalDocs
20+
# -i InputDirectory
21+
# -o FramedHTML or HTML OutputDirectory (Using HTML so we can directly link to documenation pages easier.)
22+
# -p ProectDirectory
23+
# -xi ExcludeDirFromInput
24+
# -r RebuildAllFiles
25+
my @nd_args = qw(
26+
-i ../
27+
-o HTML ../docs/
28+
-p ./project
29+
-xi ../.travis
30+
-xi ../examples
31+
-xi ../lib
32+
-xi ../tools
33+
-xi ../build
34+
-r
35+
);
36+
system($^X, "../tools/ndocs/NaturalDocs", @nd_args);
37+
38+
#convert markdown files to html
39+
#convert_markdown_file("../CONTRIBUTING.md","../docs/files/docsource/topics/contributing-txt.html","How to contribute to utPLSQL");
40+
convert_markdown_and_insert("../CONTRIBUTING.md","../docs/files/docsource/topics/contributing-txt.html");
41+
42+
43+
44+
#Checking for current/past errors with NaturalDocs
45+
check_project_file_for_error("project/Menu.txt");
46+
check_project_file_for_error("project/Languages.txt");
47+
check_project_file_for_error("project/Topics.txt");
48+
if (-e "project/LastCrash.txt") {
49+
die "project/LastCrash.txt found, indicating a prior NaturalDocs problem that should be fixed. Note: File must be manually removed to continue";
50+
}
51+
}
52+
53+
sub check_project_file_for_error {
54+
my $file_to_check = shift;
55+
map_file(my $menufile,$file_to_check);
56+
if ($menufile =~ /ERROR/) { die "ERROR found $file_to_check" }
57+
}
58+
59+
sub convert_markdown {
60+
my $markdowntext = shift;
61+
my $fragment = shift;
62+
my $title = shift;
63+
64+
# convert markdown to html
65+
my $htmltext;
66+
if ($fragment = true) {
67+
my $parser = Markdent::Simple::Fragment->new();
68+
$htmltext = $parser->markdown_to_html(
69+
markdown => $markdowntext);
70+
} else {
71+
my $parser = Markdent::Simple::Document->new();
72+
$htmltext = $parser->markdown_to_html(
73+
markdown => $markdowntext,
74+
title => $title);
75+
}
76+
77+
#return
78+
$htmltext;
79+
}
80+
81+
sub convert_markdown_and_insert {
82+
my $source = shift;
83+
my $dest = shift;
84+
85+
# memory map input file
86+
map_file(my $markdown, $source);
87+
88+
# convert markdown to html
89+
my $html = convert_markdown($markdown,true);
90+
91+
# read output file
92+
open FILE, "<$dest" or die "Couldn't open file: $!";
93+
binmode FILE;
94+
my $output = do { local $/; <FILE> };
95+
close FILE;
96+
97+
#search and replace
98+
$output =~ s/$source/$html/g;
99+
100+
# write output file
101+
open FILE, ">$dest" or die "Couldn't open file: $!";
102+
binmode FILE;
103+
print FILE $output;
104+
close FILE;
105+
106+
}
107+
108+
sub convert_markdown_file {
109+
my $source = shift;
110+
my $dest = shift;
111+
my $title = shift;
112+
113+
# memory map input file
114+
map_file(my $markdown, $source);
115+
116+
# convert markdown to html
117+
my $html = convert_markdown($markdown,false,$title);
118+
119+
# check output file exists, and deletes.
120+
if (-f $dest) {
121+
unlink $dest or die "Cannot delete $dest: $!";
122+
}
123+
124+
# write markdown to file
125+
my $OUTFILE;
126+
open $OUTFILE, '>>', $dest or die "Cannot open $dest";
127+
print { $OUTFILE } $html or die "Cannot write to $dest";
128+
close $OUTFILE or die "Cannot close $dest";
129+
130+
print "Converted $source to $dest"
131+
}
132+
133+
134+
135+
136+
137+
138+
139+
140+
141+
142+
143+
144+
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
Format: 1.52
1+
Format: Development Release 07-07-2013 (1.52 base)
22

33
# This is the Natural Docs languages file for this project. If you change
44
# anything here, it will apply to THIS PROJECT ONLY. If you'd like to change
55
# something for all your projects, edit the Languages.txt in Natural Docs'
66
# Config directory instead.
77

88

9-
# You can prevent certain file extensions from being scanned like this:
10-
# Ignore Extensions: [extension] [extension] ...
9+
Ignore Extension: pl
1110

1211

1312
#-------------------------------------------------------------------------------
@@ -115,4 +114,4 @@ Format: 1.52
115114

116115
Alter Language: SQL
117116

118-
Add Extensions: pkb pks
117+
Add Extensions: pks tps
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
Format: 1.52
1+
Format: Development Release 07-07-2013 (1.52 base)
22

33

4-
Title: UTPLSQL
5-
SubTitle: the unit test suite for Oracle PL/SQL
4+
Title: utPLSQL
5+
SubTitle: v 3.0 Alpha
66

7-
# You can add a footer to your documentation like this:
8-
# Footer: [text]
9-
# If you want to add a copyright notice, this would be the place to do it.
10-
11-
# You can add a timestamp to your documentation like one of these:
12-
# Timestamp: Generated on month day, year
13-
# Timestamp: Updated mm/dd/yyyy
14-
# Timestamp: Last updated mon day
15-
#
7+
Footer: Copyright (c) 2016 - utPLSQL Project
8+
Timestamp: Generated on month day, year
169
# m - One or two digit month. January is "1"
1710
# mm - Always two digit month. January is "01"
1811
# mon - Short month word. January is "Jan"
@@ -45,18 +38,27 @@ SubTitle: the unit test suite for Oracle PL/SQL
4538
# --------------------------------------------------------------------------
4639

4740

48-
Index: Everything
49-
Class Index: Class Index
50-
Function Index: Function Index
51-
File: License (license.txt)
52-
File: ut_metadata (ut_metadata.pks)
53-
File: ut_test_runner (ut_test_runner.pks)
54-
File: ut_types (ut_types.pks)
55-
Type Index: Type Index
56-
Constant Index: Constant Index
41+
Group: Documentation {
42+
43+
File: Installation (docsource/topics/install.txt)
44+
File: Getting Started (docsource/topics/getting-started.txt)
45+
File: Annotations (docsource/topics/Annotations.txt)
46+
File: Support (docsource/topics/Support.txt)
47+
} # Group: Documentation
48+
49+
Group: Source {
50+
51+
File: ut_metadata (source/ut_metadata.pks)
52+
File: ut_utils (source/ut_utils.pks)
53+
File: License (source/license.txt)
54+
File: Contributing (docsource/topics/contributing.txt)
55+
} # Group: Source
5756

5857
Group: Index {
5958

6059
Index: Everything
60+
Class Index: Classes
61+
Constant Index: Constants
62+
Function Index: Functions
6163
} # Group: Index
6264

docsource/project/Topics.txt

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
Format: Development Release 07-07-2013 (1.52 base)
2+
3+
# This is the Natural Docs topics file for this project. If you change anything
4+
# here, it will apply to THIS PROJECT ONLY. If you'd like to change something
5+
# for all your projects, edit the Topics.txt in Natural Docs' Config directory
6+
# instead.
7+
8+
9+
# If you'd like to prevent keywords from being recognized by Natural Docs, you
10+
# can do it like this:
11+
# Ignore Keywords: [keyword], [keyword], ...
12+
#
13+
# Or you can use the list syntax like how they are defined:
14+
# Ignore Keywords:
15+
# [keyword]
16+
# [keyword], [plural keyword]
17+
# ...
18+
19+
20+
#-------------------------------------------------------------------------------
21+
# SYNTAX:
22+
#
23+
# Topic Type: [name]
24+
# Alter Topic Type: [name]
25+
# Creates a new topic type or alters one from the main file. Each type gets
26+
# its own index and behavior settings. Its name can have letters, numbers,
27+
# spaces, and these charaters: - / . '
28+
#
29+
# Plural: [name]
30+
# Sets the plural name of the topic type, if different.
31+
#
32+
# Keywords:
33+
# [keyword]
34+
# [keyword], [plural keyword]
35+
# ...
36+
# Defines or adds to the list of keywords for the topic type. They may only
37+
# contain letters, numbers, and spaces and are not case sensitive. Plural
38+
# keywords are used for list topics. You can redefine keywords found in the
39+
# main topics file.
40+
#
41+
# Index: [yes|no]
42+
# Whether the topics get their own index. Defaults to yes. Everything is
43+
# included in the general index regardless of this setting.
44+
#
45+
# Scope: [normal|start|end|always global]
46+
# How the topics affects scope. Defaults to normal.
47+
# normal - Topics stay within the current scope.
48+
# start - Topics start a new scope for all the topics beneath it,
49+
# like class topics.
50+
# end - Topics reset the scope back to global for all the topics
51+
# beneath it.
52+
# always global - Topics are defined as global, but do not change the scope
53+
# for any other topics.
54+
#
55+
# Class Hierarchy: [yes|no]
56+
# Whether the topics are part of the class hierarchy. Defaults to no.
57+
#
58+
# Page Title If First: [yes|no]
59+
# Whether the topic's title becomes the page title if it's the first one in
60+
# a file. Defaults to no.
61+
#
62+
# Break Lists: [yes|no]
63+
# Whether list topics should be broken into individual topics in the output.
64+
# Defaults to no.
65+
#
66+
# Can Group With: [type], [type], ...
67+
# Defines a list of topic types that this one can possibly be grouped with.
68+
# Defaults to none.
69+
#-------------------------------------------------------------------------------
70+
71+
# The following topics are defined in the main file, if you'd like to alter
72+
# their behavior or add keywords:
73+
#
74+
# Generic, Class, Interface, Section, File, Group, Function, Variable,
75+
# Property, Type, Constant, Enumeration, Event, Delegate, Macro,
76+
# Database, Database Table, Database View, Database Index, Database
77+
# Cursor, Database Trigger, Cookie, Build Target
78+
79+
# If you add something that you think would be useful to other developers
80+
# and should be included in Natural Docs by default, please e-mail it to
81+
# topics [at] naturaldocs [dot] org.

docsource/readme.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
#DocSource Folder
22

3+
Contains the files needed to generated documentation. Perl is required to be able to run the generation of documentation.
4+
5+
#How to Run
6+
7+
builddocs.pl
8+
9+
#CPAN Modules
10+
11+
[CPAN Module Install Instructions](http://www.cpan.org/modules/INSTALL.html)
12+
13+
Required Modules:
14+
15+
- IPC::System::Simple
16+
- Markdent
17+
- File::Map
18+
19+
#NaturalDocs
20+
21+
We use NaturalDocs to generate most of the documentation.
22+
23+
It is linked as submodule under /tools/ndocs
24+
25+
326

4-
Contains the source code to the documentation.

docsource/topics/Annotations.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Title: Annotations
2+
3+
Annoations are comments that control test execution. utPLSQL parses comments on a package specification only, comments in the package body are ignored.
4+
5+
#TODO: Add parameters, examples and sync documentation with current annotation implementation.
6+
7+
topic: Annotation list
8+
9+
%suite - Marks package to be a suite with it procedures as tests. This way all testing packages might be found in the schema. Parameter of the annotation is the Suite name
10+
%suitepackage - Similar to java package. The example suite should be put as an element of the "globaltests" suite which is an element of the "all" suite. This allows one to execute "glovaltests" suite which would recursively run all the child suites including this one.
11+
%suitetype - The way for suite to have something like a type. One might collect suites based on the subject of tests (a system module for example). There might be critical tests to run every time and more covering but slow tests. This technique allows to configure something like "fast" testing.
12+
%setup - Marks procedure as a default setup procedure for the suite.
13+
%teardown - Marks procedure as a default teardown procedure for the suite.
14+
%test - Marks procedure as a test. Parameter is a name of the test
15+
%testtype - Another way to tag tests to filter afterwards
16+
%testsetup - Marks that special setup procedure has to be run before the test instead of the default one
17+
%testteardown - Marks that special teardown procedure has to be run before the test instead of the default one
18+
%suitesetup - Procedure with executes once at the beginning of the suite and doesn't executes before each test
19+
%suiteteardown - Procedure with executes once after the execution of the last test in the suite.

docsource/topics/Support.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Topic: Support
2+
3+
4+
#Fill out how methods to get support.

0 commit comments

Comments
 (0)