public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Get font color from md to pdf
@ 2021-07-10 16:36 dualer
       [not found] ` <d14bd782-78af-490b-8b95-006125797c87n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: dualer @ 2021-07-10 16:36 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 901 bytes --]

Hi everyone! I have a naive question: When I transform .md to .pdf, how to 
keep the font color unchange? I have see this 
<https://stackoverflow.com/questions/62831191/using-span-for-font-color-in-pandoc-markdown-for-both-html-and-pdf>, 
but the code don't work when meeting following markdown code: 

<span style="color: red;">@red text</span>

The key point above is `@`, and it interrupts `lua filter` to work, but I 
need it when I add some references, e.g. [@XX]. So how to solve it?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/d14bd782-78af-490b-8b95-006125797c87n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1268 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get font color from md to pdf
       [not found] ` <d14bd782-78af-490b-8b95-006125797c87n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-07-10 16:58   ` Bastien DUMONT
  2021-07-10 17:31   ` dualer
  1 sibling, 0 replies; 5+ messages in thread
From: Bastien DUMONT @ 2021-07-10 16:58 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Hi,

The example you give and the filter you point to work with latest pandoc. I got: `\textcolor{red}{@red text}`.

Le Saturday 10 July 2021 à 09:36:49AM, dualer a écrit :
> Hi everyone! I have a naive question: When I transform .md to .pdf, how
> to keep the font color unchange? I have
> see (https://stackoverflow.com/questions/62831191/using-span-for-font-color-in-pandoc-markdown-for-both-html-and-pdf),
> but the code don't work when meeting following markdown code: 
> 
> <span style="color: red;">@red text</span>
> 
> The key point above is `@`, and it interrupts `lua filter` to work, but
> I need it when I add some references, e.g. [@XX]. So how to solve it?
> 
> --
> You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to (mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org).
> To view this discussion on the web visit
> (https://groups.google.com/d/msgid/pandoc-discuss/d14bd782-78af-490b-8b95-006125797c87n%40googlegroups.com?utm_medium=email&utm_source=footer).

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/YOnRvIgr0PXnuYEd%40localhost.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get font color from md to pdf
       [not found] ` <d14bd782-78af-490b-8b95-006125797c87n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2021-07-10 16:58   ` Bastien DUMONT
@ 2021-07-10 17:31   ` dualer
       [not found]     ` <de189b39-1ca1-4d72-92de-a9d39d41d421n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: dualer @ 2021-07-10 17:31 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1098 bytes --]

Sorry, I forgot something. I have added `-C --bibliography=Library.bib` to 
the cmd code. 
在2021年7月11日星期日 UTC+8 上午12:36:49<dualer> 写道:

> Hi everyone! I have a naive question: When I transform .md to .pdf, how to 
> keep the font color unchange? I have see this 
> <https://stackoverflow.com/questions/62831191/using-span-for-font-color-in-pandoc-markdown-for-both-html-and-pdf>, 
> but the code don't work when meeting following markdown code: 
>
> <span style="color: red;">@red text</span>
>
> The key point above is `@`, and it interrupts `lua filter` to work, but I 
> need it when I add some references, e.g. [@XX]. So how to solve it?
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/de189b39-1ca1-4d72-92de-a9d39d41d421n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1944 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get font color from md to pdf
       [not found]     ` <de189b39-1ca1-4d72-92de-a9d39d41d421n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-07-10 18:37       ` Bastien DUMONT
  2021-07-11  3:00         ` dualer
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien DUMONT @ 2021-07-10 18:37 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I got it. The filter you're using performs a search on the "style" attribute's value even if there is none. The error happens when citeproc is called because citeproc creates spans with no "style" attribute.

Simply replace l. 2 with the following:

if el.attributes.style and string.find(el.attributes.style, "color") then

Le Saturday 10 July 2021 à 10:31:53AM, dualer a écrit :
> Sorry, I forgot something. I have added `-C --bibliography=Library.bib`
> to the cmd code. 
> 
> 在2021年7月11日星期日 UTC+8 上午12:36:49<dualer> 写道:
> 
>   Hi everyone! I have a naive question: When I transform .md to .pdf,
>   how to keep the font color unchange? I have
>   see (https://stackoverflow.com/questions/62831191/using-span-for-font-color-in-pandoc-markdown-for-both-html-and-pdf),
>   but the code don't work when meeting following markdown code: 
> 
>   <span style="color: red;">@red text</span>
> 
>   The key point above is `@`, and it interrupts `lua filter` to work,
>   but I need it when I add some references, e.g. [@XX]. So how to solve
>   it?
> 
> --
> You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to (mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org).
> To view this discussion on the web visit
> (https://groups.google.com/d/msgid/pandoc-discuss/de189b39-1ca1-4d72-92de-a9d39d41d421n%40googlegroups.com?utm_medium=email&utm_source=footer).

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/YOno3I69ZsTKSbtg%40localhost.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get font color from md to pdf
  2021-07-10 18:37       ` Bastien DUMONT
@ 2021-07-11  3:00         ` dualer
  0 siblings, 0 replies; 5+ messages in thread
From: dualer @ 2021-07-11  3:00 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2233 bytes --]

Thanks, It works. I have spent much much time on it. I should ask in this 
group earlier. 

在2021年7月11日星期日 UTC+8 上午2:38:07<Bastien Dumont> 写道:

> I got it. The filter you're using performs a search on the "style" 
> attribute's value even if there is none. The error happens when citeproc is 
> called because citeproc creates spans with no "style" attribute. 
>
> Simply replace l. 2 with the following: 
>
> if el.attributes.style and string.find(el.attributes.style, "color") then 
>
> Le Saturday 10 July 2021 à 10:31:53AM, dualer a écrit : 
> > Sorry, I forgot something. I have added `-C --bibliography=Library.bib` 
> > to the cmd code.  
> > 
> > 在2021年7月11日星期日 UTC+8 上午12:36:49<dualer> 写道: 
> > 
> > Hi everyone! I have a naive question: When I transform .md to .pdf, 
> > how to keep the font color unchange? I have 
> > see (
> https://stackoverflow.com/questions/62831191/using-span-for-font-color-in-pandoc-markdown-for-both-html-and-pdf), 
>
> > but the code don't work when meeting following markdown code:  
> > 
> > <span style="color: red;">@red text</span> 
> > 
> > The key point above is `@`, and it interrupts `lua filter` to work, 
> > but I need it when I add some references, e.g. [@XX]. So how to solve 
> > it? 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "pandoc-discuss" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to (mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). 
> > To view this discussion on the web visit 
> > (
> https://groups.google.com/d/msgid/pandoc-discuss/de189b39-1ca1-4d72-92de-a9d39d41d421n%40googlegroups.com?utm_medium=email&utm_source=footer). 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b60be6af-b18f-485d-87ca-2ada3ec6f8cen%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 3840 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-11  3:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-10 16:36 Get font color from md to pdf dualer
     [not found] ` <d14bd782-78af-490b-8b95-006125797c87n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-10 16:58   ` Bastien DUMONT
2021-07-10 17:31   ` dualer
     [not found]     ` <de189b39-1ca1-4d72-92de-a9d39d41d421n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-10 18:37       ` Bastien DUMONT
2021-07-11  3:00         ` dualer

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 NNTP newsgroup(s).