Giter Club home page Giter Club logo

search-replace's People

Stargazers

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

Watchers

 avatar

Forkers

dropsplash

search-replace's Issues

backslash in search-replace and search-replace output dependent

Hello,

Thanks for yout code; very useful.
Would it be possible to have in

search-replace:
\quarto : "Quarto something"
"\quarto": "Quarto something"
"\quarto": "Quarto"

It seems that the backslash in any form of the previous yaml header can not be used to trigger a search-replace; maybe I missed something

Also, it would be nice to have the possibility of having a search replacement that is format output-dependent. The same keyword with different output depending on the format is pdf, HTML, Latex, or Word. Do you have any idea how to do that?

Many thanks
Regards

callouts with no title

I get an error when making a callout without an explicit title. I used the MWE in #1 and removed the title and get the following error:

Error running filter /opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:
/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:3125: attempt to index a nil value (field 'integer index')
stack traceback:
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:10765: in field 'parse'
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:389: in function </opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:384>
	[C]: in ?
	[C]: in method 'walk'
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:171: in function 'run_emulated_filter'
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:449: in local 'callback'
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:495: in function </opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:476>
stack traceback:
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:171: in function 'run_emulated_filter'
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:449: in local 'callback'
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
	/opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:495: in function </opt/miniconda3/envs/r-4.3.1/share/quarto/filters/main.lua:476>

I believe it is the following line and with the below amendment the code works as expected in my case (using the quarto-default callout title).

call.title = call.title:walk(replace_abbr)

  if call.title then
    call.title = call.title:walk(replace_abbr)
  end

Format specific search-replace

In #3, @dropsplash suggested to make search-replace format specific.

I am planning to implement this sooner or later with a reserved sub-keys, eg.

search-replace:
   +quarto: "[Quarto](https://quarto.org)"
   +qurl  : https://quarto.org/docs
   __condition__1:
       _unless-format_: pdf
       +br : <br>
   __condition__2:
       _when-format_: pdf   
       +br: \ \newline

Any comments or suggestions? please let me know

N.b. this is not implemented yet, PR are welcome ๐Ÿ˜Š

No replacement when inside a callout

I have an issue with search-replace inside of callouts.

In the _quarto.yml I have:

filters:
  - search-replace
search-replace:
  +hello: "Hello world"

In a .qmd document the replacement works outside of the callout, but not inside.


## +hello <!-- returns: "Hello world" -->

::: {.callout}

## +hello <!-- returns: "+hello" -->

...Callout text...

:::

Is there a workaround for this issue?

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.