def __init__(self, source, **kwargs):
        """ Configures this generator. Available ``args`` are:
            - ``source``: source file or directory path
            Available ``kwargs`` are:
            - ``copy_theme``: copy theme directory and files into presentation
                              one
            - ``destination_file``: path to html or PDF destination file
            - ``direct``: enables direct rendering presentation to stdout
            - ``debug``: enables debug mode
            - ``embed``: generates a standalone document, with embedded assets
            - ``encoding``: the encoding to use for this presentation
            - ``extensions``: Comma separated list of markdown extensions
            - ``logger``: a logger lambda to use for logging
            - ``presenter_notes``: enable presenter notes
            - ``relative``: enable relative asset urls
            - ``theme``: path to the theme to use for this presentation
            - ``verbose``: enables verbose output
        """
        self.copy_theme = kwargs.get('copy_theme', False)
        self.debug = kwargs.get('debug', False)
        self.destination_file = kwargs.get('destination_file',
                                           'presentation.html')
        self.direct = kwargs.get('direct', False)
        self.embed = kwargs.get('embed', False)
        self.encoding = kwargs.get('encoding', 'utf8')
        self.extensions = kwargs.get('extensions', None)
        self.logger = kwargs.get('logger', None)
        self.presenter_notes = kwargs.get('presenter_notes', True)
        self.relative = kwargs.get('relative', False)
        self.theme = kwargs.get('theme', 'default')
        self.verbose = kwargs.get('verbose', False)
        self.linenos = self.linenos_check(kwargs.get('linenos'))
        self.watch = kwargs.get('watch', False)
        self.math_output = kwargs.get('math_output', False)
        self.num_slides = 0
        self.__toc = []

        # macros registering
        self.macros = []
        self.register_macro(*self.default_macros)

        if self.direct:
            # Only output html in direct output mode, not log messages
            self.verbose = False

        if not source or not os.path.exists(source):
            raise IOError(u"Source file/directory %s does not exist"
                          % source)

        if source.endswith('.cfg'):
            config = self.parse_config(source)
            self.source = config.get('source')
            if not self.source:
                raise IOError('unable to fetch a valid source from config')
            source_abspath = os.path.abspath(self.source[0])
            self.destination_file = config.get('destination',
                self.DEFAULT_DESTINATION)
            self.embed = config.get('embed', False)
            self.relative = config.get('relative', False)
            self.copy_theme = config.get('copy_theme', False)
            self.extensions = config.get('extensions', '')
            self.theme = config.get('theme', 'default')
            self.add_user_css(config.get('css', []))
            self.add_user_js(config.get('js', []))
            self.linenos = self.linenos_check(config.get('linenos'))
        else:
            self.source = source
            source_abspath = os.path.abspath(source)

        if not os.path.isdir(source_abspath):
            source_abspath = os.path.dirname(source_abspath)

        self.watch_dir = source_abspath

        if (os.path.exists(self.destination_file)
            and not os.path.isfile(self.destination_file)):
            raise IOError(u"Destination %s exists and is not a file"
                          % self.destination_file)

        if self.destination_file.endswith('.html'):
            self.file_type = 'html'
        elif self.destination_file.endswith('.pdf'):
            self.file_type = 'pdf'
            self.embed = True
        else:
            raise IOError(u"This program can only write html or pdf files. "
                           "Please use one of these file extensions in the "
                           "destination")

        self.theme_dir = self.find_theme_dir(self.theme, self.copy_theme)
        self.template_file = self.get_template_file()
def __init__ ( self , source , ** kwargs ) : self . copy_theme = kwargs . get ( 'copy_theme' , False ) self . debug = kwargs . get ( 'debug' , False ) self . destination_file = kwargs . get ( 'destination_file' , 'presentation.html' ) self . direct = kwargs . get ( 'direct' , False ) self . embed = kwargs . get ( 'embed' , False ) self . encoding = kwargs . get ( 'encoding' , 'utf8' ) self . extensions = kwargs . get ( 'extensions' , None ) self . logger = kwargs . get ( 'logger' , None ) self . presenter_notes = kwargs . get ( 'presenter_notes' , True ) self . relative = kwargs . get ( 'relative' , False ) self . theme = kwargs . get ( 'theme' , 'default' ) self . verbose = kwargs . get ( 'verbose' , False ) self . linenos = self . linenos_check ( kwargs . get ( 'linenos' ) ) self . watch = kwargs . get ( 'watch' , False ) self . math_output = kwargs . get ( 'math_output' , False ) self . num_slides = 0 self . __toc = [ ] self . macros = [ ] self . register_macro ( * self . default_macros ) if self . direct : self . verbose = False if not source or not os . path . exists ( source ) : raise IOError ( u"Source file/directory %s does not exist" % source ) if source . endswith ( '.cfg' ) : config = self . parse_config ( source ) self . source = config . get ( 'source' ) if not self . source : raise IOError ( 'unable to fetch a valid source from config' ) source_abspath = os . path . abspath ( self . source [ 0 ] ) self . destination_file = config . get ( 'destination' , self . DEFAULT_DESTINATION ) self . embed = config . get ( 'embed' , False ) self . relative = config . get ( 'relative' , False ) self . copy_theme = config . get ( 'copy_theme' , False ) self . extensions = config . get ( 'extensions' , '' ) self . theme = config . get ( 'theme' , 'default' ) self . add_user_css ( config . get ( 'css' , [ ] ) ) self . add_user_js ( config . get ( 'js' , [ ] ) ) self . linenos = self . linenos_check ( config . get ( 'linenos' ) ) else : self . source = source source_abspath = os . path . abspath ( source ) if not os . path . isdir ( source_abspath ) : source_abspath = os . path . dirname ( source_abspath ) self . watch_dir = source_abspath if ( os . path . exists ( self . destination_file ) and not os . path . isfile ( self . destination_file ) ) : raise IOError ( u"Destination %s exists and is not a file" % self . destination_file ) if self . destination_file . endswith ( '.html' ) : self . file_type = 'html' elif self . destination_file . endswith ( '.pdf' ) : self . file_type = 'pdf' self . embed = True else : raise IOError ( u"This program can only write html or pdf files. " "Please use one of these file extensions in the " "destination" ) self . theme_dir = self . find_theme_dir ( self . theme , self . copy_theme ) self . template_file = self . get_template_file ( )
Configures this generator. Available ``args`` are:
            - ``source``: source file or directory path
            Available ``kwargs`` are:
            - ``copy_theme``: copy theme directory and files into presentation
                              one
            - ``destination_file``: path to html or PDF destination file
            - ``direct``: enables direct rendering presentation to stdout
            - ``debug``: enables debug mode
            - ``embed``: generates a standalone document, with embedded assets
            - ``encoding``: the encoding to use for this presentation
            - ``extensions``: Comma separated list of markdown extensions
            - ``logger``: a logger lambda to use for logging
            - ``presenter_notes``: enable presenter notes
            - ``relative``: enable relative asset urls
            - ``theme``: path to the theme to use for this presentation
            - ``verbose``: enables verbose output