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

Added settings to give a different output filename than index.html #115

Merged
merged 2 commits into from Oct 14, 2014

Conversation

2 participants
@j0nes2k

j0nes2k commented Sep 28, 2014

With this option it is possible to specify another output filename for the generated gallery files than the default index.html. This is useful if the directory index is already used otherwise.

@saimn

This comment has been minimized.

Owner

saimn commented Oct 2, 2014

Hi @j0nes2k ,
I wonder if we could combine this with another feature, which would be to allow to render multiple templates, adding a flexible way to specify templates / output files. This could be done with a setting which would map a template name to an output file name. Something like:

templates = {
    'index.html': 'index.html' // template: output file
} 

or maybe a list of tuples

templates = [
    ('index.html', 'index.html') // template: output file
]

What do you think ?

@j0nes2k

This comment has been minimized.

j0nes2k commented Oct 7, 2014

I agree that this approach would solve the basic problem for me, too.
However I am not sure how big these changes will be as it probably goes
quite deep into the rendering mechanism. Can you estimate the effort and
potential pitfalls?

@saimn

This comment has been minimized.

Owner

saimn commented Oct 7, 2014

Hmm, looping on the list of (template, output_file) can be easily done in the write method, but the tricky point is how to handle the urls.
Currently albums have an url which is the album name + optionally the 'index.html' useful if you want to browse the gallery without a webserver. I don't know if these urls should be different for different templates. I don't have a clear use case now, there was a proposition to do something like that in #74 but the code has changed a lot since that and this PR didn't not address the url issue. Any suggestions are welcome, otherwise we can go on with your PR and we will later if a more evolved feature is needed.

self.path = path
self.name = path.split(os.path.sep)[-1]
self.gallery = gallery
self.settings = settings
self.output_file = output_file

This comment has been minimized.

@saimn

saimn Oct 7, 2014

Owner

This could be directly settings['output_filename'] (instead of adding an extra parameter).

@j0nes2k

This comment has been minimized.

j0nes2k commented Oct 11, 2014

I also think that support for multiple output files is generally a good idea and can be used for a lot of other advanced features (like tag pages, recent changes etc). I would suggest to have a look at this problem again when developing features that require these changes.

saimn added a commit that referenced this pull request Oct 14, 2014

Merge pull request #115 from j0nes2k/setting_output_filename
Added settings to give a different output filename than index.html

@saimn saimn merged commit 119e16e into saimn:master Oct 14, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@saimn

This comment has been minimized.

Owner

saimn commented Oct 14, 2014

Ok, let's start with this. Thanks for the contribution :)

@saimn saimn modified the milestone: 0.9 Aug 31, 2015

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