Skip to content

Multiline values for Patternslib data attributes.#211

Open
thet wants to merge 1 commit into
masterfrom
thet/patternslib-multiline
Open

Multiline values for Patternslib data attributes.#211
thet wants to merge 1 commit into
masterfrom
thet/patternslib-multiline

Conversation

@thet
Copy link
Copy Markdown
Member

@thet thet commented May 8, 2026

Split multiple Patternslib data attribute values into multiple lines. Keep it single-lined, if there is only one value.

@coveralls
Copy link
Copy Markdown

coveralls commented May 8, 2026

Coverage Status

Coverage is 96.878%thet/patternslib-multiline into master. No base build found for master.

@thet thet force-pushed the thet/patternslib-multiline branch 2 times, most recently from 256b794 to 1554c7b Compare May 8, 2026 21:45
Split multiple Patternslib data attribute values into multiple lines. Keep it
single-lined, if there is only one value.
@thet thet force-pushed the thet/patternslib-multiline branch from 1554c7b to 6713cd1 Compare May 8, 2026 21:51
@thet thet requested a review from ale-rt May 8, 2026 23:16
Copy link
Copy Markdown
Member

@ale-rt ale-rt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, but it needs some refinements.

I tested it on the ploneintranet code based and spotted this:

$ git --no-pager diff --staged  imagebank/browser/templates/app_image_bank_navigation.pt
diff --git a/src/ploneintranet/imagebank/browser/templates/app_image_bank_navigation.pt b/src/ploneintranet/imagebank/browser/templates/app_image_bank_navigation.pt
index 4d261a6a6..8d132ed3f 100644
--- a/src/ploneintranet/imagebank/browser/templates/app_image_bank_navigation.pt
+++ b/src/ploneintranet/imagebank/browser/templates/app_image_bank_navigation.pt
@@ -19,9 +19,12 @@
         <a class="pat-inject ${python: 'current' if tab.get('current') else ''}"
            href="${tab/url}"
            data-pat-inject="
-                        history: record; source: #directory-image-bank; target: #directory-image-bank &amp;&amp;
-                        source: #toolbar-functions-area-${view/app_name}::element; target: #toolbar-functions-area-${view/app_name}::element
-                     "
+             history: record;
+             source: #directory-image-bank;
+             target: #directory-image-bank &amp;&amp;
+                        source: #toolbar-functions-area-${view/app_name}::element;
+             target: #toolbar-functions-area-${view/app_name}::element
+           "
            tal:repeat="tab view/tabs"
         >${tab/title}</a>
       </nav>

As you can see there is too much indentation before the second source parameter.

Also I am wondering:

  1. if &amp;&amp; would deserve a line by its own (I am not really sure about this).
  2. how this will react to json encoded attributes (IIRC Patternslib supports that).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants