Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Fixes for ogma #2

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open

Fixes for ogma #2

wants to merge 51 commits into from

Conversation

Ebernn
Copy link

@Ebernn Ebernn commented Apr 20, 2022

These changes are specific to Ogma:

  • ogma example
  • ogma hierarchy

README.md Outdated
@@ -1,3 +1,29 @@
### 🎯 Purpose of this branch

Reproduce issues that I currently encounter when generating documentation with documentation.js
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stuff is better to put in the PR description, then you can use checkboxes etc

@@ -25,6 +25,7 @@
"highlight.js": "^11.3.1",
"ini": "^2.0.0",
"js-yaml": "^4.1.0",
"konan": "^2.1.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need this one?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see, it's from the original repo

@@ -0,0 +1,19 @@
<section class='py2 clearfix'>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to move this stuff to src/ogma_theme for now

@@ -27,68 +27,84 @@
type='text' />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this TOC file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It generates the final html file, it contains :

  • the left section (the TOC and the search bar)
  • the right section (the whole list of documented entities)
  • some js and css files

sharedImports.imports.renderHierarchy = template(
await fs.readFile(path.join(__dirname, 'hierarchy._'), 'utf8'),
sharedImports
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if (
path.node.leadingComments &&
path.node.leadingComments
.map(({ value }) => value.match(/^ *\*\*? ?@inner/))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regexp should be declared somewhere outside and given a readable name (IS_INNER_RE)

.map(segment => ({ scope: 'static', name: segment }));
path = comment.memberof.split('.').map(segment => ({
scope: 'static',
// remove $1 at the end of the name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can make it a function with a name like sanitizeLocalName

@@ -221,6 +222,29 @@ export default function (comments) {
return memo + scopeChar + part.name;
}, '');

// TODO: move this example out of this file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this should be some post or pre-processing, do they have an API for that?

@@ -97,7 +97,7 @@ const flatteners = {
result.kind = 'event';

if (tag.description) {
result.name = tag.description;
result.name = tag.description.split('\n')[0];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it safe?

*/
function retrieveDescriptionNextToTags(rawComment, tags) {
// regex to retreive the whole description string (new lines included)
const descLines = new RegExp(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be something that matches "from one tag to another"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants