Skip to content

Conversation

@mathematicalcoffee
Copy link
Contributor

For #332.

I added a bunch of tests for tutorial/resolver.js too (i'll get round to filling out tests for tutorial.js eventually but i'll submit that as a separate pull request).

A .json file in the tutorials directory may be of the form:

{"title": "My TItle", "children": [ /* list of children */ ]}

in which case the file's name is used to connect the metadata with the tutorial (behaviour before this patch)

I've added the ability to specify multiple tutorial cnofigurations in one file like so:

{
  "sometopic" : {
    "title" : "Some Topic!",
    "children" : [
      "sometopicchild",
      "someothertopicchild"
    ]
  },
  "anothertopic" : {
    "title" : "etc"
  }
}

in this case, the JSON's file name is ignored and we use the object keys as the tutorial names (to match metadata to tutorials).

Additionally, one may specify a tutorial's metadata directly in the parent tutorial's 'children' attribute:

{
  "sometopic": {
    "title": "Some Topic!",
    "children": {
      "sometopicchild": {                 // <------
          "title": "Whatta Topic!"
      },
      "someothertopicchild": {
          "title": "You Gotta See This Topic!"
      }
    }
  }
}

I will put in a pull request for jsdoc3.github.com's tutorial page to update it, but what version would this change make it to? So that I can say "Since v3.??, you can also specify metadata for multiple tutorials in a single file ...."

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe that Node.js' util.isArray() (which we provide as a shim; just require('util')) is a little safer than instanceof Array, although I forget why...

@hegemonic
Copy link
Contributor

Thanks for implementing this, @mathematicalcoffee! Once you address my minor comments, I'm ready to merge this.

For the docs, let's assume this shows up in 3.2.

@mathematicalcoffee
Copy link
Contributor Author

OK, done. I used Array.isArray instead which is built in to ES5 (never knew that function existed!)

@hegemonic
Copy link
Contributor

Nice--I didn't know about that either.

Thanks again!

hegemonic added a commit that referenced this pull request Feb 13, 2013
…l-json

#332: Allow master configuration file for all tutorials
@hegemonic hegemonic merged commit ed56da0 into jsdoc:master Feb 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants