Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend no-front-matter to filter #266

Closed
wants to merge 1 commit into from
Closed

Conversation

WeissP
Copy link

@WeissP WeissP commented Mar 2, 2024

This is a demo to solve #202.

The idea is to change the keyword "no-front-matter" in dynamic block denote-files to "filter". It acts the same as before if a natural number is passed. To simulate :no-front-matter t in this implementation, one can pass :filter 'no-front-matter. Additionally, one can define a custom function which receives beginning-of-contents to do custom filtering, for example:

(defun denote-only-summary (beginning-of-contents)
    "Only keep contents before the first heading"
    (delete-region
     (1+ (re-search-forward "^$" nil :no-error 1))
     beginning-of-contents)
    (when (re-search-forward "^\\*+ " nil :no-error 1)      
      (delete-region (pos-bol) (point-max))
      )
    (delete-blank-lines)
    )
#+BEGIN: denote-files :regexp "my-note" :filter denote-only-summary 

#+END

Note that currently the documentation for the parameter FILTER is missing as it is just a demo and the feature might change later.

@protesilaos
Copy link
Owner

I have not had the chance to review this. Sorry! We will do it after the release of Denote version 3.0.0.

@protesilaos
Copy link
Owner

I never managed to work on this at the time and now think we need to refactor how we approach the dynamic blocks. I will close this but agree the idea is good.

Discussions on what we need to do:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants