-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
182 additions
and
34 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,35 @@ | ||
# Documentation Patterns | ||
|
||
Captures key logic for exporting documentation for a VSCode workspace as Markdown. | ||
|
||
## General Structure | ||
|
||
"root" is the folder that all docs go to, this is `extension/docs` for the extension | ||
|
||
- `api` is the holder of all of our docs | ||
|
||
- `class` contains class definitions (i.e. summaries) for structures and classes | ||
|
||
- `class/func` contains class function methods by name `class__method` | ||
|
||
- `class/pro` contains class procedure methods by name `class__method` | ||
|
||
- `func` contains all functions by lower-case name | ||
|
||
- `pro` contains all procedures, by lower-case name | ||
|
||
- `task` contains all tasks | ||
|
||
- `task/envi` contains ENVI Tasks by lower-case task name | ||
|
||
- `task/idl` contains IDL Tasks by lower-case task name | ||
|
||
## Linking to Other Routines | ||
|
||
With the pattern outlined above, its very easy to craft links between your docs to different routines. | ||
|
||
For example: | ||
|
||
- To link to a function called, `plot` you make a Markdown link with the value `/api/func/plot.html` | ||
|
||
- To ling to the class summary for `myclass` you make a Markdown link with the value `/api/class/myclass.html` |
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
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
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 |
---|---|---|
@@ -1,9 +1,29 @@ | ||
import { TASK_REGEX } from '@idl/types/core'; | ||
|
||
import { DOCS_BASE } from '../docs-exporter.interface'; | ||
import { DOCS_PATHS } from '../folder-map.interface'; | ||
|
||
/** | ||
* Gets the link for a class | ||
*/ | ||
export function GetClassLink(name: string) { | ||
return `${DOCS_BASE}/${DOCS_PATHS.CLASS}/${name}.md`; | ||
const taskMatch = TASK_REGEX.exec(name); | ||
|
||
/** | ||
* Do we have a task? | ||
*/ | ||
if (taskMatch !== null) { | ||
/** Get the name of the task */ | ||
const taskName = taskMatch[1].toLowerCase(); | ||
/** | ||
* Is it an ENVI task? | ||
*/ | ||
if (name.toLowerCase().startsWith('envi')) { | ||
return `${DOCS_BASE}/${DOCS_PATHS.ENVI_TASK}/${taskName}.md`; | ||
} else { | ||
return `${DOCS_BASE}/${DOCS_PATHS.IDL_TASK}/${taskName}.md`; | ||
} | ||
} else { | ||
return `${DOCS_BASE}/${DOCS_PATHS.CLASS}/${name}.md`; | ||
} | ||
} |