Пример #1
0
def get_all_tags_in_presentation(presentation):
    tags = []
    for slide in presentation.slides:
        if slide.has_notes_slide:
            text_frame = slide.notes_slide.notes_text_frame
            tags += get_all_tags_in_comment(text_frame.text)
    return sdt_common.uniq(tags)
Пример #2
0
def find_all_template_strings_in_presentation(presentation):
    templates = []
    for slide in presentation.slides:
        for shape in slide.shapes:
            if not shape.has_text_frame:
                continue
            text_frame = shape.text_frame
            for paragraph in text_frame.paragraphs:
                for template in find_templates_in_string(paragraph.text):
                    templates += [template]
    return sdt_common.uniq(templates)
Пример #3
0
def get_all_tags_in_comment(text):
    json_list = sdt_common.find_json_in_string(text)
    all_tags = []
    if json_list:
        for json_block in json_list:
            if sdt_common.is_json(json_block):
                tags = json.loads(json_block)['tags']
                if not isinstance(tags, list):
                    tags = [tags]
                all_tags += tags
    return sdt_common.uniq(all_tags)
Пример #4
0
def find_all_template_strings_in_presentation(presentation):

    template_names = []
    templates = []

    for slide in presentation.slides:
        for shape in slide.shapes:
            if not shape.has_text_frame:
                continue
            text_frame = shape.text_frame
            for paragraph in text_frame.paragraphs:
                for template in find_templates_in_string(paragraph.text):
                    template_names += [template]
    for template in sdt_common.uniq(template_names):
        templates.append({
            "name":
            template,
            "default":
            get_template_default(template, presentation)
        })
    return templates