Git Product home page Git Product logo

Comments (8)

smeech avatar smeech commented on June 29, 2024 1

You could set a global variable to save repeating the command, and awk may be simpler:

global_vars:
  - name: pattern
    type: echo
    params:
      echo: awk '{print "<li>" $0 "</li>"}'

then each item is:

      - name: flist1
        type: shell
        params:
          cmd: echo "{{form.list1}}" | {{pattern}}

However, whatever I do I get alignment problems with the output.

from espanso.

smeech avatar smeech commented on June 29, 2024 1

No, it separates the items in the list.

    <li>three</li>
<li>four</li>
<li>five</li>

I'm only testing one of the fields, with three items.

from espanso.

tnntwister avatar tnntwister commented on June 29, 2024 1

great solution ! it works like a charm, and surely with quotes in the text :)

from espanso.

smeech avatar smeech commented on June 29, 2024

What exactly do your sed lines do? I'm struggling with several unknown option to s', which are making it difficult for me to work out.
They take the list and wrap each item in <li></li>?

from espanso.

tnntwister avatar tnntwister commented on June 29, 2024

Capture d’écran du 2024-03-12 10-49-21
yes, the idea is to make a < li> for each line of the multiline text.

from espanso.

tnntwister avatar tnntwister commented on June 29, 2024

alignment is not my main concern for now.
Thanks for this code, you're right, pattern will be useful here !
but it will put an < li> tag around the whole multiline text, won't it ?

from espanso.

smeech avatar smeech commented on June 29, 2024

You're welcome.

from espanso.

smeech avatar smeech commented on June 29, 2024

Whilst pursuing a train of thought, I've done some investigation.
If the {{pattern}} isn't going to be used elsewhere, it can be defined in vars: within the main expansion, to save having a global_vars: entry. It only gets generated once, no matter how many times you use it.

from espanso.

Related Issues (20)

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.