templatetag

Use a remote stylesheet inside a template tag (with shadow dom)

为君一笑 提交于 2020-02-26 12:02:27
问题 I am trying to make a semi-resuseable widget but I am running into a problem. I am trying to encapsulate a some CSS code inside a shadow root so that it does not affect the rest of the webpage but this CSS is used across multiple widgets so I am trying to include a remote stylesheet. None of the examples I have found use a remote style sheet and I was wondering if this was possible. EX: <template id="templateContent"> <head> <link rel="stylesheet" href="css/generalStyle1.css"> </head> <body>

django template - parse variable inside string variable

放肆的年华 提交于 2020-01-13 11:43:31
问题 I'm pulling a dynamic content(from a database) to a template. You can think of this as some simple CMS system. The content string contains a template variable. Like this one (simplified case): vars['current_city'] = "London" vars['content'] = 'the current city is: {{current_city}}' #this string comes from db return render_template(request, 'about_me.html',vars) then in template: {{content}} output obviously: the current city is: {{current_city}} expected: the current city is: London My

Django - Teplatetag “readmore” wants to be “readless”

醉酒当歌 提交于 2020-01-06 04:35:28
问题 i have written a template tag some time ago which has the feature to collapse a textblock after 15 words. Now i want the exact opposite thing. i want that the user is able to get back to the original 15 words collapsed text after opening the collapsed textblock... i know sounds a bit wired. readmore.py from django import template from django.utils.html import escape from django.utils.safestring import mark_safe register = template.Library() import re readmore_showscript = ''.join([ "this

html template tag and jquery

爷,独闯天下 提交于 2019-12-10 12:43:58
问题 I've got this situation where I'm trying to use the <template> tag in my html source: <template id="some-id"> <div id="content-container"> <span>{{some_string}}</span> <div> </template> This ends up placing the template in the document but it is not considered to be in the DOM. This means that $("#content-container") is not found in browsers that support template tags. If I search for: $("#some-id") I get this back: <template id=​"some-id">​ #document-fragment <div id="content-container">

Polymer 1.0: Using template dom-repeat inside paper-menu elements to display iron-pages on selection

随声附和 提交于 2019-12-07 03:39:00
问题 Using Polymer 1.0, I have created a paper-drawer-panel layout. In the drawer I have a menu using paper-menu with paper-items which are bound to the iron-pages. I took this example from Content Switcheroo with Core-Pages -- Polycasts #09 and converted it to use the Polymer 1.0 elements. In the code below you can see my commented section in which the paper-items are hard-coded. This works fine. My next step was to try and build my menu dynamically by using the <template is="dom-repeat"> element

django template - parse variable inside string variable

China☆狼群 提交于 2019-12-05 17:20:26
I'm pulling a dynamic content(from a database) to a template. You can think of this as some simple CMS system. The content string contains a template variable. Like this one (simplified case): vars['current_city'] = "London" vars['content'] = 'the current city is: {{current_city}}' #this string comes from db return render_template(request, 'about_me.html',vars) then in template: {{content}} output obviously: the current city is: {{current_city}} expected: the current city is: London My question - is there any way to render a variable name inside another variable? Using custom template tag

Use a remote stylesheet inside a template tag (with shadow dom)

孤者浪人 提交于 2019-12-03 10:42:13
I am trying to make a semi-resuseable widget but I am running into a problem. I am trying to encapsulate a some CSS code inside a shadow root so that it does not affect the rest of the webpage but this CSS is used across multiple widgets so I am trying to include a remote stylesheet. None of the examples I have found use a remote style sheet and I was wondering if this was possible. EX: <template id="templateContent"> <head> <link rel="stylesheet" href="css/generalStyle1.css"> </head> <body> <div class="affectedByGeneralStyle1"></div> </body> </template> script to include template: <div id=