Coder Social home page Coder Social logo

peanball / logseq-dynamic-lookup Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 1.0 488 KB

A Logseq plugin to dynamically look up another page's property values and place them where you need. Great with macros.

License: MIT License

HTML 5.09% TypeScript 84.56% JavaScript 10.36%
logseq-plugin

logseq-dynamic-lookup's People

Contributors

dependabot[bot] avatar jjaychen1e avatar peanball avatar semantic-release-bot avatar stdword avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jjaychen1e

logseq-dynamic-lookup's Issues

Use any template language inside the template

My case #1: I want to check if a property exists, without using fallbackTemplate.

With a mustache-like template language it can looks like:

{{renderer :lookup, page, :alias:description, "{{#alias}} ({{alias}}){{/alias}}: {{description}}"}}

And specifing list of properties now looks unnecessary:

{{renderer :lookup, page, "{{#alias}} ({{alias}}){{/alias}}: {{description}}"}}

My case #2: Use page name

With a template language we can save a page meta-info as a default context:

{{renderer :lookup, page, "[[{{ page.name }}]] {{#page.props.alias}} ({{page.props.alias}}){{/page.props.alias}}: {{page.props.description}}"}}

Allow multi-value lookup

Proposal:

{{renderer :lookup, PAGE, prop1:prop2:prop3, <a href="$prop1">$prop2</a>, $prop3}}

instead of just putting the property value as $value.

Look for blocks properties/content

I think it could be useful to look for properties and content of blocks too.

In particular I'm referring to:

  1. the parent block if any (maybe fallback to current page title and properties otherwise?)
  2. Previous/next sibling block

An use case for 1. could be:

You are in a page/block about an Author and you want to use a "New Book" template to create a Book that has page title/block content as the value of author:: property:

- Name Surname
  - Title of the book created with a template
    author:: Name Surname

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.