__author__ = 'Chris Krycho'
__copyright__ = '2013 Chris Krycho'

from logging import error
from os import path, walk
from sys import exit

try:
    from markdown import Markdown
    from mixins import DictAsMember

except ImportError as import_error:
    error(import_error)
    exit()


def convert_source(config):
    '''
    Convert all Markdown pages to HTML and metadata pairs. Pairs are keyed to
    file names slugs (without the original file extension).
    '''

    md = Markdown(extensions=config.markdown_extensions, output_format='html5')
    converted = {}
    for root, dirs, file_names in walk(config.site.content.source):
        for file_name in file_names:
            file_path = path.join(root, file_name)
            plain_slug, extension = path.splitext(file_name)

            with open(file_path) as file:
                md_text = file.read()
                content = md.convert(md_text)
                converted[plain_slug] = {'content': content, 'meta': md.Meta}

    return DictAsMember(converted)

__author__ = 'Chris Krycho'
__copyright__ = '2013 Chris Krycho'

from logging import error
from os import path, walk
from sys import exit

try:
    from markdown import Markdown
    from mixins import DictAsMember

except ImportError as import_error:
    error(import_error)
    exit()


def convert_source(config):
    '''
    Convert all Markdown pages to HTML and metadata pairs. Pairs are keyed to
    file names slugs (without the original file extension).
    '''

    md = Markdown(extensions=config.markdown_extensions, output_format='html5')
    converted = {}
    for root, dirs, file_names in walk(config.site.content.source):
        for file_name in file_names:
            file_path = path.join(root, file_name)
            plain_slug, extension = path.splitext(file_name)

            with open(file_path) as file:
                md_text = file.read()
                content = md.convert(md_text)
                converted[plain_slug] = {'content': content, 'meta': md.Meta}
                md.reset()

    return DictAsMember(converted)

Call the reset() method in the Markdown object to clear extensions (e.g. metadata) between processing each file.
Call the reset() method in the Markdown object to clear extensions (e.g. metadata) between processing each file.

  __author__ = 'Chris Krycho'
  __copyright__ = '2013 Chris Krycho'
  
  from logging import error
  from os import path, walk
  from sys import exit
  
  try:
      from markdown import Markdown
      from mixins import DictAsMember
  
  except ImportError as import_error:
      error(import_error)
      exit()
  
  
  def convert_source(config):
      '''
      Convert all Markdown pages to HTML and metadata pairs. Pairs are keyed to
      file names slugs (without the original file extension).
      '''
  
      md = Markdown(extensions=config.markdown_extensions, output_format='html5')
      converted = {}
      for root, dirs, file_names in walk(config.site.content.source):
          for file_name in file_names:
              file_path = path.join(root, file_name)
              plain_slug, extension = path.splitext(file_name)
  
              with open(file_path) as file:
                  md_text = file.read()
                  content = md.convert(md_text)
                  converted[plain_slug] = {'content': content, 'meta': md.Meta}
+                 md.reset()
  
      return DictAsMember(converted)
  
Call the reset() method in the Markdown object to clear extensions (e.g. metadata) between processing each file.
## Code Before:
__author__ = 'Chris Krycho'
__copyright__ = '2013 Chris Krycho'

from logging import error
from os import path, walk
from sys import exit

try:
    from markdown import Markdown
    from mixins import DictAsMember

except ImportError as import_error:
    error(import_error)
    exit()


def convert_source(config):
    '''
    Convert all Markdown pages to HTML and metadata pairs. Pairs are keyed to
    file names slugs (without the original file extension).
    '''

    md = Markdown(extensions=config.markdown_extensions, output_format='html5')
    converted = {}
    for root, dirs, file_names in walk(config.site.content.source):
        for file_name in file_names:
            file_path = path.join(root, file_name)
            plain_slug, extension = path.splitext(file_name)

            with open(file_path) as file:
                md_text = file.read()
                content = md.convert(md_text)
                converted[plain_slug] = {'content': content, 'meta': md.Meta}

    return DictAsMember(converted)

## Instruction:
Call the reset() method in the Markdown object to clear extensions (e.g. metadata) between processing each file.
## Code After:
__author__ = 'Chris Krycho'
__copyright__ = '2013 Chris Krycho'

from logging import error
from os import path, walk
from sys import exit

try:
    from markdown import Markdown
    from mixins import DictAsMember

except ImportError as import_error:
    error(import_error)
    exit()


def convert_source(config):
    '''
    Convert all Markdown pages to HTML and metadata pairs. Pairs are keyed to
    file names slugs (without the original file extension).
    '''

    md = Markdown(extensions=config.markdown_extensions, output_format='html5')
    converted = {}
    for root, dirs, file_names in walk(config.site.content.source):
        for file_name in file_names:
            file_path = path.join(root, file_name)
            plain_slug, extension = path.splitext(file_name)

            with open(file_path) as file:
                md_text = file.read()
                content = md.convert(md_text)
                converted[plain_slug] = {'content': content, 'meta': md.Meta}
                md.reset()

    return DictAsMember(converted)
