Esempio n. 1
0
  def __init__(self, name, params, **kwargs):
    MooseObject.__init__(self, name, params)

    # Get a reference to the factory
    self._warehouse = self.getParam('_warehouse')
    self._factory = self.getParam('_factory')
    self._parser = self.getParam('_parser')
    self._root = self.getParam('_root')

    # Set the slide type
    self._slide_type = kwargs.pop('slide_type', 'RemarkSlide')

    # Initialize storage for the generate slides, use an ordered dict to maintain slide ordering
    self._slides = dict()
    self._slide_order = []
    self._content_slides = None # name(s) of contents slides
    self._title_slide = None # name of title slides

    # Count the number of slides, used for assigning default name
    self._count = 0

    # Storage for links
    self._links = []

    # Print a message
    print '  CREATED:', name
Esempio n. 2
0
  def __init__(self, params, **kwargs):
    MooseObject.__init__(self, params)

    # Set the Image type
    self.__image_type = kwargs.pop('image_type', 'MarkdownImage')

    # Set the parent object, which is the RemarkSlideSet parent object
    self.parent = self.getParam('_parent')

    # The slide number, this is set by the SlideSetWarehouse::__contents method
    self.number = 0

    # Get a reference to the factory, parser, and the root node of the input file
    self.__factory = self.parent.getParam('_factory')
    self.__parser = self.parent.getParam('_parser')
    self.__root = self.parent.getParam('_root')

    # Storage for raw markdown, this is populated by the parent RemarkSlideSet
    self.markdown = None

    # Storage for the comments
    self.comments = []

    # Storage for the slide title
    self.__title = None

    # Initialize the image information storage
    self.__images = dict()

    # Source directory for the PresentationBuilder code
    self.__source_dir = os.path.abspath(os.path.join(os.path.split(inspect.getfile(self.__class__))[0], '..'))

    # Add comments supplied via the optional argument
    if self.isParamValid('comments'):
      self.comments.append(self.getParam('comments'))
Esempio n. 3
0
    def __init__(self, name, params, **kwargs):
        MooseObject.__init__(self, name, params)

        # Get a reference to the factory
        self._warehouse = self.getParam('_warehouse')
        self._factory = self.getParam('_factory')
        self._parser = self.getParam('_parser')
        self._root = self.getParam('_root')

        # Set the slide type
        self._slide_type = kwargs.pop('slide_type', 'RemarkSlide')

        # Initialize storage for the generate slides, use an ordered dict to maintain slide ordering
        self._slides = dict()
        self._slide_order = []
        self._content_slides = None  # name(s) of contents slides
        self._title_slide = None  # name of title slides

        # Count the number of slides, used for assigning default name
        self._count = 0

        # Storage for links
        self._links = []

        # Print a message
        print '  CREATED:', name
Esempio n. 4
0
  def __init__(self, params, **kwargs):
    MooseObject.__init__(self, params)

    # Set the Image type
    self.__image_type = kwargs.pop('image_type', 'MarkdownImage')

    # Set the parent object, which is the RemarkSlideSet parent object
    self.parent = self.getParam('_parent')

    # The slide number, this is set by the SlideSetWarehouse::__contents method
    self.number = 0

    # Get a reference to the factory, parser, and the root node of the input file
    self.__factory = self.parent.getParam('_factory')
    self.__parser = self.parent.getParam('_parser')
    self.__root = self.parent.getParam('_root')

    # Storage for raw markdown, this is populated by the parent RemarkSlideSet
    self.markdown = None

    # Storage for the comments
    self.comments = []

    # Storage for the slide title
    self.__title = None

    # Initialize the image information storage
    self.__images = dict()

    # Source directory for the PresentationBuilder code
    self.__source_dir = os.path.abspath(os.path.join(os.path.split(inspect.getfile(self.__class__))[0], '..'))

    # Add comments supplied via the optional argument
    if self.isParamValid('comments'):
      self.comments.append(self.getParam('comments'))
Esempio n. 5
0
  def __init__(self, name, params):
    MooseObject.__init__(self, name, params)
    self.parent = self.getParam('_parent')

    # Set download flag (default is true)
    self._download = True
    if self.isParamValid('download'):
      self.__download = self.parameters()['download']
Esempio n. 6
0
    def __init__(self, name, params):
        MooseObject.__init__(self, name, params)
        self.parent = self.getParam('_parent')

        # Set download flag (default is true)
        self._download = True
        if self.isParamValid('download'):
            self.__download = self.parameters()['download']
Esempio n. 7
0
  def __init__(self, name, params):
    MooseObject.__init__(self, name, params)
    self.parent = self.getParam('_parent')
    self.match = self.getParam('_match')

    # Store the complete markdown image text
    self._raw = self.match.group(0)

    # Set download flag (default is true)
    self._download = True
    if self.isParamValid('download'):
      self._download = self._pars['download']
Esempio n. 8
0
    def __init__(self, name, params):
        MooseObject.__init__(self, name, params)
        self.parent = self.getParam('_parent')
        self.match = self.getParam('_match')

        # Store the complete markdown image text
        self._raw = self.match.group(0)

        # Set download flag (default is true)
        self._download = True
        if self.isParamValid('download'):
            self._download = self._pars['download']
Esempio n. 9
0
  def __init__(self, name, params):
    MooseObject.__init__(self, name, params)
    self.parent = self.getParam('_parent')

    # Set download flag (default is true)
    self._download = True
    if self.isParamValid('download'):
      self.__download = self.parameters()['download']

    # Images are formated has html, if backticks where added to equations then need to be removed
    if self.isParamValid('caption'):
      self._pars['caption'] = re.sub(r'`(\$.*?\$)`', r'\1', self._pars['caption'])
Esempio n. 10
0
    def __init__(self, name, params):
        MooseObject.__init__(self, name, params)
        self.parent = self.getParam('_parent')

        # Set download flag (default is true)
        self._download = True
        if self.isParamValid('download'):
            self.__download = self.parameters()['download']

        # Images are formated has html, if backticks where added to equations then need to be removed
        if self.isParamValid('caption'):
            self._pars['caption'] = re.sub(r'`(\$.*?\$)`', r'\1',
                                           self._pars['caption'])
Esempio n. 11
0
    def validParams():
        params = MooseObject.validParams()
        params.addParam('class', 'The class property for RemarkJS CSS content')
        params.addParam('name', 'The name of the slide')
        params.addParam('background-image', 'The background image file name')
        params.addParam('comments', 'Additional slide comments')
        params.addParam(
            'show_in_contents', True,
            'Toggle if the slide appears in the table-of-contents')
        params.addParam('prefix',
                        'Raw markdown to insert before slide content')
        params.addParam('suffix', 'Raw markdown to insert after slide content')
        params.addParam(
            'auto_title', True,
            'Enable/disable automatic addition of (cont.) for slides without a title.'
        )
        params.addParam('slides', 'A list of slides to include')
        params.addParam(
            'auto_insert_github_code', True,
            'When true links to GitHub code is automatically inserted')
        params.addParam(
            'insert_github_code_link', 'top',
            'When auto linking code place the link at with the code (top | bottom | none)'
        )

        # Remark properties that should remain in the raw markdown
        params.addParamsToGroup('properties',
                                ['name', 'class', 'background-image'])

        params.addPrivateParam('title', False)
        return params
Esempio n. 12
0
    def validParams():
        params = MooseObject.validParams()
        params.addParam('caption', 'The image caption')
        params.addParam('show_caption', True,
                        'Toggle the visibility of the caption')
        params.addParam('name', 'The image file name')
        params.addParam('url', 'The image file url')
        params.addParam('download', False, 'Download the image locally')
        params.addPrivateParam(
            'markdown')  # The raw markdown source for this image

        params.addParam('div-center', True, 'Wrap html figure in centered div')
        params.addParam('align', 'The image horizontal alignment')
        params.addParam('width', 'The image width')
        params.addParam('height', 'The image height')
        params.addParam('style', 'The img style property')
        params.addParam('vertical-align',
                        'The vertical alignment of the image')
        params.addParam('text-align', 'Text alignment of image')
        params.addParam('caption', 'The caption for the image')
        params.addParamsToGroup(
            'html',
            ['align', 'width', 'height', 'vertical-align', 'text-align'])

        return params
Esempio n. 13
0
    def __init__(self, name, params, **kwargs):
        MooseObject.__init__(self, name, params)

        # Set the Slide type
        self.__slide_type = kwargs.pop('slide_type', 'RemarkSlide')

        # Get a reference to the items needed to create objects
        self.__factory = self.getParam('_factory')
        self.__parser = self.getParam('_parser')
        self.__root = self.getParam('_root')

        # Create a storage object for the slides created by this set
        self.__slide_warehouse = SlideWarehouse(set_name = name, \
                                                active = self.getParam('active'), \
                                                inactive = self.getParam('inactive'))

        # Print a message
        print '  ', name
Esempio n. 14
0
  def __init__(self, name, params, **kwargs):
    MooseObject.__init__(self, name, params)

    # Set the Slide type
    self.__slide_type = kwargs.pop('slide_type', 'RemarkSlide')

    # Get a reference to the items needed to create objects
    self.__factory = self.getParam('_factory')
    self.__parser = self.getParam('_parser')
    self.__root = self.getParam('_root')

    # Create a storage object for the slides created by this set
    self.__slide_warehouse = SlideWarehouse(set_name = name, \
                                            active = self.getParam('active'), \
                                            inactive = self.getParam('inactive'))

    # Print a message
    print '  ', name
Esempio n. 15
0
  def __init__(self, name, params, **kwargs):
    MooseObject.__init__(self, name, params)

    # Set the Image type
    self._image_type = kwargs.pop('image_type', 'MarkdownImage')

    # Set the parent object
    self.parent = self.getParam('_parent') # the SlideSet parent object

    # Get a reference to the factory
    self._warehouse = self.parent.getParam('_warehouse')
    self._factory = self.parent.getParam('_factory')
    self._parser = self.parent.getParam('_parser')
    self._root = self.parent.getParam('_root')

    # Initialize member variables
    self.markdown = None                   # storage for parsed markdown (see SlideSet::createSlide)
    self.index = None                      # slide index, this is only populated and used for table of contents generation
    self.comments = []                     # comment storage for the current slide
    self._show_in_contents = self.getParam('show_in_contents')
    self._title = None
    self._previous = None
    self._raw_markdown = self.getParam('markdown')

    # Set the location of PresentationBuilder directory
    self._source_dir = os.path.abspath(os.path.join(os.path.split(inspect.getfile(self.__class__))[0], '..', '..'))

    # Initialize the image information storage
    self._images = dict()
    self._createImages(self._raw_markdown)

    # Add comments supplied via the optional argument
    if self.isParamValid('comments'):
      self.comments.append(self.getParam('comments'))

    # Store the previous slide
    if self.parent._slides:
      self._previous = self.parent._slides.items()[-1]

    # Extract title
    match = re.search(self._title_re, self._raw_markdown)
    if match:
      self._title = (match.group(1) + ' ' + match.group(2)).replace('\r', '')
Esempio n. 16
0
  def __init__(self, name, params, **kwargs):
    MooseObject.__init__(self, name, params)

    # Get a reference to the factory
    self._warehouse = self.getParam('_warehouse')
    self._factory = self.getParam('_factory')
    self._parser = self.getParam('_parser')
    self._root = self.getParam('_root')

    # Set the slide type
    self._slide_type = kwargs.pop('slide_type', 'RemarkSlide')

    # Initialize storage for the generate slides, use an ordered dict to maintain slide ordering
    self._slides = OrderedDict()

    # Count the number of slides, used for assigning default name
    self._count = 0

    # Print a message
    print 'Created:', name
Esempio n. 17
0
  def validParams():
    params = MooseObject.validParams()
    params.addParam('class', 'The class property for RemarkJS CSS content')
    params.addParam('background-image', 'The background image file name')
    params.addParam('comments', 'Additional slide comments')
    params.addParam('show_in_contents', True, 'Toggle if the slide appears in the table-of-contents')

    params.addParamsToGroup('properties', ['class', 'background-image'])

    params.addPrivateParam('title', False)
    return params
Esempio n. 18
0
  def __init__(self, name, params, **kwargs):
    MooseObject.__init__(self, name, params)

    # Set the Image type
    self._image_type = kwargs.pop('image_type', 'MarkdownImage')

    # Set the parent object
    self.parent = self.getParam('_parent') # the SlideSet parent object

    # Get a reference to the factory
    self._warehouse = self.parent.getParam('_warehouse')
    self._factory = self.parent.getParam('_factory')
    self._parser = self.parent.getParam('_parser')
    self._root = self.parent.getParam('_root')

    # Initialize member variables
    self.markdown = None                   # storage for parsed markdown (see SlideSet::createSlide)
    self.index = None                      # slide index, this is only populated and used for table of contents generation
    self.comments = []                     # comment storage for the current slide
    self._show_in_contents = self.getParam('show_in_contents')
    self._title = None
    self._previous = None
    self._raw_markdown = self.getParam('markdown')
    self._format = self.getParam('format')

    # Set the location of PresentationBuilder directory
    self._source_dir = os.path.abspath(os.path.join(os.path.split(inspect.getfile(self.__class__))[0], '..'))

    # Initialize the image information storage
    self._images = dict()
    self._createImages(self._raw_markdown)

    # Add comments supplied via the optional argument
    if self.isParamValid('comments'):
      self.comments.append(self.getParam('comments'))

    # Extract title
    match = re.search(self._title_re, self._raw_markdown, re.MULTILINE)
    if match:
      self._title = (match.group(1) + ' ' + match.group(2)).replace('\r', '')
Esempio n. 19
0
  def validParams():
    params = MooseObject.validParams()
    params.addParam('class', 'The class property for RemarkJS CSS content')
    params.addParam('background-image', 'The background image file name')
    params.addParam('comments', 'Additional slide comments')
    params.addParam('show_in_contents', True, 'Toggle if the slide appears in the table-of-contents')
    params.addParam('prefix', 'Raw markdown to insert before slide content')
    params.addParam('suffix', 'Raw markdown to insert after slide content')
    params.addParam('auto_title', True, 'Enable/disable automatic addition of (cont.) for slides without a title.')

    params.addParamsToGroup('properties', ['class', 'background-image'])

    params.addPrivateParam('title', False)
    return params
Esempio n. 20
0
  def validParams():
    params = MooseObject.validParams()
    params.addParam('class', 'The class property for RemarkJS CSS content')
    params.addParam('background-image', 'The background image file name')
    params.addParam('comments', 'Additional slide comments')
    params.addParam('show_in_contents', True, 'Toggle if the slide appears in the table-of-contents')
    params.addParam('prefix', 'Raw markdown to insert before slide content')
    params.addParam('suffix', 'Raw markdown to insert after slide content')
    params.addParam('auto_title', True, 'Enable/disable automatic addition of (cont.) for slides without a title.')

    params.addParamsToGroup('properties', ['class', 'background-image'])

    params.addPrivateParam('title', False)
    return params
Esempio n. 21
0
  def validParams():
    params = MooseObject.validParams()
    params.addParam('caption', 'The image caption')
    params.addParam('show_caption', True, 'Toggle the visibility of the caption')
    params.addParam('name', 'The image file name')
    params.addParam('url', 'The image file url')
    params.addParam('download', False, 'Download the image locally')

    params.addParam('align', 'The image horizontal alignment')
    params.addParam('width', 'The image width')
    params.addParam('height', 'The image height')
    params.addParam('style', 'The img style property')
    params.addParam('vertical-align', 'The vertical alignment of the image')
    params.addParamsToGroup('html', ['align', 'width', 'height', 'vertical-align', 'style'])

    return params
Esempio n. 22
0
  def validParams():
    params = MooseObject.validParams()
    params.addParam('caption', 'The image caption')
    params.addParam('show_caption', True, 'Toggle the visibility of the caption')
    params.addParam('name', 'The image file name')
    params.addParam('url', 'The image file url')
    params.addParam('download', 'Download the image locally')

    params.addParam('align', 'The image horizontal alignment')
    params.addParam('width', 'The image width')
    params.addParam('height', 'The image height')
    params.addParam('style', 'The img style property')
    params.addParam('vertical-align', 'The vertical alignment of the image')
    params.addParamsToGroup('html', ['align', 'width', 'height', 'vertical-align', 'style'])

    return params
Esempio n. 23
0
  def validParams():
    params = MooseObject.validParams()
    params.addRequiredParam('type', 'The type of slide set to create')
    params.addParam('title', 'The title of the slide set, if this exists a title slide will be injected')
    params.addParam('slides', 'A list of slide ids to output, if blank all slides are output')
    params.addParam('contents', 'Include table of contents slide')
    params.addParam('contents_level', 1, 'The heading level to include in the contents')
    params.addParam('show_in_contents', True, 'Toggle if the slide set content appears in the table-of-contents')

    # Create the common parameters from RemarkSlide 'properties' group
    slide_params = RemarkSlide.validParams()
    for key in slide_params.groupKeys('properties'):
      params.addParam(key, slide_params.getDescription(key))
    params.addParamsToGroup('properties', slide_params.groupKeys('properties'))

    return params
Esempio n. 24
0
  def validParams():
    params = MooseObject.validParams()
    params.addParam('class', 'The class property for RemarkJS CSS content')
    params.addParam('background-image', 'The background image file name')
    params.addParam('comments', 'Additional slide comments')
    params.addParam('show_in_contents', True, 'Toggle if the slide appears in the table-of-contents')
    params.addParam('prefix', 'Raw markdown to insert before slide content')
    params.addParam('suffix', 'Raw markdown to insert after slide content')
    params.addParam('auto_title', True, 'Enable/disable automatic addition of (cont.) for slides without a title.')
    params.addParam('slides', 'A list of slides to include')
    params.addParam('auto_insert_github_code', True, 'When true links to GitHub code is automatically inserted')
    params.addParam('insert_github_code_link', 'top', 'When auto linking code place the link at with the code (top | bottom | none)')

    params.addParamsToGroup('properties', ['class', 'background-image'])

    params.addPrivateParam('title', False)
    return params
Esempio n. 25
0
  def validParams():
    params = MooseObject.validParams()
    params.addParam('caption', 'The image caption')
    params.addParam('show_caption', True, 'Toggle the visibility of the caption')
    params.addParam('name', 'The image file name')
    params.addParam('url', 'The image file url')
    params.addParam('download', False, 'Download the image locally')
    params.addPrivateParam('markdown') # The raw markdown source for this image

    params.addParam('div-center', True, 'Wrap html figure in centered div')
    params.addParam('align', 'The image horizontal alignment')
    params.addParam('width', 'The image width')
    params.addParam('height', 'The image height')
    params.addParam('style', 'The img style property')
    params.addParam('vertical-align', 'The vertical alignment of the image')
    params.addParam('text-align', 'Text alignment of image')
    params.addParam('caption', 'The caption for the image')
    params.addParamsToGroup('html', ['align', 'width', 'height', 'vertical-align', 'text-align'])

    return params
Esempio n. 26
0
  def validParams():
    params = MooseObject.validParams()
    params.addRequiredParam('type', 'The type of slide set to create')
    params.addParam('title', 'The title of the slide set, if this exists a title slide will be injected')
    params.addParam('active', 'A list of ordered slide names to output, if blank all slides are output')
    params.addParam('inactive', 'A list of slide names to exclude from output')
    params.addParam('contents', False, 'Include table of contents slide')
    params.addParam('contents_title', 'The table-of-contents heading for this slide set')
    params.addParam('contents_level', 1, 'The heading level to include in the contents')
    params.addParam('contents_items_per_slide', 11, 'The number of contents items to include on a page')
    params.addParam('show_in_contents', True, 'Toggle if slide set content appears in the table-of-contents')
    params.addParam('style', 'The CSS style sheet to utilize for this slide set')
    params.addParam('non_ascii_warn', True, 'Produce warning if non-ascii characters are located')

    # Create the common parameters from RemarkSlide 'properties' group
    slide_params = RemarkSlide.validParams()
    for key in slide_params.groupKeys('properties'):
      params.addParam(key, slide_params.getDescription(key))
    params.addParamsToGroup('properties', slide_params.groupKeys('properties'))

    return params
Esempio n. 27
0
    def validParams():
        params = MooseObject.validParams()
        params.addRequiredParam('type', 'The type of slide set to create')
        params.addParam(
            'title',
            'The title of the slide set, if this exists a title slide will be injected'
        )
        params.addParam(
            'active', [],
            'A list of ordered slide names to output, if blank all slides are output'
        )
        params.addParam('inactive', [],
                        'A list of slide names to exclude from output')
        params.addParam('contents', False, 'Include table of contents slide')
        params.addParam('contents_title',
                        'The table-of-contents heading for this slide set')
        params.addParam('contents_level', 1,
                        'The heading level to include in the contents')
        params.addParam('contents_items_per_slide', 15,
                        'The number of contents items to include on a page')
        params.addParam(
            'show_in_contents', True,
            'Toggle if slide set content appears in the table-of-contents')
        params.addParam('style',
                        'The CSS style sheet to utilize for this slide set')
        params.addParam('non_ascii_warn', True,
                        'Produce warning if non-ascii characters are located')

        # Create the common parameters from RemarkSlide 'properties' group
        slide_params = RemarkSlide.validParams()
        for key in slide_params.groupKeys('properties'):
            params.addParam(key, slide_params.getDescription(key))
        params.addParamsToGroup('properties',
                                slide_params.groupKeys('properties'))

        return params