From: Stanislav Sokolenko <stanislav@sokolenko.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Modifying bibliography entries using lua
Date: Mon, 23 Jul 2018 13:42:16 -0300 [thread overview]
Message-ID: <0c75e475-4775-b5c7-e4b8-3217234bf155@sokolenko.net> (raw)
Dear list,
I'm struggling to output bibliography entries into lua for string
modification (like making a particular author name bold). In effect, I
just need something like the following:
\starttexdefinition btx:customauthor
\startluacode
local text = context.btxflush('author')
-- tex.sprint(text) -- fails because text remains nil
\stopluacode
\stoptexdefinition
It's clear that btxflux is the wrong function for this as it writes the
contents to file rather than returning a variable in lua... Is there a
way to directly access what btxflush is writing through the publications
table or other means? I've gone over the source code but I can't
decipher what btxflush is actually doing.
Thanks,
Stan
Longer MNWE:
\stopluacode
\startbuffer[ref]
@article{solo,
author = {Lastname, Firstname},
title = {Solo work},
journal = {Journal},
year = {2000},
month = {1},
volume = {1}
}
\stopbuffer
\usebtxdataset[ref][ref.buffer]
\setupbtx[dataset=ref]
\definebtxrendering[ref][dataset=ref]
\setupbtx[default:cite]
[alternative=authoryear,
etallimit=1]
\starttexdefinition btx:customauthor
\startluacode
local text = context.btxflush('author')
-- tex.sprint(text) -- text remains nill
\stopluacode
\stoptexdefinition
\startsetups btx:default:list:article
\texdefinition{btx:customauthor}
\texdefinition{btx:default:title}
\texdefinition{btx:default:journal}
\texdefinition{btx:default:year}
\removeunwantedspaces
\removepunctuation
\btxperiod
\stopsetups
\starttext
Citations: \cite[solo]
\startsubject[title=Bibliography]
\placelistofpublications[ref][method=dataset]
\stopsection
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next reply other threads:[~2018-07-23 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-23 16:42 Stanislav Sokolenko [this message]
2018-07-23 18:40 ` Hans Hagen
2018-07-23 20:17 ` Stanislav Sokolenko
2018-07-23 21:32 ` Hans Hagen
2018-07-24 14:41 ` Stanislav Sokolenko
2018-07-24 16:29 ` Hans Hagen
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=0c75e475-4775-b5c7-e4b8-3217234bf155@sokolenko.net \
--to=stanislav@sokolenko.net \
--cc=ntg-context@ntg.nl \
/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).