Hi I need to produce a html file, with links opening new tabs (pages) as in <a href="https://apps.apple.com/es/app/radar-covid/id1520443509" target="_blank">Descarga Directa</a> However [[https://www.mpic.de/4747361/risk-calculator target="_blank"][Simulador de riesgo con más detalle]] Did not work Any ideas? Thanks and regards Uwe Brauer
I think the problem is how the exporter understands the url string. Note that this: @@html:<a href="https://www.mpic.de/4747361/risk-calculator" target="_blank">Simulador de riesgo con más detalle</a>@@ [[https://www.mpic.de/4747361/risk-calculator target="_blank"][Simulador de riesgo con más detalle]] is exported like this: <p> <a href="https://www.mpic.de/4747361/risk-calculator" target="_blank">Simulador de riesgo con más detalle</a> </p> <p> <a href="https://www.mpic.de/4747361/risk-calculator%20target=%22_blank%22">Simulador de riesgo con más detalle</a> </p> The second link is wrong formatted. A dirty solution could be: #+BIND: org-export-filter-final-output-functions (correct-target-blank) #+begin_src emacs-lisp :exports results :results none (defun correct-target-blank (text backend info) (when (org-export-derived-backend-p backend 'html) (replace-regexp-in-string "%20target=%22_blank%22\"" "\" target=\"_blank\"" text))) #+end_src Best regards, Juan Manuel Uwe Brauer <oub@mat.ucm.es> writes: > Hi > > I need to produce a html file, with links opening new tabs (pages) as in > > <a href="https://apps.apple.com/es/app/radar-covid/id1520443509" target="_blank">Descarga Directa</a> > > However > > [[https://www.mpic.de/4747361/risk-calculator target="_blank"][Simulador de riesgo con más detalle]] > > Did not work > > Any ideas? > > Thanks and regards > > Uwe Brauer > >
Uwe Brauer <oub@mat.ucm.es> writes:
> I need to produce a html file, with links opening new tabs (pages) as in
>
> <a href="https://apps.apple.com/es/app/radar-covid/id1520443509" target="_blank">Descarga Directa</a>
>
> However
>
> [[https://www.mpic.de/4747361/risk-calculator target="_blank"][Simulador de riesgo con más detalle]]
>
> Did not work
>
> Any ideas?
Have you tried:
#+attr_html: :target _blank
That may work.
--
Timothy
[-- Attachment #1: Type: text/plain, Size: 1422 bytes --] >>> "T" == TEC <tecosaur@gmail.com> writes: > Uwe Brauer <oub@mat.ucm.es> writes: >> I need to produce a html file, with links opening new tabs (pages) as in >> >> <a href="https://apps.apple.com/es/app/radar-covid/id1520443509" target="_blank">Descarga Directa</a> >> >> However >> >> [[https://www.mpic.de/4747361/risk-calculator target="_blank"][Simulador de riesgo con más detalle]] >> >> Did not work >> >> Any ideas? > Have you tried: > #+attr_html: :target _blank Aha, thanks, it works, sometimes: The first two work, the last two not. Not sure what to think about it #+attr_html: :target _blank [[https://www.zeit.de/wissen/gesundheit/2020-11/coronavirus-aerosols-infection-risk-hotspot-interiors][Risk simulator]] #+attr_html: :target _blank [[https://www.mpic.de/4747361/risk-calculator][Risk simulator with more details]] 1. RocketBook #+attr_html: :target _blank + [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1][Book A4]] #+attr_html: :target _blank a. [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1][Book A4]] [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
Uwe Brauer <oub@mat.ucm.es> writes:
> Aha, thanks, it works, sometimes:
>
> The first two work, the last two not. Not sure what to think about it
Mmm, you need to have #+attr_html immediately followed by the link on
the next line.
It would be nice if there was a way to set these attributes inline with
the link, but AFAIK that's not currently possible.
--
Timothy
[-- Attachment #1: Type: text/plain, Size: 2111 bytes --] >>> "JMM" == Juan Manuel Macías <maciaschain@posteo.net> writes: Hola Juan > I think the problem is how the exporter understands the url string. > Note that this: > @@html:<a href="https://www.mpic.de/4747361/risk-calculator" target="_blank">Simulador de riesgo con más detalle</a>@@ > [[https://www.mpic.de/4747361/risk-calculator target="_blank"][Simulador de riesgo con más detalle]] > is exported like this: > <p> > <a href="https://www.mpic.de/4747361/risk-calculator" target="_blank">Simulador de riesgo con más detalle</a> > </p> > <p> > <a href="https://www.mpic.de/4747361/risk-calculator%20target=%22_blank%22">Simulador de riesgo con más detalle</a> > </p> > The second link is wrong formatted. A dirty solution could be: > #+BIND: org-export-filter-final-output-functions (correct-target-blank) > #+begin_src emacs-lisp :exports results :results none > (defun correct-target-blank (text backend info) > (when (org-export-derived-backend-p backend 'html) > (replace-regexp-in-string "%20target=%22_blank%22\"" "\" target=\"_blank\"" text))) > #+end_src > Best regards, Thanks that works, but not for link in a list. The only solution seems to be this one #+attr_html: :target _blank [[https://www.zeit.de/wissen/gesundheit/2020-11/coronavirus-aerosols-infection-risk-hotspot-interiors][Risk simulator]] #+attr_html: :target _blank [[https://www.mpic.de/4747361/risk-calculator][Risk simulator with more details]] 1. RocketBook + Book A4 #+attr_html: :target _blank [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1][Book A4]] a. Book A4 #+attr_html: :target _blank [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1][Book A4]] [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
[-- Attachment #1: Type: text/plain, Size: 1330 bytes --] >>> "T" == TEC <tecosaur@gmail.com> writes: > Uwe Brauer <oub@mat.ucm.es> writes: >> Aha, thanks, it works, sometimes: >> >> The first two work, the last two not. Not sure what to think about it > Mmm, you need to have #+attr_html immediately followed by the link on > the next line. > It would be nice if there was a way to set these attributes inline with > the link, but AFAIK that's not currently possible. Right so this works #+attr_html: :target _blank [[https://www.zeit.de/wissen/gesundheit/2020-11/coronavirus-aerosols-infection-risk-hotspot-interiors][Risk simulator]] #+attr_html: :target _blank [[https://www.mpic.de/4747361/risk-calculator][Risk simulator with more details]] 1. RocketBook + Book A4 #+attr_html: :target _blank [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1][Book A4]] a. Book A4 #+attr_html: :target _blank [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1][Book A4]] [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
Hi Uwe, Uwe Brauer <oub@mat.ucm.es> writes: > Thanks that works, but not for link in a list. The only solution > seems to be this one Doesn't it work for you in a list? I think it should work also in a list. If I export this: #+begin_src org ,#+BIND: org-export-filter-final-output-functions (correct-target-blank) ,#+begin_src emacs-lisp :exports results :results none (defun correct-target-blank (text backend info) (when (org-export-derived-backend-p backend 'html) (replace-regexp-in-string "%20target=%22_blank%22\"" "\" target=\"_blank\"" text))) ,#+end_src + [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1 target="_blank"][Book A4]] + [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1 target="_blank"][Book A4]] #+end_src I get this: #+begin_src html <ul class="org-ul"> <li><a href="https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1" target="_blank">Book A4</a></li> <li><a href="https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1" target="_blank">Book A4</a></li> </ul> #+end_src Using `#+attr_html:' is a simpler and cleaner solution, of course, but I think that would not work with links within a paragraph. Best regards / saludos, Juan Manuel
[-- Attachment #1: Type: text/plain, Size: 1918 bytes --] >>> "JMM" == Juan Manuel Macías <maciaschain@posteo.net> writes: > Hi Uwe, > Uwe Brauer <oub@mat.ucm.es> writes: >> Thanks that works, but not for link in a list. The only solution >> seems to be this one > Doesn't it work for you in a list? I think it should work also in a > list. If I export this: > #+begin_src org > ,#+BIND: org-export-filter-final-output-functions (correct-target-blank) > ,#+begin_src emacs-lisp :exports results :results none > (defun correct-target-blank (text backend info) > (when (org-export-derived-backend-p backend 'html) > (replace-regexp-in-string "%20target=%22_blank%22\"" "\" target=\"_blank\"" text))) > ,#+end_src > + [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1 target="_blank"][Book A4]] > + [[https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1 target="_blank"][Book A4]] > #+end_src > I get this: That is odd (maybe my org version is a bit rusty (master june 2020) I obtain this: <ul class="org-ul"> <li><a href="https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1%20target=%22_blank%22">Book A4</a></li> <li><a href="https://www.amazon.es/Rocketbook-Everlast-Notebook-riutilizzabile-Esecutivo/dp/B071Y3MSRK/ref=sr_1_5?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=Rocketbook&qid=1607847519&sr=8-5&th=1%20target=%22_blank%22">Book A4</a></li> </ul> [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
Uwe Brauer <oub@mat.ucm.es> writes:
> That is odd (maybe my org version is a bit rusty (master june 2020)
It's strange...
It should work fine for you (as long as you set
`org-export-allow-bind-keywords' as non-nil)
You can also try `org-export-filter-link-functions' instead of
`...-final-output-functions'.
Anyway, if the `#+attr_latex' solution works for you, then all is fine.
Best regards,
Juan Manuel
[-- Attachment #1: Type: text/plain, Size: 563 bytes --] >>> "JMM" == Juan Manuel Macías <maciaschain@posteo.net> writes: > Uwe Brauer <oub@mat.ucm.es> writes: >> That is odd (maybe my org version is a bit rusty (master june 2020) > It's strange... > It should work fine for you (as long as you set > `org-export-allow-bind-keywords' as non-nil) Aha, indeed it was nil! I was not even aware of this variable, after switching to t, your code worked. Thanks because it save me the hassle to add manually #+attr_latex On the other hand it is good to know that booth solution exits. Thanks Uwe [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]