<s> import django <EOL> from django import template <EOL> from django . template import defaultfilters <EOL> from django . utils import safestring <EOL> if django . VERSION >= ( <NUM_LIT:1> , <NUM_LIT:9> ) : <EOL> register = template . Library ( ) <EOL> else : <EOL> register = template . base . Library ( ) <EOL> @ register . filter ( is_safe = True ) <EOL> @ defaultfilters . stringfilter <EOL> def shellfilter ( value ) : <EOL> """<STR_LIT>""" <EOL> replacements = { '<STR_LIT:\\>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> "<STR_LIT:'>" : "<STR_LIT>" , <EOL> '<STR_LIT:">' : '<STR_LIT>' } <EOL> for search , repl in replacements . items ( ) : <EOL> value = value . replace ( search , repl ) <EOL> return safestring . mark_safe ( value ) </s>
