Example #1
0
    def insert(self):
        if DEBUG:
            print('Adding unimplemented...')

        self.section.contents = f'"{self.section.type}" is not implemented' + \
                                ' in Docx yet. If required, use PDF instead'
        error.invoke(self.cell_object, self.section)
Example #2
0
def invoke(cell_object, section):
    if section.type != 'list':
        section.contents = f'Called list but not list -  [{section}]'
        return error.invoke(cell_object, section)

    section.extra['list_style'] = True
    TableElement(cell_object, section).insert()
Example #3
0
def invoke(cell_object, section):
    if section.type != MD_TYPE_QUOTE:
        section.contents = 'Called blockquote but not blockquote (quote) -' + \
                           f' [{section}]'
        return error.invoke(cell_object, section)

    QuoteWrapper(cell_object, section).wrap()
Example #4
0
def invoke(cell_object, section):
    if section.type != 'column_chart':
        section.contents = 'Called column_chart but not column_chart - ' + \
                           f'[{section}]'
        return error.invoke(cell_object, section)

    ColumnChartElement(cell_object, section).insert()
Example #5
0
def invoke(cell_object: CellObject, section: Section,
           invoked_from_wrapper=False):
    if section.type != 'elem_list':
        section.contents = f'Called elem_list but not elem_list -  [{section}]'
        return error.invoke(cell_object, section)

    ElemListWrapper(cell_object, section).wrap(
        invoked_from_wrapper=invoked_from_wrapper)
Example #6
0
def invoke(cell_object, section):
    if section.type != 'image':
        section.contents = f'Called image but not image -  [{section}]'
        return error.invoke(cell_object, section)

    has_run(cell_object)

    ImageElement(cell_object, section).insert()
Example #7
0
def invoke(cell_object: CellObject,
           section: Section,
           invoked_from_wrapper=False):
    if section.type != 'markdown':
        section.contents = f'Called markdown but not markdown -  [{section}]'
        return error.invoke(cell_object, section)

    MarkdownWrapper(cell_object,
                    section).wrap(invoked_from_wrapper=invoked_from_wrapper)
Example #8
0
def invoke(cell_object, section, apply_styling=True) -> None:
    if section.type not in ['header', 'paragraph',
                            'span', 'text', 'p']:
        section.contents = f'Called text but not text -  [{section}]'
        return error.invoke(cell_object, section)

    # Used when called directly from a text element (in the json)
    # So we have to apply the style manually.
    if apply_styling:
        has_run(cell_object)
        apply_style(cell_object, section)

    TextElement(cell_object, section).insert()
Example #9
0
def invoke(cell_object, section):
    if section.type != 'duration':
        section.contents = f'Called duration but not duration -  [{section}]'
        return error.invoke(cell_object, section)

    DurationElement(cell_object, section).insert()
Example #10
0
def invoke(cell_object, section) -> None:
    if section.type != 'placeholder':
        section.contents = f'Called placeholder but not placeholder -  [{section}]'
        return error.invoke(cell_object, section)

    PlaceHolderElement(cell_object, section).insert()
Example #11
0
def invoke(cell_object, section):
    if section.type != 'pie_chart':
        section.contents = f'Called pie_chart but not pie_chart - [{section}]'
        return error.invoke(cell_object, section)

    PieChartElement(cell_object, section).insert()
Example #12
0
def invoke(cell_object, section):
    if section.type != MD_TYPE_CODE:
        section.contents = f'Called code but not code -  [{section}]'
        return error.invoke(cell_object, section)

    CodeWrapper(cell_object, section).wrap()
Example #13
0
def insert_error(cell_object, error_msg):
    from sane_doc_reports.elements import error
    """ Insert an error element """
    section = SectionFactory("error", error_msg, {}, {}, {})
    error.invoke(cell_object, section)
Example #14
0
def invoke(cell_object, section):
    if section.type != MD_TYPE_LIST_ITEM:
        section.contents = f'Called li but not li -  [{section}]'
        return error.invoke(cell_object, section)

    LiWrapper(cell_object, section).wrap()
Example #15
0
def invoke(cell_object, section) -> None:
    if section.type != MD_TYPE_IMAGE:
        section.contents = f'Called image but not image -  [{section}]'
        return error.invoke(cell_object, section)

    ExternalImageElement(cell_object, section).insert()
Example #16
0
def invoke(cell_object, section):
    if section.type != 'trend':
        section.contents = f'Called trend but not trend -  [{section}]'
        return error.invoke(cell_object, section)

    TrendElement(cell_object, section).insert()
Example #17
0
def invoke(cell_object, section):
    if section.type != 'table':
        section.contents = f'Called table but not table -  [{section}]'
        return error.invoke(cell_object, section)

    TableElement(cell_object, section).insert()
Example #18
0
def invoke(cell_object, section) -> None:
    if section.type != 'date':
        section.contents = f'Called date but not date -  [{section}]'
        return error.invoke(cell_object, section)

    DateElement(cell_object, section).insert()
Example #19
0
def invoke(cell_object, section) -> None:
    if section.type not in ['a']:
        section.contents = f'Called link but not link -  [{section}]'
        return error.invoke(cell_object, section)

    LinkElement(cell_object, section).insert()
Example #20
0
def invoke(cell_object, section):
    if section.type != 'bar_chart':
        section.contents = f'Called bar_chart but not bar_chart -  [{section}]'
        return error.invoke(cell_object, section)

    BarChartElement(cell_object, section).insert()
Example #21
0
def invoke(cell_object, section) -> None:
    if section.type != 'divider':
        section.contents = f'Called divider but not divider -  [{section}]'
        return error.invoke(cell_object, section)

    DividerElement(cell_object, section).insert()
Example #22
0
def invoke(cell_object, section):
    if section.type != 'number':
        section.contents = f'Called number but not number -  [{section}]'
        return error.invoke(cell_object, section)

    NumberElement(cell_object, section).insert()
Example #23
0
def invoke(cell_object, section):
    if section.type != MD_TYPE_UNORDERED_LIST:
        section.contents = f'Called ul but not ul -  [{section}]'
        return error.invoke(cell_object, section)

    UlWrapper(cell_object, section).wrap()
Example #24
0
def invoke(cell_object, section):
    if section.type != MD_TYPE_HORIZONTAL_LINE:
        section.contents = f'Called hr but not hr -  [{section}]'
        return error.invoke(cell_object, section)

    HorizontalLineElement(cell_object, section).insert()