Ejemplo n.º 1
0
def _show_usage_label(view, args):
    tex_root = get_tex_root(view)
    if tex_root is None:
        return False
    ana = analysis.analyze_document(tex_root)

    def is_correct_ref(c):
        command = ("\\" + c.command + "{")[::-1]
        return NEW_STYLE_REF_REGEX.match(command) and c.args == args

    refs = ana.filter_commands(is_correct_ref)

    if len(refs) == 0:
        sublime.error_message("No references for '{0}' found.".format(args))
        return
    elif len(refs) == 1:
        ref = refs[0]
        utils.open_and_select_region(view, ref.file_name, ref.region)
        return

    captions = [ana_utils.create_rel_file_str(ana, r) for r in refs]

    quickpanel.show_quickpanel(captions, refs)
Ejemplo n.º 2
0
def _show_usage_label(view, args):
    tex_root = get_tex_root(view)
    if tex_root is None:
        return False
    ana = analysis.analyze_document(tex_root)

    def is_correct_ref(c):
        command = ("\\" + c.command + "{")[::-1]
        return NEW_STYLE_REF_REGEX.match(command) and c.args == args

    refs = ana.filter_commands(is_correct_ref)

    if len(refs) == 0:
        sublime.error_message("No references for '{0}' found.".format(args))
        return
    elif len(refs) == 1:
        ref = refs[0]
        utils.open_and_select_region(view, ref.file_name, ref.region)
        return

    captions = [ana_utils.create_rel_file_str(ana, r) for r in refs]

    quickpanel.show_quickpanel(captions, refs)
Ejemplo n.º 3
0
def _make_caption(ana, entry):
    text = entry.text
    file_pos_str = ana_utils.create_rel_file_str(ana, entry)
    return "{text} ({file_pos_str})".format(**locals())
Ejemplo n.º 4
0
def _make_caption(ana, entry):
    text = entry.text
    file_pos_str = ana_utils.create_rel_file_str(ana, entry)
    return "{text} ({file_pos_str})".format(**locals())