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

Load a base theme that provide defaults for all required keys #132

Closed
mojavelinux opened this issue May 20, 2015 · 7 comments
Closed

Load a base theme that provide defaults for all required keys #132

mojavelinux opened this issue May 20, 2015 · 7 comments
Assignees

Comments

@mojavelinux
Copy link
Member

Currently, each theme must provide all required values or else the converter will crash. It would be better if a theme only had to specify values for keys it wants to override / customize. This can be accomplished by introducing a base theme. The base theme should be loaded before the specified theme and provide defaults for all required values.

You can think of the base theme as a “CSS reset”.

@mojavelinux mojavelinux added this to the v1.5.0 milestone May 20, 2015
@mojavelinux mojavelinux self-assigned this May 20, 2015
@mojavelinux
Copy link
Member Author

The base theme also allows us to introduce new theme settings without the risk of breaking existing themes.

@mojavelinux
Copy link
Member Author

Once we have a base theme in place, we should remove all the unnecessary fallbacks when we check for keys...or, these fallbacks should be preconfigured.

Case in point:

@theme.prose_margin_bottom || @theme.vertical_rhythm

We have to assume we're going to have a value for the prose_margin_bottom key or the code is just ugly.

@wolandscat
Copy link

Now that I have Asciidoctor PDF 1.5.0.alpha.8, do I assume that theme base + overriding is working yet, or do I still need to copy the base theme?

@mojavelinux
Copy link
Member Author

mojavelinux commented Jun 25, 2015 via email

@rmpestano
Copy link

Hi guys, i'm using alpha8 and can't load my custom theme. I've just put my theme file in same directory as my adoc document and ran asciidoctor-pdf myfile.adoc. The theme file is name myfile-theme.yml

@rmpestano
Copy link

managed to load my theme using pdf-style and styledir options:

asciidoctor-pdf myfile.adoc -a pdf-style=myfile -a pdf-stylesdir=/home/pestano/projects

It would be nice if it used adoc file path as default pdf-stylesdir and adoc filename(plus -theme sulfix) as default pdf-style. If no pdf-style is found then use basic-theme.yml.
Does it makes sense? I think it should work like docinfo.html

@mojavelinux
Copy link
Member Author

mojavelinux commented Jun 27, 2015 via email

@mojavelinux mojavelinux modified the milestones: v1.5.0.alpha.9, v1.5.0 Jul 21, 2015
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 31, 2015
… keys

- load base theme before loading primary theme
- remove unnecessary keys in default theme
- update information about base theme in theming guide
- minor code cleanups
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Aug 1, 2015
… keys

- load base theme before loading custom theme
- read base theme from flat layout, do not postprocess
- don't read base theme if using base theme
- don't use base theme before loading default theme
- remove unnecessary keys in default theme, reorg
- update information about base theme in theming guide
- fix image_align key in theming guide
- remove most defensive fallbacks when using theme keys
- minor code cleanups
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Aug 1, 2015
… keys

- load base theme before loading custom theme
- read base theme from flat layout, do not postprocess
- don't read base theme if using base theme
- don't use base theme before loading default theme
- remove unnecessary keys in default theme, reorg
- update information about base theme in theming guide
- fix image_align key in theming guide
- remove most defensive fallbacks when using theme keys
- minor code cleanups
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Aug 1, 2015
… keys

- load base theme before loading custom theme
- read base theme from flat layout, do not postprocess
- don't read base theme if using base theme
- don't use base theme before loading default theme
- remove unnecessary keys in default theme, reorg
- update information about base theme in theming guide
- fix image_align key in theming guide
- remove most defensive fallbacks when using theme keys
- minor code cleanups
mojavelinux added a commit that referenced this issue Aug 1, 2015
resolves #132 load a base theme with defaults for required keys
@mojavelinux mojavelinux removed the next label Oct 17, 2015
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