# Path: scribbler/errors.py
# class ScribblerError(Exception):
#     pass


import os
import pdfkit
from .errors import ScribblerError
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#  
#

"""
Contains class representing notes and appendices.
"""




class ScribblerContent(object):
    """
    Class representing Note and Appendix objects. Must pass the name of
    the note/appendix, the date it is for, the path to its source file,
    relative to notebook's notes directory, and the notebook object which
    contains it.
    """
    def __init__(self, name, date, src_path, notebook):
        self.notebook = notebook
        self.name = name
        self.date = date
        basename = os.path.basename(src_path)
        for ext in ['md', 'rst', 'html']:
            if basename.endswith(ext):
                self.markup = ext
                self.slug = basename[:len(basename)-len(ext)-1]
                break
        else:

# Path: scribbler/errors.py
# class ScribblerError(Exception):
#     pass


# Path: scribbler/content.py
import os
import pdfkit
from .errors import ScribblerError

#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#  
#

"""
Contains class representing notes and appendices.
"""




class ScribblerContent(object):
    """
    Class representing Note and Appendix objects. Must pass the name of
    the note/appendix, the date it is for, the path to its source file,
    relative to notebook's notes directory, and the notebook object which
    contains it.
    """
    def __init__(self, name, date, src_path, notebook):
        self.notebook = notebook
        self.name = name
        self.date = date
        basename = os.path.basename(src_path)
        for ext in ['md', 'rst', 'html']:
            if basename.endswith(ext):
                self.markup = ext
                self.slug = basename[:len(basename)-len(ext)-1]
                break
        else:

            raise ScribblerError("Unrecognized extension for file '{}'".format(basename))