Skip to content

Commit

Permalink
add sdfdoodle template tag 🖊️ (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksund authored Aug 30, 2023
1 parent fedfb90 commit 690f37f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/simmate/website/core_components/templatetags/sdfdoodle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

from django import template

register = template.Library()


@register.filter
def sdfdoodle(obj):
"""
Converts an sdf string to one that can be passed to the doodle_molecule fxn
Example use:
``` html
{% load sdfdoodle %}
{{ my_object|sdfdoodle }}
```
"""
return obj.replace("\n", "\\n")

0 comments on commit 690f37f

Please sign in to comment.