-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Template files and the generator itself is almost finished
- Loading branch information
1 parent
a9a7a9f
commit a4c942b
Showing
54 changed files
with
350 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{% $array-methods \ $array-methods."flatten & compact & transpose & uniq" %} |
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 @@ | ||
{% $array \ $"array"."Array pointer" %} |
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,3 @@ | ||
# Basics | ||
|
||
{% $basics \ $basics.Basics %} |
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 @@ | ||
{% $binary-octal-hexadecimal \ $binary-octal-hexadecimal.Upcase %} |
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 @@ | ||
{% $bit-manipulation %} |
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 @@ | ||
{% $bools \ $bools."Truthy and falsey" \ $bools."Method naming conventions with booleans" %} |
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 @@ | ||
{% $case \ $case."Exhaustive case" %} |
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 @@ | ||
{% $char \ $char.Escaping %} |
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 @@ | ||
{% $classes \ $classes."Shorthand to initialize instance variables" %} |
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,2 @@ | ||
{% $conditionals \ $conditionals."Spaceship operator" \ $conditionals."Ternary Operator" \ $conditionals."if and unless as suffix" %} | ||
{% $conditionals."Ternary Operator"%} |
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 @@ | ||
{% $modules %} |
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 @@ | ||
{% $nil \ $nil."not_nil!" %} |
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 @@ | ||
{% $number-types \ $number-types."Type after an operation" \ $number-types."Dig Deeper: unsigned integers vs signed integers" %} |
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 @@ | ||
{% $numbers \ $numbers."Integer division" \ $numbers."Exponentiation" \ $numbers."Rounding up and down" %} |
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 @@ | ||
{% $ranges \ $ranges."Custom objects in ranges" %} |
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 @@ | ||
{% $return %} |
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 @@ | ||
{% $string-methods \ $string-methods.String#reverse \ $string-methods."String#capitalize & String#camelcase & String#underscore & String#titleize" %} |
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 @@ | ||
{% $strings \ $strings."Substring test" \ $strings."Unicode" %} |
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 @@ | ||
{% $union-type \ $union-type."Inferring union types" %} |
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 @@ | ||
{% $while-loops \ $while-loops."Use while as an expression" %} |
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,86 @@ | ||
# Crystal's Documentation Generator | ||
|
||
⚠️ This tool is a work in progress, it is in production on the Crystal track but breaking changes **WILL** ocour without warning ⚠️ | ||
|
||
This is a documentation generator built 100% using Crystal. | ||
It purpose is to create a [DSL][dsl] for creating syllabus docs for Exercism. | ||
This tooling is not intended to be used outside of Exercism. | ||
|
||
## Goal | ||
|
||
The goal of this tool is to create a DSL that can be used to create syllabus docs for Exercism, in a more efficent way and with a system that ensures that the docs are synced. | ||
The tool is designed to be able to create docs for any language track on Exercism and it is possible to create an excutable to make Crystal not a requirement for the end user. | ||
Its main purpose is to be able to have a single source of text and then through templating being able to create other docs like the introduction. | ||
This tool differs from the already existing documentation generator bundled with configlet in that it will have more features and be more flexible and thereby allow for more complex docs to be created. | ||
|
||
## Installation | ||
|
||
### From source | ||
|
||
To install this tool from source you need to have Crystal installed. | ||
Then you can run the following command: | ||
|
||
```bash | ||
cd document-generator | ||
crystal build ./src/cli.cr -o ./bin/document-generator | ||
mv ./bin/document-generator ../bin/document-generator | ||
``` | ||
|
||
## Usage | ||
|
||
### Using the CLI | ||
|
||
```bash | ||
# To get all the available commands | ||
./bin/document-generator --help | ||
|
||
# To generate all docs | ||
./bin/document-generator -all | ||
|
||
# To generate docs for a specific concept | ||
./bin/document-generator -d <concept_name> | ||
|
||
# To generate docs for a specific exercise | ||
./bin/document-generator -e <exercise_name> | ||
``` | ||
|
||
### Writing templates | ||
|
||
This library uses a DSL to write templates, but as of writing this so is the dsl rather limited and is subject to change. | ||
The DSL is only able to grab text from the `about.md` files thereby all the text that is used in the docs should be put in the `about.md` files. | ||
The template should be put under the `.meta` folder with the name `template.md`. | ||
|
||
To include the complete content of a concept, use the `{% $concept %}` syntax, the concepts name needs to have a `$` in front of it to highlight that it is a variable and not a command. | ||
|
||
```markdown | ||
{% $strings %} | ||
``` | ||
|
||
To include a specific header from a concept, use the `{% $concept.header %}` syntax, the concept and the header needs to be separated by a `.`. | ||
If the header has a space in it, then the header needs to be sorounded by `""`. | ||
|
||
```markdown | ||
{% $strings.introduction %} | ||
{% $strings."about strings" %} | ||
``` | ||
|
||
To exclude a specific header from a concept, use the `{% $concept exclude $concept.header %}`, allternativly `exclude` have a shorthand which is `\`. | ||
|
||
```markdown | ||
{% $strings exclude $strings.introduction %} | ||
{% $strings \ $strings."about strings" %} | ||
``` | ||
|
||
## Roadmap | ||
|
||
- [x] Create a DSL for creating syllabus docs | ||
- [x] Create a CLI to work with the DSL | ||
- [x] Automatic link handling system | ||
- [x] Add a CI script to run tests on the generated docs | ||
- [ ] Fully extensive test suite | ||
- [ ] Fully documented code & Usage | ||
- [ ] Add support to exclude multiple heading easier from the docs | ||
- [ ] Add support to exclude all children from a heading | ||
- [ ] Add support to reuse the introduction docs | ||
- [ ] Add support for changing `#` level of headings | ||
- [ ] Add syntax when working inside certain concept to refer to that concept |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
require "option_parser" | ||
require "./interface.cr" | ||
|
||
OptionParser.parse do |parser| | ||
parser.banner = "Welcome to The Crystal Doc Generator" | ||
|
||
parser.on "-v", "--version", "Show version" do | ||
puts "version 0.1.0" | ||
exit | ||
end | ||
parser.on "-h", "--help", "Show help" do | ||
puts parser | ||
exit | ||
end | ||
|
||
parser.on "--all", "Generate all docs" do | ||
|
||
Generator.new().generate_all | ||
exit | ||
end | ||
|
||
parser.on "-d [DOC]", "--doc [DOC]", "Generate doc for a specific file" do |doc| | ||
Generator.new().generate_doc(doc) | ||
exit | ||
end | ||
|
||
parser.on "-e [EXERCISE]", "--exercise [EXERCISE]", "Generate doc for a specific exercise" do |exercise| | ||
Generator.new().generate_exercise_doc(exercise) | ||
exit | ||
end | ||
end |
Oops, something went wrong.