Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Replace characters from certain lines

    Help wanted · · · – – – · · ·
    2
    5
    48
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MV82
      MV82 last edited by MV82

      I want to replace > with >}} from the end of my img tags.

      Now:

      <img src="/images/example-image.png" alt="Example Image" width="244" height="110">
      

      Result:

      {{< img src="/images/example-image.png" alt="Example Image" width="244" height="110" >}}
      

      I want to change this on all pages of my website at once.

      Is it possible? If so, how?

      I already know how to change <img to {{< img. That’s the easy part.

      Alan Kilborn 1 Reply Last reply Reply Quote 1
      • Alan Kilborn
        Alan Kilborn @MV82 last edited by

        @MV82

        Do both operations at once:

        find: (?-is)<img.*?>
        repl: {{$0}}
        search mode: regular expression

        MV82 1 Reply Last reply Reply Quote 1
        • MV82
          MV82 @Alan Kilborn last edited by MV82

          @Alan-Kilborn

          Thank you.

          But how do I get the space between {{< and img and between height=“” and >}}?

          Like in the example below:

          {{< img src="/images/example-image.png" alt="Example Image" width="244" height="110" >}}
          

          I don’t know if you know how Hugo (static site generator) works, but for Hugo shortcodes, I need space between {{< and img and between height=“” and >}}.

          Can you please tell me how to do that?

          Alan Kilborn 1 Reply Last reply Reply Quote 1
          • Alan Kilborn
            Alan Kilborn @MV82 last edited by Alan Kilborn

            @MV82

            find: (?-is)<(img.*?)>
            repl: {{< ${1} >}}

            It might be beneficial for you to learn how this is done, for your future needs, as we don’t continually do this for repeat askers.
            See HERE to get started.

            MV82 1 Reply Last reply Reply Quote 2
            • MV82
              MV82 @Alan Kilborn last edited by

              @Alan-Kilborn

              Thank you so much.

              This will save me a lot of time.

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors