On Tue, Jun 17, 2014 at 5:57 PM, Christoph Bersch <use...@bersch.net> wrote:

> Frank, thanks for your reply.
>
> Zitat von Frank Bennett <biercena...@gmail.com>:
> >
> > Adding wrapper markup is currently out of scope for CSL proper, but
> > processors may offer their own hooks to accomplish this.
>
> In my opinion, there isn't much difference between a `font-weight`,
> `display` and a potential `href` argument.
>

They look similar in HTML markup, but the first two are purely about
display, and the last requires information from the item data. Also, you
might place the first two anywhere in a citation, but the last needs to go
exclusively on a node that renders a variable (if we are going to render
fine-grained linking, which we should provide for -- to cover RDFa).


> My use case is, that I want to generate different publication lists
> for our institute's homepage, and this should allow to wrap quite
> arbitrary parts of a bibentry with a link. So your proposal to add a
> hook to certain items propably wouldn't work straight away.
>

Yes, you would need to write a small snippet of JavaScript code. When the
adjustments to the processor are done, I'll post instructions.


>
> So, with an `href` argument, a possible part would look like
>
> <group delimiter=" " href="DOI">
>    <text variable="container-title" form="short" text-case="title"/>
>    <group delimiter=", ">
>      <text variable="volume" font-weight="bold"/>
>      <group delimiter=" ">
>        <text macro="page-or-number"/>
>        <text macro="year-date" prefix="(" suffix=")"/>
>      </group>
>    </group>
> </group>
>

If you want to wrap the entire bib entry in a single like like that, it's
already supported -- that is what the code added for Philip Lord's project
does.

Coding the wrapper and variable into the CSL would make things quite stiff.
People might want to link with an anchor around the cite, or place a button
next to the cite, or link to a resolver with a selection of cite details,
or just apply a highlight to some portion the cite, conditioned on its
content. Or link to the ORCID ids or profiles of all authors on an item in
a rollover menu (including authors dropped by et al. truncation).

A hook can be made to cover any of those use cases fairly easily.



> As a workaround, I created two macros `doi-or-url-start` and
> `doi-or-url-stop` which allow to insert pseudo links, which are then
> post-processed with PHP. For reference, here are the snippets I
> currently use:
>
> <macro name="doi-or-url">
>    <choose>
>      <if variable="URL">
>        <text variable="URL" />
>      </if>
>      <else-if variable="DOI">
>        <text variable="DOI" prefix="http://dx.doi.org/"; />
>      </else-if>
>    </choose>
> </macro>
> <macro name="doi-or-url-start">
>    <choose>
>      <if variable="URL DOI" match="any">
>        <text macro="doi-or-url" prefix="{{a href='" suffix="'}}"/>
>      </if>
>    </choose>
> </macro>
> <macro name="doi-or-url-stop">
>    <choose>
>      <if variable="URL DOI" match="any">
>        <text value="{{/a}}"/>
>      </if>
>    </choose>
> </macro>
> <group delimiter=" ">
>    <text macro="doi-or-url-start"/>
>    <text variable="container-title" form="short" text-case="title"/>
>    <group delimiter=", ">
>    <text variable="volume" font-weight="bold"/>
>    <group delimiter=" ">
>      <text macro="page-or-number"/>
>      <text macro="year-date" prefix="(" suffix=")"/>
>    </group>
>    </group>
>    <text macro="doi-or-url-stop"/>
> </group>
>
> For the replacements of the '{{...' stuff I use the following regular
> expressions:
>
> function replaceLinks($text) {
>    $pattern = array('/{{(a href=.*?)}}(.*?){{\/a}}/',
>                     '/{{(\/?(?:[hH][1-6]|[a-zA-Z]+))\/?}}/');
>    $replacement = array('<\1>\2</a>',
>                         '<\1>');
>    return preg_replace($pattern, $replacement, $text);
> }
>

That was what I understood. A hook function will be easier for you to work
with, once it's running in the processor.

More news in a few days!

Frank



>
>
> Best regards,
> Christoph
>
>
>
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
> _______________________________________________
> xbiblio-devel mailing list
> xbiblio-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xbiblio-devel
>
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
xbiblio-devel mailing list
xbiblio-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xbiblio-devel

Reply via email to