{"action":"created","issue":{"url":"https://api.github.com/repos/dbohdan/tclssg/issues/39","labels_url":"https://api.github.com/repos/dbohdan/tclssg/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/dbohdan/tclssg/issues/39/comments","events_url":"https://api.github.com/repos/dbohdan/tclssg/issues/39/events","html_url":"https://github.com/dbohdan/tclssg/issues/39","id":55101734,"number":39,"title":"Example submission: Mixing templating and markdown.","user":{"login":"andreas-kupries","id":577247,"avatar_url":"https://avatars.githubusercontent.com/u/577247?v=3","gravatar_id":"","url":"https://api.github.com/users/andreas-kupries","html_url":"https://github.com/andreas-kupries","followers_url":"https://api.github.com/users/andreas-kupries/followers","following_url":"https://api.github.com/users/andreas-kupries/following{/other_user}","gists_url":"https://api.github.com/users/andreas-kupries/gists{/gist_id}","starred_url":"https://api.github.com/users/andreas-kupries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreas-kupries/subscriptions","organizations_url":"https://api.github.com/users/andreas-kupries/orgs","repos_url":"https://api.github.com/users/andreas-kupries/repos","events_url":"https://api.github.com/users/andreas-kupries/events{/privacy}","received_events_url":"https://api.github.com/users/andreas-kupries/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-22T01:14:57Z","updated_at":"2015-01-22T14:15:04Z","closed_at":null,"body":"Tested a bit how markdown and templating mix, and also access to page variables from templating.\r\nFirst a small input/templates/shortcuts.tcl file\r\n\r\n```\r\n    proc var {name} {\r\n        global currentPageId\r\n        return [get-page-variable $currentPageId $name \"(**Not Found**: $name)\"]\r\n    }\r\n    proc root {} {\r\n        global currentPageId\r\n        return [get-page-data $currentPageId rootDirPath]\r\n    }\r\n```\r\n\r\nI made that after figuring out that I was able to access page variables after <%interp-source common.tcl%> into the page. I simply wanted shorter command names, and had no need for a default. Something like ```<%$ foo %>``` might be even nicer, especially if the spaces can be omitted, i.e. ```<%$foo%>```\r\n\r\nThe test page was\r\n\r\n```\r\n    {\r\n    \ttitle {Testing stuff}\r\n    \thideSidebarNote 1\r\n    \tsite:foo local-foo\r\n    \tsite:core:link  http://core.tcl.tk\r\n    \tsite:core:label {Tcl/Tk}\r\n    \tsite:tcllib     {[Tcllib](http://core.tcl.tk/tcllib)}\r\n    }\r\n    <% interp-source shortcuts.tcl %>\r\n    \r\n    Local Variable  = <%!var site:foo%>\r\n    \r\n    Global Variable = <%!var site:fog%>\r\n    \r\n    Missing Variable = <%! var unknown %>\r\n    \r\n    Root = <%! root %>\r\n    \r\n    Link to [<%! var site:core:label %>](<%! var site:core:link %>)\r\n    \r\n    Link to <%!var site:tcllib%>\r\n```\r\n\r\nWith that it became clear that markdown formatting in the page variables is properly processed when generating the final page.\r\n\r\nI deduce that per-page templating is applied first, and then the result is run through the markdown processor (with possibly some other steps between).\r\n\r\nI used the \"site:\" prefix for all my variables to keep out of tclssg's way. \r\nI hope that you are willing to bless this or some other prefix as reserved for users, with tclssg never using that namespace.\r\n\r\nThis now allows me to centralize the information about the links I use in my site, and if any break I edit only this config to fix things up. Also a nice place to store smaller common text blocks. Maybe even extendable into something which can read common text-blocks from other files (neither processed themselves directly, nor copied to the site).\r\n"},"comment":{"url":"https://api.github.com/repos/dbohdan/tclssg/issues/comments/71025694","html_url":"https://github.com/dbohdan/tclssg/issues/39#issuecomment-71025694","issue_url":"https://api.github.com/repos/dbohdan/tclssg/issues/39","id":71025694,"user":{"login":"dbohdan","id":3179832,"avatar_url":"https://avatars.githubusercontent.com/u/3179832?v=3","gravatar_id":"","url":"https://api.github.com/users/dbohdan","html_url":"https://github.com/dbohdan","followers_url":"https://api.github.com/users/dbohdan/followers","following_url":"https://api.github.com/users/dbohdan/following{/other_user}","gists_url":"https://api.github.com/users/dbohdan/gists{/gist_id}","starred_url":"https://api.github.com/users/dbohdan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbohdan/subscriptions","organizations_url":"https://api.github.com/users/dbohdan/orgs","repos_url":"https://api.github.com/users/dbohdan/repos","events_url":"https://api.github.com/users/dbohdan/events{/privacy}","received_events_url":"https://api.github.com/users/dbohdan/received_events","type":"User","site_admin":false},"created_at":"2015-01-22T14:15:04Z","updated_at":"2015-01-22T14:15:04Z","body":"Pull request to comment on: https://github.com/dbohdan/tclssg/pull/41."}}