try:
  import javascript
  import html
except:
  from . import javascript
  from . import html

def expand(string, start, end, extension=None):

  if(extension in ["html", "htm", "xml"]):
    return html.expand(string, start, end)

  return javascript.expand(string, start, end)
import re

try:
  import javascript
  import html
except:
  from . import javascript
  from . import html

def expand(string, start, end, extension=None):

  if(re.compile("html|htm|xml").search(extension)):
    return html.expand(string, start, end)

  return javascript.expand(string, start, end)
Use html strategy for any file that has xml/html in file extension. This will will match shtml, xhtml and so on.
Use html strategy for any file that has xml/html in file extension. This will will match shtml, xhtml and so on.

+ import re
+ 
  try:
    import javascript
    import html
  except:
    from . import javascript
    from . import html
  
  def expand(string, start, end, extension=None):
  
-   if(extension in ["html", "htm", "xml"]):
+   if(re.compile("html|htm|xml").search(extension)):
      return html.expand(string, start, end)
  
    return javascript.expand(string, start, end)
Use html strategy for any file that has xml/html in file extension. This will will match shtml, xhtml and so on.
## Code Before:
try:
  import javascript
  import html
except:
  from . import javascript
  from . import html

def expand(string, start, end, extension=None):

  if(extension in ["html", "htm", "xml"]):
    return html.expand(string, start, end)

  return javascript.expand(string, start, end)
## Instruction:
Use html strategy for any file that has xml/html in file extension. This will will match shtml, xhtml and so on.
## Code After:
import re

try:
  import javascript
  import html
except:
  from . import javascript
  from . import html

def expand(string, start, end, extension=None):

  if(re.compile("html|htm|xml").search(extension)):
    return html.expand(string, start, end)

  return javascript.expand(string, start, end)