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

need more support in -exclude option #5

Open
wuker opened this issue Jan 27, 2013 · 2 comments
Open

need more support in -exclude option #5

wuker opened this issue Jan 27, 2013 · 2 comments

Comments

@wuker
Copy link

wuker commented Jan 27, 2013

I am looking for a way to introduce more option so as to ignore some namespaces or sub namespaces. For example, to support regex might be a good approach. In my case, I have namespaces :A, :A:B, :A:C, :A:C:figures, I am trying to show all namespaces but ignore all pages in :A:C:figures, I try the following

<nspages a -textPages="Pages in namespace [:A:*]" -r -nbCol=2 -exclude:figures>

but it doesn't work. The pages under :A:C:figures still there

@pkleczek-agh
Copy link

@gturri , the requested feature could be easily implemented by re-using the code of -pregPagesOff option.

Currently -pregPagesOn and -pregPagesOff discard the whole file's namespace, which makes it impossible to exclude all pages from a given namespace. The relevant line is in isFileWanted() function in filePreparer.php:

    function isFileWanted($file, $useTitle) {
        $wanted = true;
        $nameToFilterOn = $useTitle ? $file['title'] : noNS($file['id']);  /* why to force noNS()? */
        /* ... */
    }

In my opinion it would be better to add yet another option to your plugin, eg -pregSubPagesOff where no noNS() would be performed on $file['id'].

(I also needed such a feature and manually edited the code locally...)

@gturri
Copy link
Owner

gturri commented Dec 9, 2018

Thanks for looking into it!

Actually my main issue is that I'm not sure how this feature should be implemented to make sure it doesn't break existing behavior. For instance, the call to noNS makes it possible to filter pages based on their id, without being impacted by the namespace they're in. So, as you suggest, it would probably be a good idea to add another option. But since I wouldn't be a user of this feature myself, I'm having a hard time understanding which option should be added, and how it should behave exactly.

Since you seem to have quite a good understanding of it all, what about adding the flags you would find useful, and submitting a pull request?
(Adding a flag is quite easy. You may refer to ea747c9 for instance: it's just a matter of adding a default value in _getDefaultOptions, parsing its actual value in the handle method (both in syntax.php) and then making sure the option is passed all the way down to the place where it needs to be read)

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

No branches or pull requests

3 participants