ute / search-replace Goto Github PK
View Code? Open in Web Editor NEWquarto filter extension for simple search-replace macros
License: MIT License
quarto filter extension for simple search-replace macros
License: MIT License
Hello,
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
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).
if call.title then
call.title = call.title:walk(replace_abbr)
end
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 ๐
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.