ConTeXt: Customize bibliography list field rendering

Currently the APA format for bibliographies lacks the capability to format the author using

\setupbtx
  [apa:list:author]
  [command=\WORD]

Therefore you have to patch up the command btx:apa:author-or-editor yourself. I have also submitted a patch to the maintainers, so maybe it is even fixed in the next beta.

% macros: mkvi

\startbuffer[bibliografia]
@manual{iso27000,
  title  = "Normatividad y certificaciones aplicadas a SGSI",
  author = "López Neira, Agustín and Ruiz Spohr, Javier",
  url    = "http://www.iso27000.es/download/doc_iso27000_all.pdf",
  year   = "consultado el 29 de septiembre de 2017"
}

@inbook{Bunge1970,
  title   = "La ciencia. Su método y su filosfía",
  author  = "Bunge, Mario",
  address = "Buenos Aires: Ariel",
  year    = "1970",
  pages   = "120"
}
\stopbuffer

\mainlanguage[es]

\setuppagenumbering[location=footer]

\setuplayout
  [backspace=4cm,
   leftmargin=0pt,
   width=middle,
   rightmargin=0pt,
   cutspace=2cm,
   %
   topspace=3cm,
   header=0pt,
   headerdistance=0pt,
   height=middle,
   footerdistance=\dimexpr1cm-\lineheight\relax,
   footer=\lineheight,
   bottomspace=2cm]

\setuphead
  [title]
  [style=\WORD,
   align=middle,
   after={\blank[2*line]}]

\usebtxdefinitions[apa]

\usebtxdataset[bibliografia][bibliografia.buffer]

\definebtxrendering
  [bibliografia][apa]
  [dataset=bibliografia,
   group=examples]

\setupbtxlist
  [apa]
  [alternative=paragraph,
   width=fit,
   distance=0mm,
   margin=0mm,
   after={\blank[2*line]}]

\setupbtx
  [apa:list]
  [separator:names:2={\btxcomma},
   separator:names:3={\btxcomma\btxlabeltext{and}\space},
   separator:names:4={\btxspace\btxlabeltext{and}\space},
   authorconversion=normal]

\setupbtx
  [apa:list:author]
  [command=\WORD]

\setupbtx
  [apa:list:title]
  [style=normal]

\unprotect
% patch btx:apa:author-or-editor, copied from publ-imp-apa.mkvi
\starttexdefinition unexpanded btx:apa:author-or-editor #author
    \btxdoifelse {#author} {
        \btxstartstyleandcolor[apa:\s!list:#author]
            \btxusecommand [apa:\s!list:#author]{
                \btxflush{#author}
            }
        \btxstopstyleandcolor
        % use \processaction [] [] here?
        \doifelse {\btxfoundname{#author}} {editor} {
            \btxleftparenthesis
            \btxsingularorplural {editor} {
                \btxlabeltext{apa:Editor}
            } {
                \btxlabeltext{apa:Editors}
            }
            \btxrightparenthesis
        } {\doif {\btxfoundname{#author}} {ineditor} {
            \btxleftparenthesis
            \btxsingularorplural {ineditor} {
                \btxlabeltext{apa:Editor}
            } {
                \btxlabeltext{apa:Editors}
            }
            \btxrightparenthesis
        } }
        \doif {\currentbtxcategory} {film} {
            \btxleftparenthesis
            \doifelse {\btxfoundname{#author}} {director} {
                \btxsingularorplural {director} {
                    \btxlabeltext{apa:Director}
                } {
                    \btxlabeltext{apa:Directors}
                }
            } {
                \doif {\btxfoundname{#author}} {author} {
                    \btxsingularorplural {author} {
                        \btxlabeltext{apa:Writer}
                    } {
                        \btxlabeltext{apa:Writers}
                    }
                }
                \doif {\btxfoundname{#author}} {producer} {
                    \btxsingularorplural {producer} {
                        \btxlabeltext{apa:Producer}
                    } {
                        \btxlabeltext{apa:Producers}
                    }
                }
                \btxdoif {director} {
                    \btxrightparenthesis
                    \removeunwantedspaces
                    \btxparameter{\c!separator:names:3}
                    \btxflush{director}
                    \btxleftparenthesis
                    \btxsingularorplural {director} {
                        \btxlabeltext{apa:Director}
                    } {
                        \btxlabeltext{apa:Directors}
                    }
                }
            }
            \btxrightparenthesis
        }
        \btxdoif {withauthor} {
            \btxleftparenthesis
            \btxlabeltext{with}
            \btxspace
            \btxflush{withauthor}
            \btxrightparenthesis
        }
    } {
        \texdefinition{btx:apa:title}
    }
\stoptexdefinition
\protect

\starttext

\starttitle[title=Bibliografía]
  \placelistofpublications[bibliografia][method=dataset]
\stoptitle

\stoptext

enter image description here


You had it right with separator:names. Only a few problems that were ironed out for consistency's sake. You got it wrong with the setupbtxlist though. And so did I, because I couldn't get it done 'quite' right.

Don't vote, I'll just leave it here as a reminder.

See if Aditya can help you out, or perhaps someone over at the mailing list could.

Here is the code:

 \definebtxdataset[template]
 \usebtxdataset[template]
 [bibliografia.bib]


 \loadbtxdefinitionfile[apa]

 \definebtxrendering
 [template]
 [apa]
 [dataset=template, 
    group=examples]

 \setupbtx[apa:list:author]
 [separator:names:4={\btxspace y \btxspace},
 authorconversion={normal}]


 \setupbtxlist[apa]
    [state=start,
    margin=5\emwidth, 
    textstyle={\sc\texdefinition{btx:default:author} \it{\texdefinition{btx:default:title}}} ]


 \starttext

 \startbodymatter
 a citation: \cite[num][template::iso27000::]
 \stopbodymatter

 \startbackmatter
 \startchapter[title=Bibliografía]
 \placebtxrendering[template][method=dataset]
 \stopchapter
 \stopbackmatter



 \stoptext

enter image description here

this is another example. It was copied from http://ftp.math.utah.edu/pub/tex/bib/tugboat.html.

 \definebtxdataset[template]
 \usebtxdataset[template]
 [tugbib.bib]


 \loadbtxdefinitionfile[apa]

 \definebtxrendering
 [template]
 [apa]
 [dataset=template, 
    group=examples]

 \setupbtx[apa:list:author]
 [separator:names:4={\btxspace y \btxspace},
 authorconversion={normal}]


 \setupbtxlist[apa]
    [state=start,
    margin=5\emwidth, 
    textstyle={\sc\texdefinition{btx:default:author} \it{\texdefinition{btx:default:title}}} ]

 \starttext

 \startbodymatter
 a citation: \cite[num][template::Gregorio:TB26-3-273::]
 \stopbodymatter

 \startbackmatter
 \startchapter[title=Bibliografía]
 \placebtxrendering[template][method=dataset]
 \stopchapter
 \stopbackmatter



 \stoptext

enter image description here