*generate a MMD citation*

        **Key Arguments:**
            - ``title`` -- the citation title
            - ``author`` -- the author. Default *False*
            - ``year`` -- year published. Default *False*
            - ``url`` -- url to the media. Default *False*
            - ``publisher`` -- the publisher of the media. Default *False*
            - ``mediaKind`` -- what kind of media is it?. Default *False*
            - ``linkedText`` -- the text to link to the citation. Default *False/blank*
            - ``nocite`` -- a give citation that has no reference in main doc

        **Return:**
            - ``citation`` -- the MMD citation

        **Usage:**

            To generate a MMD citation:

            .. code-block:: python

                citation = md.cite(
                    title="A very good book",
                    author="John Doe",
                    year=2015,
                    url="http://www.thespacedoctor.co.uk",
                    publisher="Beefy Books",
                    mediaKind=False,
                    linkedText="Doe 2015")
                print citation

                # OUTPUT:  [Doe 2015][#averygoodbook90]
                #
                # [#averygoodbook90]: John Doe. *[A Very Good Book](http://www.thespacedoctor.co.uk)*. Beefy Books, 2015.

def cite(
            self,
            title,
            author=False,
            year=False,
            url=False,
            publisher=False,
            mediaKind=False,
            linkedText=False,
            nocite=False):
        """*generate a MMD citation*

        **Key Arguments:**
            - ``title`` -- the citation title
            - ``author`` -- the author. Default *False*
            - ``year`` -- year published. Default *False*
            - ``url`` -- url to the media. Default *False*
            - ``publisher`` -- the publisher of the media. Default *False*
            - ``mediaKind`` -- what kind of media is it?. Default *False*
            - ``linkedText`` -- the text to link to the citation. Default *False/blank*
            - ``nocite`` -- a give citation that has no reference in main doc

        **Return:**
            - ``citation`` -- the MMD citation

        **Usage:**

            To generate a MMD citation:

            .. code-block:: python

                citation = md.cite(
                    title="A very good book",
                    author="John Doe",
                    year=2015,
                    url="http://www.thespacedoctor.co.uk",
                    publisher="Beefy Books",
                    mediaKind=False,
                    linkedText="Doe 2015")
                print citation

                # OUTPUT:  [Doe 2015][#averygoodbook90]
                #
                # [#averygoodbook90]: John Doe. *[A Very Good Book](http://www.thespacedoctor.co.uk)*. Beefy Books, 2015. 
        """

        rand = str(randint(0, 100))
        anchor = title.replace(" ", "").lower()
        title = title.title()

        citation = ""
        if author:
            author = author.title() + ". "
        else:
            author = ""

        if title[-1] == ".":
            title = title[:-1]

        if url:
            title = "*[%(title)s](%(url)s)*. " % locals()
        else:
            title = "*%(title)s*." % locals()

        if publisher and year:
            publisher = "%(publisher)s, %(year)s. " % locals()
        elif publisher:
            publisher = "%(publisher)s. " % locals()
        elif year:
            publisher = "%(year)s. " % locals()
        else:
            publisher = ""

        if mediaKind:
            mediaKind = "(%(mediaKind)s) " % locals()
            mediaKind = mediaKind.lower()
        else:
            mediaKind = ""

        if not linkedText:
            linkedText = ""

        if nocite:
            linkedText = "Not Cited"

        return "[%(linkedText)s][#%(anchor)s%(rand)s]\n\n[#%(anchor)s%(rand)s]: %(author)s%(title)s%(publisher)s%(mediaKind)s" % locals()