Rik Kabel
2018-12-07 04:00:57 UTC
List,
I am trying to use the publications subsystem to support a
non-bibliographic database, as chapter 10 of mkiv-publications suggests
one can. My example is a database of quotations.
I have been partially successful, which is another way of saying there
are some issues I have not been able to resolve.
First, what goes into a specification lua file (I think that is what the
document suggests I need) that says my author field should be handled as
a bibliographic author field? There is some processing: {Schopenhauer,
Arthur} gets displayed as ArthurSchopenhauer (with no space). Specifying
an authorconversion in \setupbtx has no effect, so it looks like I have
to do something else.
Second, how can I link one entry to another. The example shows my
almost-working attempt, adding a linking key (translation in the
example) and recursively using it in processing. This fails, but when I
use the literal equivalent, it works. (And the recursion does not seem
to be the problem.) I know that this description is not clear, but the
example should demonstrate the issue.
Finally, the document loses all data from the quotation database when
\placebtxrendering for that database is omitted.
I apologize for the larger-than-usual example size.
%{[(
\startbuffer[quotesources]
@book{Schopenhauer1862v2,
title = {Parerga und Paralipomena},
subtitle = {Kleine Philosophische Schriften},
publisher = {A. W. Hahn},
year = {1862},
volume = {2},
volumes = {2},
author = {Arthur Schopenhauer},
editor = {Julius FrauenstÀdt},
address = {Berlin},
language = {german},
}
@book{SchopenhauerPayne2000,
title = {Parerga and Paralipomena},
subtitle = {Short Philosophical Essays},
publisher = {Oxford University Press Clarendon Press},
address = {New York and Oxford},
year = {2000},
author = {Arthur Schopenhauer},
volumes = {2},
origyear = {1974},
origlanguage= {german},
translator = {Eric F. J. Payne},
}
\stopbuffer
\startbuffer[quotedatabase]
@quote{qSchopA02,
extract = {Es wÀre gut BÌcher kaufen, wenn man die Zeit, sie zu
lesen, mitkaufen könnte, aber man verweschelt meistens
den Ankauf der BÃŒcher mit dem Aneignen ihres Inhalts.},
author = {Schopenhauer, Arthur},
born = {1788},
died = {1860},
work = {\cite[title][sources::Schopenhauer1862v2]},
year = {1862},
location = {chapter\btxnbsp24},
translation = {\cite[tag][qPayneE01]},
attribnote = {The selection was inserted posthumously into the work,
probably based on notes Schopenhauer left, by Julius
FrauenstÀdt, his literary executor, and has appeared
in different locations in various editions.},
}
@quote{qPayneE01,
extract = {Buying books would be a good thing if one could also
buy the time to read them in: but as a rule the
purchase of books is mistaken for the appropriation
of their contents.},
author = {Eric F. J. Payne},
born = {1895},
died = {1983},
year = {1974/2000},
work = {\cite[title][sources::SchopenhauerPayne2000]},
page = {559},
}
\stopbuffer
\loadbtxdefinitionfile
[apa]
\usebtxdefinitions
[apa]
\usebtxdataset
[sources]
[quotesources.buffer]
\definebtxrendering
[sources]
[apa]
[group=bib,
dataset=sources]
\setupbtx
[sources]
[specification=apa,
dataset=sources]
\usebtxdataset
[quotedb]
[quotedatabase.buffer]
\definebtxrendering
[quotedb]
[group=quotes,
sorttype=cite,
numbering=no,
dataset=quotedb]
\setupbtx
[specification=quotedb,
authorconversion=normalshort,
dataset=quotedb]
\startsetups btx:quotedb:cite:attribnote
{\rm\btxfield{attribnote}}
\stopsetups
\startsetups btx:quotedb:cite:born
{\rm\btxfield{born}}
\stopsetups
\startsetups btx:quotedb:cite:died
{\rm\btxfield{died}}
\stopsetups
\startsetups btx:quotedb:cite:location
{\rm\btxfield{location}}
\stopsetups
\startsetups btx:quotedb:cite:page
{\rm\btxfield{page}}
\stopsetups
\startsetups btx:quotedb:cite:work
{\rm\btxfield{work}}
\stopsetups
\startsetups btx:quotedb:cite:extract
{\rm\btxfield{extract}}
\stopsetups
\startsetups btx:quotedb:cite:title
{\rm\it\btxfield{title}}
\stopsetups
\startsetups btx:quotedb:list:quote
\limitatetext{\btxfield{extract}}{\textwidth}{\unknown}
\blank[none]
-\btxspace\btxflush{author}
\btxcomma\btxfield{year}
\stopsetups
\starttexdefinition Quotation #QUOTE
\startnarrower
\blank[halfline]
\startparagraph
\cite[extract][#QUOTE]
\stopparagraph
\startparagraph\noindentation
\blank[halfline]
\dontleavehmode\llap{â }\cite[author][#QUOTE]
\btxspace \doifnotempty{\cite[born][#QUOTE]}
{(\cite[born][#QUOTE]|â|\doiftext{\cite[died][#QUOTE]}
{\cite[died][#QUOTE]})}
\btxspace in \cite[work][#QUOTE]
\doiftextelse{\cite[page][#QUOTE]}
{\btxcomma p\btxperiod\btxnbsp\cite[page][#QUOTE]}
{\doiftext{\cite[location][#QUOTE]}
{\btxcomma \cite[location][#QUOTE]}}
\btxcomma \cite[year][#QUOTE]
\btxperiod
\cite[attribnote][#QUOTE]
\doiftext{\cite[translation][#QUOTE]}
{\btxspace A translation is:}
\stopparagraph
\doiftext{\cite[translation][#QUOTE]}
{\stopnarrower
%%----------------------------------------------------------------------
%% When this form is used, the compilation fails.
%
% \Quotation{\cite[translation][#QUOTE]}
%
%% When this form is used, the compilation works, but of course, this
%% form is not what is wanted.
%
\Quotation{qPayneE01}
%
%%----------------------------------------------------------------------
\startnarrower
}
\blank[3*halfline]
\stopnarrower
\stoptexdefinition
\starttext
\Quotation{qSchopA02}
%%----------------------------------------------------------------------
%% When this form is used, the compilation fails as well, so it isn't
%% the recursion that is the problem.
%
% \Quotation{\cite[translation][qSchopA02]}
%
%%----------------------------------------------------------------------
\hrule\blank
%%----------------------------------------------------------------------
%% When \placebtxrendering for the quotation database is removed,
%% none of the text from the database is printed, even though the
%% dataset completeness shows the data
%
\placebtxrendering [quotedb][method=dataset]
%
%%----------------------------------------------------------------------
\hrule\blank
\placebtxrendering [sources][method=dataset]
\page
\showbtxdatasetcompleteness[dataset=quotedb]
\page
\showbtxdatasetcompleteness[dataset=sources,specification=apa]
\stoptext
%)]}
I am trying to use the publications subsystem to support a
non-bibliographic database, as chapter 10 of mkiv-publications suggests
one can. My example is a database of quotations.
I have been partially successful, which is another way of saying there
are some issues I have not been able to resolve.
First, what goes into a specification lua file (I think that is what the
document suggests I need) that says my author field should be handled as
a bibliographic author field? There is some processing: {Schopenhauer,
Arthur} gets displayed as ArthurSchopenhauer (with no space). Specifying
an authorconversion in \setupbtx has no effect, so it looks like I have
to do something else.
Second, how can I link one entry to another. The example shows my
almost-working attempt, adding a linking key (translation in the
example) and recursively using it in processing. This fails, but when I
use the literal equivalent, it works. (And the recursion does not seem
to be the problem.) I know that this description is not clear, but the
example should demonstrate the issue.
Finally, the document loses all data from the quotation database when
\placebtxrendering for that database is omitted.
I apologize for the larger-than-usual example size.
%{[(
\startbuffer[quotesources]
@book{Schopenhauer1862v2,
title = {Parerga und Paralipomena},
subtitle = {Kleine Philosophische Schriften},
publisher = {A. W. Hahn},
year = {1862},
volume = {2},
volumes = {2},
author = {Arthur Schopenhauer},
editor = {Julius FrauenstÀdt},
address = {Berlin},
language = {german},
}
@book{SchopenhauerPayne2000,
title = {Parerga and Paralipomena},
subtitle = {Short Philosophical Essays},
publisher = {Oxford University Press Clarendon Press},
address = {New York and Oxford},
year = {2000},
author = {Arthur Schopenhauer},
volumes = {2},
origyear = {1974},
origlanguage= {german},
translator = {Eric F. J. Payne},
}
\stopbuffer
\startbuffer[quotedatabase]
@quote{qSchopA02,
extract = {Es wÀre gut BÌcher kaufen, wenn man die Zeit, sie zu
lesen, mitkaufen könnte, aber man verweschelt meistens
den Ankauf der BÃŒcher mit dem Aneignen ihres Inhalts.},
author = {Schopenhauer, Arthur},
born = {1788},
died = {1860},
work = {\cite[title][sources::Schopenhauer1862v2]},
year = {1862},
location = {chapter\btxnbsp24},
translation = {\cite[tag][qPayneE01]},
attribnote = {The selection was inserted posthumously into the work,
probably based on notes Schopenhauer left, by Julius
FrauenstÀdt, his literary executor, and has appeared
in different locations in various editions.},
}
@quote{qPayneE01,
extract = {Buying books would be a good thing if one could also
buy the time to read them in: but as a rule the
purchase of books is mistaken for the appropriation
of their contents.},
author = {Eric F. J. Payne},
born = {1895},
died = {1983},
year = {1974/2000},
work = {\cite[title][sources::SchopenhauerPayne2000]},
page = {559},
}
\stopbuffer
\loadbtxdefinitionfile
[apa]
\usebtxdefinitions
[apa]
\usebtxdataset
[sources]
[quotesources.buffer]
\definebtxrendering
[sources]
[apa]
[group=bib,
dataset=sources]
\setupbtx
[sources]
[specification=apa,
dataset=sources]
\usebtxdataset
[quotedb]
[quotedatabase.buffer]
\definebtxrendering
[quotedb]
[group=quotes,
sorttype=cite,
numbering=no,
dataset=quotedb]
\setupbtx
[specification=quotedb,
authorconversion=normalshort,
dataset=quotedb]
\startsetups btx:quotedb:cite:attribnote
{\rm\btxfield{attribnote}}
\stopsetups
\startsetups btx:quotedb:cite:born
{\rm\btxfield{born}}
\stopsetups
\startsetups btx:quotedb:cite:died
{\rm\btxfield{died}}
\stopsetups
\startsetups btx:quotedb:cite:location
{\rm\btxfield{location}}
\stopsetups
\startsetups btx:quotedb:cite:page
{\rm\btxfield{page}}
\stopsetups
\startsetups btx:quotedb:cite:work
{\rm\btxfield{work}}
\stopsetups
\startsetups btx:quotedb:cite:extract
{\rm\btxfield{extract}}
\stopsetups
\startsetups btx:quotedb:cite:title
{\rm\it\btxfield{title}}
\stopsetups
\startsetups btx:quotedb:list:quote
\limitatetext{\btxfield{extract}}{\textwidth}{\unknown}
\blank[none]
-\btxspace\btxflush{author}
\btxcomma\btxfield{year}
\stopsetups
\starttexdefinition Quotation #QUOTE
\startnarrower
\blank[halfline]
\startparagraph
\cite[extract][#QUOTE]
\stopparagraph
\startparagraph\noindentation
\blank[halfline]
\dontleavehmode\llap{â }\cite[author][#QUOTE]
\btxspace \doifnotempty{\cite[born][#QUOTE]}
{(\cite[born][#QUOTE]|â|\doiftext{\cite[died][#QUOTE]}
{\cite[died][#QUOTE]})}
\btxspace in \cite[work][#QUOTE]
\doiftextelse{\cite[page][#QUOTE]}
{\btxcomma p\btxperiod\btxnbsp\cite[page][#QUOTE]}
{\doiftext{\cite[location][#QUOTE]}
{\btxcomma \cite[location][#QUOTE]}}
\btxcomma \cite[year][#QUOTE]
\btxperiod
\cite[attribnote][#QUOTE]
\doiftext{\cite[translation][#QUOTE]}
{\btxspace A translation is:}
\stopparagraph
\doiftext{\cite[translation][#QUOTE]}
{\stopnarrower
%%----------------------------------------------------------------------
%% When this form is used, the compilation fails.
%
% \Quotation{\cite[translation][#QUOTE]}
%
%% When this form is used, the compilation works, but of course, this
%% form is not what is wanted.
%
\Quotation{qPayneE01}
%
%%----------------------------------------------------------------------
\startnarrower
}
\blank[3*halfline]
\stopnarrower
\stoptexdefinition
\starttext
\Quotation{qSchopA02}
%%----------------------------------------------------------------------
%% When this form is used, the compilation fails as well, so it isn't
%% the recursion that is the problem.
%
% \Quotation{\cite[translation][qSchopA02]}
%
%%----------------------------------------------------------------------
\hrule\blank
%%----------------------------------------------------------------------
%% When \placebtxrendering for the quotation database is removed,
%% none of the text from the database is printed, even though the
%% dataset completeness shows the data
%
\placebtxrendering [quotedb][method=dataset]
%
%%----------------------------------------------------------------------
\hrule\blank
\placebtxrendering [sources][method=dataset]
\page
\showbtxdatasetcompleteness[dataset=quotedb]
\page
\showbtxdatasetcompleteness[dataset=sources,specification=apa]
\stoptext
%)]}
--
Rik
Rik