Closed epmoyer closed 4 years ago
I wonder if having a way to specify the base theme would be better. It would support a wide-layout with all the themes. What do you think? It would mean new configuration and command line options tho ...
I like that idea a lot. Specifying a base theme would allow people to easily migrate decks using their existing (local, custom) themes to widescreen by simply declaring the new base. It would also give a super-clean way to add a new aspect ratio if/when that becomes desirable.
You also interested in implementing?
Another idea, maybe even better: have a switch for wide-screen. Press w
key you get widescreen mode or something along those lines. This would be ideal as you might now always get same screen for a presentation.
My experience authoring both a bunch of 4:3 decks and now a big (30+ slides) 16:9 deck is that one ends up doing a fair bit of content shuffling in one's markdown to make sure that the content fits on the slides (and also, for me, to maximize my use of the space I have available). A deck made for 4:3 will work ok in wide, but if you prepare a deck intending to use wide then it is likely to overrun 4:3 (pictures may be too wide, and text will often run off the top/bottom). Personally I would always author a presentation for a specific target aspect ratio, so I'd never use an "on the fly" mode switch option (and having it arguably opens up the opportunity to accidentally switch to 4:3 during a presentation.
Not sure about implementation. I haven't looked into the code base really other than the css / html (but I'm very experienced in Python, so that's not an issue). Are there existing issues with tox or does it finish/pass for you? Right now tox fails for me, but I haven't dug into why. I noticed that the automated Travis build failed as well, so guessing it's not just me? It's harder to take on a "real" code change if not starting from a test suite that passes.
Just the publishing fails (i suppose because it's a pr). The content for layout argument sounds pretty sensible. What errors you get from tox? Gist/pastebin?
Here's a gist of running tox.
https://gist.github.com/epmoyer/3f51923c028a23d4b80e68407912f161
I've spent zero time trying to parse/resolve the errors. Seems like it is barfing on testing against multiple python versions, but I wasn't even sure the problem was mine (since it was failing on the unmodified repo clone) so I did no digging. I work in Anaconda (Conda) with a 3.7 base and don't use venv for anything I normally do, and haven't really used tox much.
Looks like you have some broken pythons installed (lacking certain stdlib modules). Either way looks like py27 is passing so no big deal, just run tox -e py27
and ignore the rest.
py27 was failing during dependency installation; looks like hashlib imports failing. Still getting the same errors when I run tox -e py27
.
Not your fault I imagine; python packaging / deployment is the worst :) It shouldn't be so hard to replicate tests on another machine, but invariably is.
Still, will take me some mucking about to sort out; at the moment I am in crunch mode to get this presentation finished today, so I won't be able do dig in until early next week. Maybe I can get over the hump by running in a clean 2.7 Conda environment, or running this build/test on a linux vm.
Let's figure out the "requirements" for the new option. I didn't see a good lower case option so I was thinking upper case -B with the form:
-B BASE, --base=BASE
Where BASE
(for the moment) can be one of ["default", "wide16x9"]
It doesn't make sense to me to allow someone to pass a path and specify their own custom "base", since they can effectively achieve any customization goals by creating their own custom theme (directory) and overriding any/all of the base there.
The default (when -B
is not given, or -B default
is given) would be the 4:3 base, so the new release wouldn't break anyone's existing deck build scripts.
I think the dist/examples
build should then create decks for the 4 existing styles in both bases (so, 8 decks total), and the footer links in the example decks should link to all 8 decks.
What do you think?
Okay, not ready to merge yet, but I pushed an "experimental" command line option change.
Open issues:
wide16x9/
, and they get "layered" on top of default when you specify --base=wide16x9
)I changed the footer to reference all 8 decks (which required a little re-formatting so all the names would fit on the 4:3 slide), and changed tox to build all 8 decks.
Also, do you believe that printing works currently? I never updated print.css to support 16x9, and presumably I should, but I've been experimenting with Safari/Chrome/Firefox and I can't get the 4:3 slide deck to print properly; I'd need to figure out how to do that before I can change/validate print.css for 16:9. Is there some trick or mode change or something special I should be doing to print, or is a regular File->Print supposed to work properly? Chrome comes closest to working for me, but the pagination is wrong whether I print to portrait or landscape.
I've only got printing to work in chrome cause only chrome has an useful (preview feature) pdf export output for printing. It's kinda wonky yes, you have to press the print button when certain display options are set (can't remember for sure but I think you have to be in expose mode to make the page breaks work properly).
Ok, as of the latest commit (6718cee) the PR is a "release candidate". Let me know what you think.
-M --mod=MOD
as the syntax.--max-toc-level
(noticed it was missing)print.css
for 16x9 so it works as well as 4x3 does :)Cheers!
I wondered for a bit if the theme mod could also be applied to situations where default ain't the base theme, but then again, maybe it wouldn't be compatible anyway with other themes that start with brand new css.
Anyway, do I understand it correctly - wide16x9 is a copy of default's css with changes right? How come you changed the option to "mod" from "base", since it's technically a base theme?
Anyway, do I understand it correctly - wide16x9 is a copy of default's css with changes right?
Correct, but to be precise it contains modified copies of only those default files which needed to change, which ended up being 3 of the 4 css files.
How come you changed the option to "mod" from "base", since it's technically a base theme?
I changed it to mod
from base
because the new directory wide16x9/
is not a stand-alone base but rather contains modifications to the default/
base.
The end result (of using --mod
when generating a deck) behaves like a "new" base theme, but really it is applying a modification to the default base theme. If the option were called --base
then wide16x9/
should really be a directory containing a full set of base files, (i.e. the same 6 files in default/
). But only 3 files require changes to implement wide screen (base.css
, print.css
, and screen.css
), so the 3 other files would just be exact copies of the versions in default/
, and that would make maintaining the code harder in the future (because if anyone needed to make changes to the other 3 files (base.html
, slides.js
, or theme.css
) then they would have to make those changes to both copies (i.e. the one in default/
and the one in wide16x9/
).
That is the trade-off I was referring to in my post about the DRY Principle two days back. The DRY (Don't Repeat Yourself) Principle says that one wants to avoid repeating code (or data) because it makes maintainability more difficult.
The real vulnerability (to maintainability) of violating DRY isn't so much the effort associated with maintaining (future) changes in two places, but the risk associated with making (future) changes to one copy and (accidentally) neglecting to change the other.
Just checking in. I can go either way on the above. If you prefer the simplicity of --base
over the maintainability of --mod
then I will switch it. Your call.
So I'm including this as is, and I've added what I had in mind in the master branch. It may be bit broken but it has all the right bits: not repeating styling in the mod and some refactoring on the internals. I've removed the copy_theme option since it was broken anyway with the mod support.
Also, now with few changes there could be support for multiple "mods".
@epmoyer please give the master a try, I'd like a bit of testing before cutting the new release.
@ionelmc I am kicking the tires today. I like what you did with the css cascading; it completely didn't occur to me to override just the styles that needed modification; that is a much cleaner approach.
@ionelmc I did a bunch of testing (including regenerating my fairly complex wide slide deck with the new master) and I can successfully build an identical deck with a few issues:
raise IOError("Theme %s not found or invalid" % theme)
code is gone, so maybe that check is gone entirely, or maybe the replacement check is not functioning properly.Old behavior:
bash-3.2$ darkslide --version
darkslide 5.1.0
bash-3.2$ darkslide slides_PROCESSED.md -t not_a_real_theme --destination=presentation_UNRESIZED.html
Error: Theme not_a_real_theme not found or invalid
bash-3.2$
New behavior (master 455045b):
bash-3.2$ python -m darkslide slides_PROCESSED.md -t not_a_real_theme --destination=presentation_UNRESIZED.html
Adding 'slides_PROCESSED.md' (markdown)
Generated file: presentation_UNRESIZED.html
bash-3.2$
.html
file in the default
theme changed from base.html
to template.html
. Anyone who has a local custom theme which overrides base.html
would need to rename their file. The new file also contains some breaking changes to the templating variables, so they would have to merge those changes as well.
base.html
to add a footer and a custom font to my slides.base.html
), and you have to figure out that something went wrong (and try to figure out where/why) by noticing that some aspect of your custom template (footers and fonts in my case) is not showing up in your deck. It would probably be better to fail hard if darkslide finds a base.html
file in a theme directory with a message that base.html
has been deprecated/renamed to template.html
.Overall this is an awesome release candidate; I'm very happy with where it landed. Kudos!
Did you also use the copy-theme feature by any chance?
I don't think I ever used --copy-theme. It's vaguely possible I used it at some point to get the original copy of default/ that I modified to create my custom theme, but more likely I just copied the default/ theme from my local pull of the git repo.
Well I fixed the missing errors and did a check for base.html. I'd like to make the templates use inheritance and have blocks for footer/header/whatever (that will make your custom template be future proof) but maybe someone else who has custom template could contribute that feature :P
:) Sounds good to me. Thanks!
Btw ... I did have a custom footer in one of my templates, but I just used slide markup, eg: https://blog.ionelmc.ro/presentations/things-to-try-with-a-tracer/slides.rst
Adds a wide16x9 theme per issue #11.
Tox did not run without error for me (before the change), but it does run enough to generate the example slide decks (in
dist/examples/
). It runs as well now (post-change) as it did for me before (pre-change) :)Note: I changed the "default theme" link in the slide footer from
.
toindex.html
so that the link to the default theme would work when opening the example deck files locally in a browser (rather than browsing them from a web server). I believe theindex.html
supports both cases.I've been using this new theme (with some local style customizations) to develop a complex~30+ slide deck with lots of content/images/etc and it has behaved robustly.
Default:
Wide:
Wide Expose:
Wide Presenter:
Wide Next Slide:
Wide Notes: