我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用django.utils.html.strip_spaces_between_tags()。
def render(self, context): from django.utils.html import strip_spaces_between_tags return strip_spaces_between_tags(self.nodelist.render(context).strip())
def _strip_spaces(self, caller=None): from django.utils.html import strip_spaces_between_tags return strip_spaces_between_tags(caller().strip()) # nicer import names
def _spaceless(self, caller): from django.utils.html import strip_spaces_between_tags return strip_spaces_between_tags(caller().strip())
def render(self, context): if settings.WGER_SETTINGS['REMOVE_WHITESPACE']: from django.utils.html import strip_spaces_between_tags return strip_spaces_between_tags(self.nodelist.render(context).strip()) else: return self.nodelist.render(context)
def _render_row(self, key, value, field_name, key_attrs, val_attrs): """ Renders to HTML a single key/value pair row. :param key: (str) key :param value: (str) value :param field_name: (str) String name of this field :param key_attrs: (dict) HTML attributes to be applied to the key input :param val_attrs: (dict) HTML attributes to be applied to the value input """ template = """ <div class="form-row attributes-pair"> <div class="field-box"> <input type="text" class="attributes-key" name="attributes_key[{field_name}]" value="{key}" {key_attrs}> </div> <div class="field-box"> <input type="text" class="attributes-value" name="attributes_value[{field_name}]" value="{value}" {val_attrs}> <a class="delete-attributes-pair deletelink" href="#" title="{remove}"></a> </div> </div> """.format( key=escape(key), value=escape(value), field_name=field_name, key_attrs=key_attrs, val_attrs=val_attrs, remove=_('Remove'), ) return strip_spaces_between_tags(template.strip())