Skip to content
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

Module links brake on default theme #170

Open
Flowkap opened this issue Aug 21, 2013 · 3 comments
Open

Module links brake on default theme #170

Flowkap opened this issue Aug 21, 2013 · 3 comments

Comments

@Flowkap
Copy link

Flowkap commented Aug 21, 2013

If using slahes within module names the hyperlinks created within the default theme break within the class view (top backlink to module the class is contained in)!

Module name: test/module/_privateModule
Link: test_module/_privateModule.html
should be: test_module_privateModule.html

Module name: test/module/publicModule
Link: test_module/publicModule.html
should be: publicModule.html

The files are named correctly and the links within the menu on the left work as well.

Additionally examples not working for classes.

@Flowkap
Copy link
Author

Flowkap commented Aug 21, 2013

I found a solution for the problem within lib/builder.js

The original version of the registerHelper('crossLinkModule' just replaces the first occurance within the item string.
If added the regex ///g instead solves the issue.

    Y.Handlebars.registerHelper('crossLinkModule', function(item, options) {
        var str = item;
        if (self.data.modules[item]) {
            var content = options.fn(this);
            if (content === "") {
                content = item;
            }
            str = '<a href="../modules/' + item.replace(/\//g, '_') +  // <<<< change here!!! >>>>
                  '.html">' + content + '</a>';
        }
        return str;
    });

I did not found where the replacing is been done for the sidebar. Shouldn't that be the same code? Sidebar replacing is correct but for crossLinkModule was faulty.

As I do not use git usually I don't know how to contribute to the repository.

@lexander
Copy link
Contributor

Thanks for the report / change. I see you also submitted a pull request! #171

We'll verify the change and make sure that the left sidebar code is using the same logic.

@Flowkap
Copy link
Author

Flowkap commented Aug 22, 2013

I found that the list on the left (sidebar) is generated by the found files. The crossLink is just generated from the comments @module. So it cant use the exactly same code atm as the crossLink is generated without checking the files.

IN fact there were 2 other small problems:

  1. The module page header didn't use the allModules.displayName for the module
  2. The search results did compare against the highlighted name with html tags. So the compare di always fail for modules. I added code to use the highlighted for classes but compare correctly for modules. Only problem module names fit now but are'nt highlighted anymore (TODO added as well.)

Don't see a simple solution for that atm without parsing the highlighted Text, remove the tags, compare, and if matched place the tag in the new displayname.

I think its anyway more desirely to see the correct naming of the module than have the highlighted but broken name.

If anybody wonders why I need it: We use AMD modules within dojo (like requireJS) and want to document the module names correctly with the forward slashes.

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

No branches or pull requests

2 participants