Re: org-->html text between @ should be red.

2022-01-15 Thread Uwe Brauer
>>> "JMM" == Juan Manuel Macías  writes:

> I think this would work:
> (setq org-export-filter-plain-text-functions
>   (remove 'my-html-red org-export-filter-plain-text-functions))

> Anyway, I recommend that you take a look at the documentation on filters
> that Timothy pointed you to, as custom filters are tremendously useful
> and versatile, and very "surgical". I use them a lot!

> You can also apply a filter only in a document, by using the #+bind
> keyword and including the function in a non-exportable code block:

> #+begin_src emacs-lisp :exports results :results none
>   (defun my-html-red (text backend info)
> (when (org-export-derived-backend-p backend 'html)
>   (replace-regexp-in-string "@\\([^@]*\\)@"
>   "\\1"
>   text)))
> #+end_src

> #+bind: org-export-filter-plain-text-functions (my-html-red)

> (You need to set org-export-allow-bind-keywords to non-nil)

Thanks very much!!!

Regards

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: org-->html text between @ should be red.

2022-01-15 Thread Juan Manuel Macías
Uwe Brauer writes:

> (add-to-list 'org-export-filter-plain-text-functions 'my-html-red)
>
> How could I remove something from a list?

I think this would work:

(setq org-export-filter-plain-text-functions
(remove 'my-html-red org-export-filter-plain-text-functions))

Anyway, I recommend that you take a look at the documentation on filters
that Timothy pointed you to, as custom filters are tremendously useful
and versatile, and very "surgical". I use them a lot!

You can also apply a filter only in a document, by using the #+bind
keyword and including the function in a non-exportable code block:

#+begin_src emacs-lisp :exports results :results none
  (defun my-html-red (text backend info)
(when (org-export-derived-backend-p backend 'html)
  (replace-regexp-in-string "@\\([^@]*\\)@"
"\\1"
text)))
#+end_src

#+bind: org-export-filter-plain-text-functions (my-html-red)

(You need to set org-export-allow-bind-keywords to non-nil)

Best regards,

Juan Manuel 



Re: org-->html text between @ should be red.

2022-01-15 Thread Uwe Brauer
>>> "JMM" == Juan Manuel Macías  writes:

> Uwe Brauer writes:
>> Thanks very much it works as expected. However I just realized (and
>> this is true also for the org-mime filter that the reg-exp has a flaw.
>> 
>> I used the text 
>> 
>> 
>> =email:o...@mat.ucm.es=
>> 
>> So there is only one @, nevertheless the exporter translated that to 
>> email:oubmat.ucm.es
>> 
>> But this is wrong in my view.
>> 
>> Any ideas how to deal with such a situation?

> You can bind the function to org-export-filter-plain-text-functions
> instead of ...-final-output-functions.

Perfect, thanks.

Just out of curiosity because google does not know the answer

There is 
(add-hook 'some-hook 'some-function)
(remove-hook 'some-hook 'some-function)

So if I have 

(add-to-list 'org-export-filter-plain-text-functions 'my-html-red)

How could I remove something from a list?

Regards

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: org-->html text between @ should be red.

2022-01-15 Thread Juan Manuel Macías
Uwe Brauer writes:

> Thanks very much it works as expected. However I just realized (and
> this is true also for the org-mime filter that the reg-exp has a flaw.
>
> I used the text 
>
>
>  =email:o...@mat.ucm.es=
>
> So there is only one @, nevertheless the exporter translated that to 
> email:oubmat.ucm.es
>
> But this is wrong in my view.
>
> Any ideas how to deal with such a situation?

You can bind the function to org-export-filter-plain-text-functions
instead of ...-final-output-functions.

That way you wouldn't get false positives on lines like:

=email:o...@mat.ucm.es= some text @some text@

email:o...@mat.ucm.es some text some 
text

Best regards,

Juan Manuel 



Re: org-->html text between @ should be red.

2022-01-15 Thread Uwe Brauer
>>> "T" == Timothy   writes:
Hi Timothy
> Hi Uwe,
>> And every text between @ appears red.
>> 
>> Can I have a similar setting when exporting an org file to html via the
>> «normal» html exporter?

> Have a look at the filter functions, such as
> `org-export-filter-final-output-functions'. See
> .

Thanks, Juan already solved it, thanks.


smime.p7s
Description: S/MIME cryptographic signature


Re: org-->html text between @ should be red.

2022-01-15 Thread Uwe Brauer
>>> "JMM" == Juan Manuel Macías  writes:

> Uwe Brauer writes:
>> Can I have a similar setting when exporting an org file to html via the
>> «normal» html exporter?

> Using a custom filter?

> #+begin_src emacs-lisp

> (defun foo (text backend info)
> (when (org-export-derived-backend-p backend 'html)
>   (replace-regexp-in-string "@\\([^@]*\\)@"
>   "\\1"
>   text)))

> (add-to-list 'org-export-filter-final-output-functions 'foo)

> #+end_src

Thanks very much it works as expected. However I just realized (and this is 
true also for the org-mime filter that the reg-exp has a flaw.

I used the text 


 =email:o...@mat.ucm.es=

So there is only one @, nevertheless the exporter translated that to 
email:oubmat.ucm.es

But this is wrong in my view.

Any ideas how to deal with such a situation?

Thanks

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: org-->html text between @ should be red.

2022-01-15 Thread Timothy
Hi Uwe,

> And every text between @ appears red.
>
> Can I have a similar setting when exporting an org file to html via the
> «normal» html exporter?

Have a look at the filter functions, such as
`org-export-filter-final-output-functions'. See
.

All the best,
Timothy


Re: org-->html text between @ should be red.

2022-01-15 Thread Juan Manuel Macías
Uwe Brauer writes:

> Can I have a similar setting when exporting an org file to html via the
> «normal» html exporter?

Using a custom filter?

#+begin_src emacs-lisp

(defun foo (text backend info)
(when (org-export-derived-backend-p backend 'html)
  (replace-regexp-in-string "@\\([^@]*\\)@"
"\\1"
text)))

(add-to-list 'org-export-filter-final-output-functions 'foo)

#+end_src

Best regards,

Juan Manuel