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.

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.

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>

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);
}


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

Reply via email to