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

Subpages as folders #22

Open
vokimon opened this Issue Jun 15, 2014 · 17 comments

Comments

Projects
None yet
7 participants
@vokimon

vokimon commented Jun 15, 2014

When dealing with subpages it would be nice having them as folders instead of translating the slash / as '%2F'.

For instance, I have the following pages:

  • Devel
  • Devel/TODO
  • Devel/Projects

They are currently generated as:

  • Devel.mw
  • Devel%2FTODO.mw
  • Devel%2FProjects.mw

And it would be nice they were:

  • Devel.mw
  • Devel/TODO.mw
  • Devel/Projects.mw

Being the slash a folder in Unix syntax.

@rohieb

This comment has been minimized.

Show comment
Hide comment
@rohieb

rohieb Aug 17, 2014

I would also very like to see this, maybe as a config option.

rohieb commented Aug 17, 2014

I would also very like to see this, maybe as a config option.

@moy

This comment has been minimized.

Show comment
Hide comment
@moy

moy Sep 28, 2014

Collaborator

This is probably easy to implement (search for SLASH_REPLACEMENT in Mediawiki.pm. Probably skipping the replacements conditionally would work), but I won't have time to do this any time soon. Patches welcome.

Collaborator

moy commented Sep 28, 2014

This is probably easy to implement (search for SLASH_REPLACEMENT in Mediawiki.pm. Probably skipping the replacements conditionally would work), but I won't have time to do this any time soon. Patches welcome.

@freephile

This comment has been minimized.

Show comment
Hide comment
@freephile

freephile Nov 19, 2014

Not a solution to the issue, but if you want a list of how many of your files use "subpages" and you would like the list formatted as a directory-like structure, then ls with a little assist from awk will oblige:
ls -1 *%2F* | awk '{sub(/\.mw$/, ""); sub(/%2F/, "/"); print}'

freephile commented Nov 19, 2014

Not a solution to the issue, but if you want a list of how many of your files use "subpages" and you would like the list formatted as a directory-like structure, then ls with a little assist from awk will oblige:
ls -1 *%2F* | awk '{sub(/\.mw$/, ""); sub(/%2F/, "/"); print}'

@vokimon

This comment has been minimized.

Show comment
Hide comment
@vokimon

vokimon Nov 20, 2014

freephile, i have the feeling that either you misunderstood the issue or i misunderstood your comment.
It not about seeing a list, it is about working with such files in the most straight forward way in your filesystem. There is no use in having a nicely displayed list if you have to deal with filenames with %2f anyway when using them.

vokimon commented Nov 20, 2014

freephile, i have the feeling that either you misunderstood the issue or i misunderstood your comment.
It not about seeing a list, it is about working with such files in the most straight forward way in your filesystem. There is no use in having a nicely displayed list if you have to deal with filenames with %2f anyway when using them.

@akhuettel

This comment has been minimized.

Show comment
Hide comment
@akhuettel

akhuettel Feb 17, 2015

If you do this reorganization, you probably want to keep the toplevel directory for Namespaces. I.e. Pages/Devel/ToDo, Talk/Devel/ToDo, ...

akhuettel commented Feb 17, 2015

If you do this reorganization, you probably want to keep the toplevel directory for Namespaces. I.e. Pages/Devel/ToDo, Talk/Devel/ToDo, ...

@lyubomyr-shaydariv

This comment has been minimized.

Show comment
Hide comment
@lyubomyr-shaydariv

lyubomyr-shaydariv Aug 26, 2015

I'm not a Perl guy and I'm not sure if it's a good patch ( https://gist.github.com/lyubomyr-shaydariv/a950cdd297568e81e652 ), but it seems to work for me fixing the most obvious code. The only scenarios I checked are clone, pull, commit and push for regular articles only.

The .mw extension is not removed unlike the issue description suggests. The subdirectories option is enabled using -c remote.origin.subpageDirs=true during the cloning and it is not recommended to be modified in or removed from .git/config after the cloning.

Namespaces as subdirectories seem to be out of scope of the issue.

lyubomyr-shaydariv commented Aug 26, 2015

I'm not a Perl guy and I'm not sure if it's a good patch ( https://gist.github.com/lyubomyr-shaydariv/a950cdd297568e81e652 ), but it seems to work for me fixing the most obvious code. The only scenarios I checked are clone, pull, commit and push for regular articles only.

The .mw extension is not removed unlike the issue description suggests. The subdirectories option is enabled using -c remote.origin.subpageDirs=true during the cloning and it is not recommended to be modified in or removed from .git/config after the cloning.

Namespaces as subdirectories seem to be out of scope of the issue.

@moy

This comment has been minimized.

Show comment
Hide comment
@moy

moy Aug 26, 2015

Collaborator

The patch looks sensible. Can you submit it to Git so that it can be integrated in git-remote-media-wiki? https://github.com/git/git/blob/master/Documentation/SubmittingPatches

Thanks,

Collaborator

moy commented Aug 26, 2015

The patch looks sensible. Can you submit it to Git so that it can be integrated in git-remote-media-wiki? https://github.com/git/git/blob/master/Documentation/SubmittingPatches

Thanks,

@akhuettel

This comment has been minimized.

Show comment
Hide comment
@akhuettel

akhuettel Jan 17, 2016

Patch added to the Gentoo git patchset, thanks!

akhuettel commented Jan 17, 2016

Patch added to the Gentoo git patchset, thanks!

@lyubomyr-shaydariv

This comment has been minimized.

Show comment
Hide comment
@lyubomyr-shaydariv

lyubomyr-shaydariv Jan 17, 2016

@akhuettel just curious: what does that actually mean? As far as I remember, the patch was not accepted to the git source base due to bad submission.

lyubomyr-shaydariv commented Jan 17, 2016

@akhuettel just curious: what does that actually mean? As far as I remember, the patch was not accepted to the git source base due to bad submission.

@akhuettel

This comment has been minimized.

Show comment
Hide comment
@akhuettel

akhuettel Jan 19, 2016

@lyubomyr-shaydariv when users signal that they want experimenal git-mediawiki improvements, the patch is added to the git installation on Gentoo Linux. Good way to find more bugs. :)

We already found one btw. "git clone" crashes on encountering a page with a name containing "/", e.g. https://wiki.gentoo.org/wiki//etc/portage/repos.conf/webrsync.conf

akhuettel commented Jan 19, 2016

@lyubomyr-shaydariv when users signal that they want experimenal git-mediawiki improvements, the patch is added to the git installation on Gentoo Linux. Good way to find more bugs. :)

We already found one btw. "git clone" crashes on encountering a page with a name containing "/", e.g. https://wiki.gentoo.org/wiki//etc/portage/repos.conf/webrsync.conf

@lyubomyr-shaydariv

This comment has been minimized.

Show comment
Hide comment
@lyubomyr-shaydariv

lyubomyr-shaydariv Jan 19, 2016

@akhuettel ah, I see now, good to know. :) Thanks!

Regarding the bug you were talking about. It generated an empty file name that cannot be represented in file system as far as I know. One of the fixes might be as follows: https://github.com/lyubomyr-shaydariv/git/commit/792de1254a6e1c676b030dd7a34449b3644776df . This patch keeps the original trailing %2F after the leading slash /. Thus, Test///Test is transformed into Test/%2F%2FTest. Not that beautiful, but this might be a solution as MediaWiki prohibits %00-%FF appearing in page titles.

lyubomyr-shaydariv commented Jan 19, 2016

@akhuettel ah, I see now, good to know. :) Thanks!

Regarding the bug you were talking about. It generated an empty file name that cannot be represented in file system as far as I know. One of the fixes might be as follows: https://github.com/lyubomyr-shaydariv/git/commit/792de1254a6e1c676b030dd7a34449b3644776df . This patch keeps the original trailing %2F after the leading slash /. Thus, Test///Test is transformed into Test/%2F%2FTest. Not that beautiful, but this might be a solution as MediaWiki prohibits %00-%FF appearing in page titles.

@lyubomyr-shaydariv

This comment has been minimized.

Show comment
Hide comment
@lyubomyr-shaydariv

lyubomyr-shaydariv Jan 19, 2016

@akhuettel and one more thing. Leading slashes cause a crash too, so https://github.com/lyubomyr-shaydariv/git/commit/6c3883e6dd8c8c712eb86aab073638efb8ae7ead may help. Trailing slashes seem to work fine.

lyubomyr-shaydariv commented Jan 19, 2016

@akhuettel and one more thing. Leading slashes cause a crash too, so https://github.com/lyubomyr-shaydariv/git/commit/6c3883e6dd8c8c712eb86aab073638efb8ae7ead may help. Trailing slashes seem to work fine.

@anarcat

This comment has been minimized.

Show comment
Hide comment
@anarcat

anarcat Nov 18, 2017

Contributor

fwiw, in #34 (comment) @lyubomyr-shaydariv mentioned 3 patches necessary for this. i haven't reviewed the thread here or what's actually the best approach for this, but it seems to me we'd need to make a clean patch for review here.

Contributor

anarcat commented Nov 18, 2017

fwiw, in #34 (comment) @lyubomyr-shaydariv mentioned 3 patches necessary for this. i haven't reviewed the thread here or what's actually the best approach for this, but it seems to me we'd need to make a clean patch for review here.

@anarcat anarcat added this to the Next release milestone Nov 19, 2017

@lyubomyr-shaydariv

This comment has been minimized.

Show comment
Hide comment
@anarcat

This comment has been minimized.

Show comment
Hide comment
@anarcat

anarcat Nov 20, 2017

Contributor

@lyubomyr-shaydariv awesome - do you mind sending this as a pull request?

Contributor

anarcat commented Nov 20, 2017

@lyubomyr-shaydariv awesome - do you mind sending this as a pull request?

@lyubomyr-shaydariv

This comment has been minimized.

Show comment
Hide comment
@lyubomyr-shaydariv

lyubomyr-shaydariv Nov 20, 2017

@anarcat No problem, please see #51. Please note that I don't have a test environment now and had to graft the patches to this repository branch by editing the patch manually, so it may need to be verified scrupulously.

lyubomyr-shaydariv commented Nov 20, 2017

@anarcat No problem, please see #51. Please note that I don't have a test environment now and had to graft the patches to this repository branch by editing the patch manually, so it may need to be verified scrupulously.

@anarcat

This comment has been minimized.

Show comment
Hide comment
@anarcat

anarcat Nov 20, 2017

Contributor

no problem. as you can see there and in #48, the test suite is totally broken now anyways. :p

Contributor

anarcat commented Nov 20, 2017

no problem. as you can see there and in #48, the test suite is totally broken now anyways. :p

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