From: "R. Wils" <raiwil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Colored text in PDF
Date: Wed, 6 May 2020 10:52:13 -0700 (PDT) [thread overview]
Message-ID: <c9600dba-b955-4f59-81da-c9646f9a55ad@googlegroups.com> (raw)
In-Reply-To: <m2tv0tkoao.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 5792 bytes --]
Yes, I've found the error.
Thank you John for your help.
The pandoc-discuss group is very helpful.
On Wednesday, May 6, 2020 at 6:42:56 PM UTC+2, John MacFarlane wrote:
>
>
> Probably attributes.text-decoration needs to be
> attributes["text-decoration"] -- the hyphen is
> interpreted as subtraction.
>
> "R. Wils" <rai...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> writes:
>
> > Yes!! Thank you very much.
> >
> > It worked also converting to PDF (adding -o mydoc.pdf to the call with
> > pandoc)
> >
> > I tried to add text underline to the same lua function;
> >
> > function Span(el)
> > if FORMAT == "latex" and el.attributes.color then
> > return { pandoc.RawInline("latex", "\\textcolor{" ..
> > el.attributes.color .. "}"), el }
> > elseif FORMAT == "latex" and el.attributes.text-decoration then
> > return { pandoc.RawInline("latex", "\\underline{" ..
> > el.attributes.text-decoration .. "}"), el }
> > end
> > end
> >
> > with input
> > [this is my text]{text-decoration=underline}
> >
> > This gives an error `my_luafilter.lua:5: attempt to perform arithmetic
> on a
> > nil value (field 'text')`
> > What did I wrong?
> >
> >
> > On Tuesday, May 5, 2020 at 10:59:17 PM UTC+2, John MacFarlane wrote:
> >>
> >>
> >> Try this one:
> >>
> >> function Span(el)
> >> if FORMAT == "latex" and el.attributes.color then
> >> return { pandoc.RawInline("latex", "\\textcolor{" ..
> >> el.attributes.color .. "}"), el }
> >> end
> >> end
> >>
> >> Call with pandoc --lua-filter my_luafilter.lua -t latex
> >>
> >> With input
> >>
> >> [this is my text]{color=red}
> >>
> >> (note = not :) you should get the right result.
> >>
> >>
> >> "R. Wils" <rai...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> writes:
> >>
> >> > Thank you very much for your reply.
> >> >
> >> > Pandoc is so nice but also very difficult to understand.
> >> > I've never seen the lua language before. I'm quit familiar with
> Python
> >> and
> >> > Html but I've never seen lua code before.
> >> >
> >> > I've read the pages:
> >> > - lua-filters.html
> >> > Created a file: my_luafilter.lua
> >> >
> >> > with your function inside
> >> >
> >> > function Span(el)
> >> > if el.attributes.color then
> >> > return { pandoc.rawInline("latex", "\\textcolor{" ..
> >> > el.attributes.color .. "}"), el }
> >> > end
> >> > end
> >> >
> >> > And in my pandoc.markdown file I added this:
> >> >
> >> > <span style="color:red">test</span>
> >> >
> >> > And added this filter to my pandoc command:
> >> > --lua-filter=d:\\my_luafilter.lua
> >> >
> >> > Nothing happened.
> >> > What did I wrong?
> >> >
> >> > Sorry to ask you all these questions
> >> > I just need *colored text* and *underscore* for a markdown document I
> >> > created and which I want to convert to PDF format.
> >> > I'll learn every day a bit more about lua and lua filters.
> >> >
> >> > On Tuesday, May 5, 2020 at 6:15:06 PM UTC+2, John MacFarlane wrote:
> >> >>
> >> >>
> >> >> Cleanest way is to use a Span with an attribute, plus a
> >> >> lua filter that reacts to Spans with that attribute by
> >> >> adding some LaTeX color commands.
> >> >>
> >> >> See the lua filter documentation and feel free to ask
> >> >> if you have questions.
> >> >>
> >> >> Something like this (untested)
> >> >>
> >> >> function Span(el)
> >> >> if el.attributes.color then
> >> >> return { pandoc.rawInline("latex", "\\textcolor{" ..
> >> >> el.attributes.color .. "}"), el }
> >> >> end
> >> >> end
> >> >>
> >> >> "R. Wils" <rai...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> writes:
> >> >>
> >> >> > Does anyone know how to color text in a PDF
> >> >> > (converting from a pandoc.markdown text file)?
> >> >> >
> >> >> > I tried to use a span and div tag without success.
> >> >> >
> >> >> > (Sorry I'm a new pandoc user)
> >> >> >
> >> >> > --
> >> >> > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
> >> >> > To view this discussion on the web visit
> >> >>
> >>
> https://groups.google.com/d/msgid/pandoc-discuss/5f7aae6a-8087-439d-874b-dcf547dd10b1%40googlegroups.com.
>
> >>
> >> >>
> >> >>
> >> >
> >> > --
> >> > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
> >> > To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/pandoc-discuss/d38ce0bc-44cc-4e70-9914-728835ead837%40googlegroups.com.
>
> >>
> >>
> >
> > --
> > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/675c273d-a1c9-4e7a-8ec1-ec604ee056d7%40googlegroups.com.
>
>
--
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/c9600dba-b955-4f59-81da-c9646f9a55ad%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 9905 bytes --]
next prev parent reply other threads:[~2020-05-06 17:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 14:36 R. Wils
[not found] ` <5f7aae6a-8087-439d-874b-dcf547dd10b1-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-05-05 16:14 ` John MacFarlane
[not found] ` <m2o8r24avd.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-05-05 17:36 ` R. Wils
[not found] ` <d38ce0bc-44cc-4e70-9914-728835ead837-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-05-05 18:00 ` Pablo Rodríguez
2020-05-05 20:58 ` John MacFarlane
[not found] ` <m2o8r2m73g.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-05-06 9:00 ` R. Wils
[not found] ` <675c273d-a1c9-4e7a-8ec1-ec604ee056d7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-05-06 9:48 ` Albert Krewinkel
[not found] ` <87v9l9xukv.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2020-05-06 10:16 ` R. Wils
2020-05-06 16:42 ` John MacFarlane
[not found] ` <m2tv0tkoao.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-05-06 17:52 ` R. Wils [this message]
2020-05-06 10:24 ` R. Wils
[not found] ` <d3523f75-4ff6-455f-a5f7-d177cf048486-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-05-06 10:38 ` Albert Krewinkel
[not found] ` <87tv0txsa3.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2020-05-06 12:29 ` R. Wils
2020-05-06 12:28 ` R. Wils
2020-05-06 13:51 ` R. Wils
[not found] ` <03334be3-9d8c-4834-a0f1-e623ef668f42-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-05-06 14:18 ` Jeremy Theler
[not found] ` <443fca3d3f7aec7a51ddb5b7efad86c0b3958b00.camel-24em0bpozeFWk0Htik3J/w@public.gmane.org>
2020-05-06 15:12 ` R. Wils
[not found] ` <23108add-70bd-42e1-a320-8c5a38363b6f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-05-06 16:40 ` jeremy theler
[not found] ` <CAK0LiymWf-favbZ6t4VWrqW5CkpLRFvjd8096h9RSL3_7nxvoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-05-06 17:51 ` R. Wils
2020-05-14 8:20 ` Christophe Demko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c9600dba-b955-4f59-81da-c9646f9a55ad@googlegroups.com \
--to=raiwil-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).