def get_mdfiles_list_content():
    """
    Get markdown links in unordered markdown list

    Returns:
        str: Markdown unordered list

    """
    ns = Search()
    output = list()
    files = os.getenv('files').split('|')
    for f in files:
        link_title = ns.getNoteTitle(f)
        file_name = os.path.basename(f)
        output.append('* [' + link_title + '](' + pathname2url(file_name) + ')')
    return("\n".join(output))
def get_mdfiles_list_content() -> str:
    """
    Get markdown links in unordered markdown list

    Returns:

        str: Markdown unordered list

    """
    ns = Search()
    output = list()
    files = os.getenv('files').split(
        '|')  # one or list of md file paths from prev wf step
    for f in files:
        link_title = ns.getNoteTitle(f)
        file_name = os.path.basename(f)
        output.append(f'* [{link_title}]({pathname2url(file_name)})')
    return ("\n".join(output))
示例#3
0
#!/usr/bin/env python3

import os
import sys
from urllib.request import pathname2url

from MyNotes import Search

query = sys.argv[1]  # File path to MD Note
file_name = os.path.basename(query)
ms = Search()
title = ms.getNoteTitle(query)
output = f"[{title}]({pathname2url(file_name)})"
sys.stdout.write(output)
示例#4
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import os
from urllib.request import pathname2url

from Alfred3 import Items, Tools
from MyNotes import Search

# Get NotePath as path_query env variable
note_path = Tools.getEnv("path_query1")
# Get query used in search markdown notes as path_query env variable
query = Tools.getEnv("path_query2")
md_notes = Search()
# Get NoteTitle for specific note
note_title = md_notes.getNoteTitle(note_path)
file_name = pathname2url(os.path.basename(note_path))
# If query in notes search was empty subtitle uses following string
back_query = "<EMPTY>" if not query else query

# Actions in ScriptFilter menu data
ACTIONS = [
    {
        "title": "Back",
        "subtitle": f"Back to Search with query: {back_query}",
        "arg": f"back|{query}",
        "icon": "icons/back.png",
        "visible": True
    },
    {
        "title": "Markdown Link",