-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support automatic inclusion of files using ** (e.g. reference/**) #58
Support automatic inclusion of files using ** (e.g. reference/**) #58
Conversation
Could you write a couple of documentation lines to the docs in the gh-pages branch? Thanks :) |
See #60 |
Due to the tabs vs. spaces whitespacing (code used tabs, you used spaces) git thinks the whole navigationlevel file has changed, which isn't the case. I can't see properly what has changed in the file to review it. Will try to revert spaces to tabs and then do a diff. |
Sorry, didn't notice that. Probably the habit of hitting CTRL + K + D when editing lots of stuff in a file. Normally I try to accept the coding standard of the original project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the changes to this file? I'll then merge it. If tabs/spaces are a problem, leave them as spaces, I'll correct it here. You don't have to remove the spaces around the () in while/if statements.
Thanks!
src/DocNet/NavigationLevel.cs
Outdated
public bool IsRoot { get; set; } | ||
#endregion | ||
} | ||
public class NavigationLevel : NavigationElement<List<INavigationElement>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the whitespace issues make it hard to review the code. I should have added an editor config file but that's not honored in vs2015 anyway, but nevertheless, things are a bit problematic for reviewing. I can convert the spaces back to tabs tho, it's not the work, but to see which lines are changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't notice that. Probably the habit of hitting CTRL + K + D when editing lots of stuff in a file. Normally I try to accept the coding standard of the original project.
It's ok, notepad++ happily converts spaces to tabs when you ctrl-a -> TAB, SHIFT TAB :) After thatn winmerge was happy to show the differences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted to tabs.
src/DocNet/NavigationLevel.cs
Outdated
} | ||
public class NavigationLevel : NavigationElement<List<INavigationElement>> | ||
{ | ||
private readonly string _rootDirectory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All my code has private member fields and properties in their own regions so these things are hidden when you're normally coding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/DocNet/NavigationLevel.cs
Outdated
|
||
public void Load(JObject dataFromFile) | ||
{ | ||
foreach (KeyValuePair<string, JToken> child in dataFromFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: you introduced spaces in front of '(' for loops/ifs etc. Likely due to reformatting by a rule in Resharper. Code isn't bad due to that, but next time try to avoid these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(don't need to change these for merge btw)
src/DocNet/NavigationLevel.cs
Outdated
var childValue = child.Value.ToObject<string>(); | ||
|
||
var endsWithWildcards = childValue.EndsWith("**"); | ||
if (endsWithWildcards) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endsWithWildcards
is used just once, you can inline the variable in the if, which is preferable.
src/DocNet/NavigationLevel.cs
Outdated
continue; | ||
} | ||
|
||
var relativeFilePath = GetRelativePath(_rootDirectory, mdFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a MakeRelativePath in Utils.cs in the Docnet project, please use that one.
src/DocNet/NavigationLevel.cs
Outdated
return root; | ||
} | ||
|
||
private string GetRelativePath(string origin, string fullPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove and use Utils.MakeRelativePath instead
src/DocNet/NavigationLevel.cs
Outdated
} | ||
|
||
private string FindTitleInMdFile(string path) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I thought "We have a markdown parser, why use this!?" but it's indeed a catch-22: you can't use the title from the parsed content like I do with the H2's, as the content might not be parsed yet and the name is used in toc parts on pages where the markdown of this page isn't known (yet). It feels like a hack still, but I don't know of a different way to solve it, so let's keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not extremely happy with this one either, but looked like the least-worst solution.
Merged! |
Fixes #48
Usage is fairly simple (in DocNet):
The API reference part uses the ** at the end. It means that all (sub)folders inside /reference will be checked for MD files. A few automatic rules:
This becomes extremely useful when parts of the docs are generated via a tool such as SharpDox.