{"action":"created","issue":{"url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/issues/72","labels_url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/issues/72/comments","events_url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/issues/72/events","html_url":"https://github.com/ultraq/thymeleaf-layout-dialect/issues/72","id":70636523,"number":72,"title":"Allow <title> elements to get processed, before using in decoration","user":{"login":"ultraq","id":1686920,"avatar_url":"https://avatars.githubusercontent.com/u/1686920?v=3","gravatar_id":"","url":"https://api.github.com/users/ultraq","html_url":"https://github.com/ultraq","followers_url":"https://api.github.com/users/ultraq/followers","following_url":"https://api.github.com/users/ultraq/following{/other_user}","gists_url":"https://api.github.com/users/ultraq/gists{/gist_id}","starred_url":"https://api.github.com/users/ultraq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ultraq/subscriptions","organizations_url":"https://api.github.com/users/ultraq/orgs","repos_url":"https://api.github.com/users/ultraq/repos","events_url":"https://api.github.com/users/ultraq/events{/privacy}","received_events_url":"https://api.github.com/users/ultraq/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"ultraq","id":1686920,"avatar_url":"https://avatars.githubusercontent.com/u/1686920?v=3","gravatar_id":"","url":"https://api.github.com/users/ultraq","html_url":"https://github.com/ultraq","followers_url":"https://api.github.com/users/ultraq/followers","following_url":"https://api.github.com/users/ultraq/following{/other_user}","gists_url":"https://api.github.com/users/ultraq/gists{/gist_id}","starred_url":"https://api.github.com/users/ultraq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ultraq/subscriptions","organizations_url":"https://api.github.com/users/ultraq/orgs","repos_url":"https://api.github.com/users/ultraq/repos","events_url":"https://api.github.com/users/ultraq/events{/privacy}","received_events_url":"https://api.github.com/users/ultraq/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/milestones/7","html_url":"https://github.com/ultraq/thymeleaf-layout-dialect/milestones/Thymeleaf%20Layout%20Dialect%201.3","labels_url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/milestones/7/labels","id":1083630,"number":7,"title":"Thymeleaf Layout Dialect 1.3","description":"A rewrite in Groovy, and the tackling of the some of the harder bugs that I have some solutions to using Groovy over Java.  This should be the last minor version for Thymeleaf 2.1","creator":{"login":"ultraq","id":1686920,"avatar_url":"https://avatars.githubusercontent.com/u/1686920?v=3","gravatar_id":"","url":"https://api.github.com/users/ultraq","html_url":"https://github.com/ultraq","followers_url":"https://api.github.com/users/ultraq/followers","following_url":"https://api.github.com/users/ultraq/following{/other_user}","gists_url":"https://api.github.com/users/ultraq/gists{/gist_id}","starred_url":"https://api.github.com/users/ultraq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ultraq/subscriptions","organizations_url":"https://api.github.com/users/ultraq/orgs","repos_url":"https://api.github.com/users/ultraq/repos","events_url":"https://api.github.com/users/ultraq/events{/privacy}","received_events_url":"https://api.github.com/users/ultraq/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":6,"state":"open","created_at":"2015-04-25T22:29:56Z","updated_at":"2015-06-28T09:17:46Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-04-24T09:21:13Z","updated_at":"2015-07-01T22:27:12Z","closed_at":"2015-04-29T10:39:48Z","body":"The `title-pattern` processor relies on a lot of special-casing code paths in the `HtmlHeadDecorator` to work, namely the copying of the state of the `<title>` elements in both content and layout templates, before creating a new `<title>` that approximates the intent of the developer.  However, this special casing is starting to fall apart (see #64 and #66), and the code that developers put inside those elements should fulfil all the processors that are put in there.\r\n\r\nSo a better solution I think would be to allow Thymeleaf to process each of the title elements, before being put together for the final `title-pattern` processor.  To do this:\r\n - copy each of the `title` elements to the resulting HTML, extracting the `title-pattern` directive\r\n - create a new `title` element with the `title-pattern` directive, _after_ the copies\r\n - let Thymeleaf run over the first 2 `title`s\r\n - when reaching the third, extract the values from processing the first 2 and run them through the title pattern\r\n - delete the `title` copies\r\n\r\nThis way, each `title` gets everything done to it without special code paths.\r\n\r\nThere might be some difficulty with deep layout hierarchies, so some solution for how that works should be decided, and appropriate tests (if they don't already exist for these cases - I think they do...?) should be made.\r\n"},"comment":{"url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/issues/comments/117841226","html_url":"https://github.com/ultraq/thymeleaf-layout-dialect/issues/72#issuecomment-117841226","issue_url":"https://api.github.com/repos/ultraq/thymeleaf-layout-dialect/issues/72","id":117841226,"user":{"login":"chrylis","id":2394512,"avatar_url":"https://avatars.githubusercontent.com/u/2394512?v=3","gravatar_id":"","url":"https://api.github.com/users/chrylis","html_url":"https://github.com/chrylis","followers_url":"https://api.github.com/users/chrylis/followers","following_url":"https://api.github.com/users/chrylis/following{/other_user}","gists_url":"https://api.github.com/users/chrylis/gists{/gist_id}","starred_url":"https://api.github.com/users/chrylis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrylis/subscriptions","organizations_url":"https://api.github.com/users/chrylis/orgs","repos_url":"https://api.github.com/users/chrylis/repos","events_url":"https://api.github.com/users/chrylis/events{/privacy}","received_events_url":"https://api.github.com/users/chrylis/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T22:27:12Z","updated_at":"2015-07-01T22:27:12Z","body":"This is not working for me in 1.3.0-SNAPSHOT. Steps to reproduce:\r\n\r\nDeclare \"target\" view:\r\n\r\n```\r\n<!DOCTYPE html>\r\n<html data-layout-decorator=\"layout/dashboard-layout\">\r\n<head>\r\n    <title data-th-text=\"foo\">bar</title>\r\n</head>\r\n\r\n<body>\r\n    <div data-layout-fragment=\"page-content\">\r\n        <p>Stuff goes here.</p>\r\n    </div>\r\n</body>\r\n</html>\r\n```\r\n\r\nUse the title selector in the layout:\r\n\r\n```\r\n<!DOCTYPE html>\r\n<html>\r\n<head>\r\n    <title data-layout-title-pattern=\"$CONTENT_TITLE | $DECORATOR_TITLE\">My Site</title>\r\n</head>\r\n\r\n<body>\r\n    <div id=\"view-title-text\">\r\n        <h2><span data-layout-include=\"::title\"/></h2>\r\n    </div>\r\n\r\n    <div id=\"dashboard-content-pane\" data-layout-fragment=\"page-content\" />\r\n</body>\r\n</html>\r\n```\r\n\r\nExpected behavior: page title is \"foo | My Site\" and the header element is \"foo\".\r\n\r\nActual behavior with 1.3.0-SNAPSHOT: page title is \"foo | My Site\" and the header element is \"bar\".\r\n\r\nThis behavior is consistent whether I use `data-th-text` or `data-th-inline=\"text\"` with inline replacement placeholders."}}