From 949d409a24b1d497ad10d17fd29f252646c2685f Mon Sep 17 00:00:00 2001 From: psy <psy@cccv.de> Date: Sat, 31 May 2025 17:20:11 +0200 Subject: [PATCH] add custom template options --- README.md | 24 ++++++++++++++++++++++++ defaults/main.yml | 1 + tasks/main.yml | 23 +++++++++++++++++++++++ templates/style.ini.j2 | 9 +++++++++ 4 files changed, 57 insertions(+) create mode 100644 templates/style.ini.j2 diff --git a/README.md b/README.md index a5ab63d..d004e26 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,27 @@ add pages that should be precreated by adding the following to your inventory wi ``` pages will be created inside the `/var/www/dokuwiki/data/pages/` folder. the template needs to be copied to the host beforehand, for example by using the `files` role. one level of directories deep is created by the role, nested directories can't be created. + + +## template style settings +change some default template settings +``` +template_style: + text = "#333333" + background = "#ffffff" + text_alt = "#999999" + background_alt = "#eeeeee" + text_neu = "#666666" + background_neu = "#dddddd" + border = "#cccccc" + highlight = "#ffff99" + link = "#2b73b7" + background_site = "#fbfaf9" + existing = "#008800" + missing = "#dd3300" + site_width = "75%" + sidebar_width = "16em" + tablet_width = "800px" + phone_width = "480px" + theme_color = "#008800" +``` diff --git a/defaults/main.yml b/defaults/main.yml index d037d7a..e4e68eb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -25,3 +25,4 @@ dokuwiki: plugins: [] precreate_pages: [] timezone: UTC + template_style: ~ diff --git a/tasks/main.yml b/tasks/main.yml index 1b3be42..8ac1e3c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,3 +44,26 @@ - name: create precreated pages if they do not exist include_tasks: precreate_pages.yml loop: "{{ dokuwiki.precreate_pages | dict2items }}" + +- name: set custom theme options + when: dokuwiki.template_style + block: + - name: create folder for custom theme options + file: + path: /usr/share/dokuwiki/conf/tpl/dokuwiki/ + state: directory + mode: 0644 + + - name: set theme options + template: + src: style.ini.j2 + dest: /usr/share/dokuwiki/conf/tpl/dokuwiki/style.ini + owner: root + group: www-data + mode: 0644 + +- name: delete custom theme options + when: not dokuwiki.template_style + file: + path: /usr/share/dokuwiki/conf/tpl/dokuwiki/style.ini + state: absent diff --git a/templates/style.ini.j2 b/templates/style.ini.j2 new file mode 100644 index 0000000..779b09c --- /dev/null +++ b/templates/style.ini.j2 @@ -0,0 +1,9 @@ +[stylesheets] +extra.css = all + +[replacements] +;These overwrites have been generated from the Template styling Admin interface +;Any values in this section will be overwritten by that tool again +{% for k,v in dokuwiki.template_style.items() %} +__{{ k }}__ = "{{ v }}" +{% endfor -%} \ No newline at end of file -- GitLab