* http links translated to html : target "_blank"
@ 2021-02-01 9:10 Uwe Brauer
2021-02-01 11:03 ` Juan Manuel Macías
2021-02-01 11:59 ` TEC
0 siblings, 2 replies; 11+ messages in thread
From: Uwe Brauer @ 2021-02-01 9:10 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 9:10 http links translated to html : target "_blank" Uwe Brauer
@ 2021-02-01 11:03 ` Juan Manuel Macías
2021-02-01 13:56 ` Uwe Brauer
2021-02-01 11:59 ` TEC
1 sibling, 1 reply; 11+ messages in thread
From: Juan Manuel Macías @ 2021-02-01 11:03 UTC (permalink / raw)
To: Uwe Brauer; +Cc: orgmode
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
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 9:10 http links translated to html : target "_blank" Uwe Brauer
2021-02-01 11:03 ` Juan Manuel Macías
@ 2021-02-01 11:59 ` TEC
2021-02-01 13:30 ` Uwe Brauer
1 sibling, 1 reply; 11+ messages in thread
From: TEC @ 2021-02-01 11:59 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 11:59 ` TEC
@ 2021-02-01 13:30 ` Uwe Brauer
2021-02-01 13:52 ` TEC
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Brauer @ 2021-02-01 13:30 UTC (permalink / raw)
To: emacs-orgmode
[-- 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 --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 13:30 ` Uwe Brauer
@ 2021-02-01 13:52 ` TEC
2021-02-01 13:56 ` Uwe Brauer
0 siblings, 1 reply; 11+ messages in thread
From: TEC @ 2021-02-01 13:52 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 11:03 ` Juan Manuel Macías
@ 2021-02-01 13:56 ` Uwe Brauer
2021-02-01 14:46 ` Juan Manuel Macías
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Brauer @ 2021-02-01 13:56 UTC (permalink / raw)
To: emacs-orgmode
[-- 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 --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 13:52 ` TEC
@ 2021-02-01 13:56 ` Uwe Brauer
0 siblings, 0 replies; 11+ messages in thread
From: Uwe Brauer @ 2021-02-01 13:56 UTC (permalink / raw)
To: emacs-orgmode
[-- 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 --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 13:56 ` Uwe Brauer
@ 2021-02-01 14:46 ` Juan Manuel Macías
2021-02-01 15:20 ` Uwe Brauer
0 siblings, 1 reply; 11+ messages in thread
From: Juan Manuel Macías @ 2021-02-01 14:46 UTC (permalink / raw)
To: Uwe Brauer; +Cc: orgmode
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 14:46 ` Juan Manuel Macías
@ 2021-02-01 15:20 ` Uwe Brauer
2021-02-01 21:01 ` Juan Manuel Macías
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Brauer @ 2021-02-01 15:20 UTC (permalink / raw)
To: Juan Manuel Macías; +Cc: Uwe Brauer, orgmode
[-- 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 --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 15:20 ` Uwe Brauer
@ 2021-02-01 21:01 ` Juan Manuel Macías
2021-02-04 14:07 ` Uwe Brauer
0 siblings, 1 reply; 11+ messages in thread
From: Juan Manuel Macías @ 2021-02-01 21:01 UTC (permalink / raw)
To: Uwe Brauer; +Cc: orgmode
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: http links translated to html : target "_blank"
2021-02-01 21:01 ` Juan Manuel Macías
@ 2021-02-04 14:07 ` Uwe Brauer
0 siblings, 0 replies; 11+ messages in thread
From: Uwe Brauer @ 2021-02-04 14:07 UTC (permalink / raw)
To: emacs-orgmode
[-- 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 --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-02-04 14:11 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-01 9:10 http links translated to html : target "_blank" Uwe Brauer
2021-02-01 11:03 ` Juan Manuel Macías
2021-02-01 13:56 ` Uwe Brauer
2021-02-01 14:46 ` Juan Manuel Macías
2021-02-01 15:20 ` Uwe Brauer
2021-02-01 21:01 ` Juan Manuel Macías
2021-02-04 14:07 ` Uwe Brauer
2021-02-01 11:59 ` TEC
2021-02-01 13:30 ` Uwe Brauer
2021-02-01 13:52 ` TEC
2021-02-01 13:56 ` Uwe Brauer
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).