openSUSE / daps

DocBook Authoring and Publishing Suite (DAPS)
https://openSUSE.github.io/daps
Other
62 stars 19 forks source link

Allow creating simple customizations without touching XSLT code #308

Open ghost opened 8 years ago

ghost commented 8 years ago

It would be nice to have some way to easily replace colors, images, logos, and maybe fonts that appear in documents. This would be akin to Publican's "brands".

Alternatively, if this is already possible, we should probably document, how.

tomschr commented 8 years ago

I guess, the best way is to have stylesheets which allow easier customizations through parameters. This would usually be the preferred way. I'm not sure if there is an "easier" solution like the above.

From a technical point of view, this is stable and already documented.

That question is, what is considered to be "easy"? Setting parameters is probably very easy, writing customization layers probably not.

However, there will always be something that can't be tackled with parameters. You can't avoid customizations if you need something that is out of scope.

Maybe we should solve that from two side: create stylesheets that are easier to customize (or extend the existing ones) plus improve our (non-existing) DAPS Developer Guide.

fsundermeyer commented 8 years ago

I suggest a completely different approach:

  1. Having an XSL template with placeholders for all customizable "stuff"
    • placeholder could be something like §§§<DESCRIPTOR>§§§, e.g. §§§TP_BG_IMAGE§§§ or §§§TP_HEADLINE_FONT§§§
  2. Having simple config files (key=value) listing, grouping and commenting all the config options (). A general config file and specific ones for each output format would be needed.
  3. Having a script that generates ready to use stylesheets from the skeleton and the templates. Could be done in bash, but maybe Python already has a library for such kind of problems.
  4. This approach would also make branding for the SUSE/DAPS manuals easier - the skeleton, script(s) and default config would ship as "daps-stylesheets" and the DAPS/SUSE/openSUSE-specific config files would ship as "daps-stylesheets-<NAME>-branding"

A config file could look like this:

##############################
# TITLEPAGE                  #
##############################

# background image og title page
# Default value: /usr/share/xml/stylesheets/docbook/foo/static/images/logo.png
#
TP_BG_IMAGE="/usr/share/xml/stylesheets/docbook/foo/static/images/logo.png"

# Title page headline font
# Default value: sans whatever
#
TP_HEADLINE_FONT="sans whatever"

##############################
# CHAPTER                    #
##############################
...