Skip to content

Commit

Permalink
Looking at plk/biblatex#1383
Browse files Browse the repository at this point in the history
  • Loading branch information
plk committed Sep 30, 2024
1 parent 481aebd commit d5f3373
Show file tree
Hide file tree
Showing 58 changed files with 235 additions and 148 deletions.
15 changes: 8 additions & 7 deletions data/schemata/bcf.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ start =
singletitle,
skipbib,
skipbiblist,
skiplab,
skiplab,
sortalphaothers?,
sortlocale,
sortingtemplatename,
Expand All @@ -68,7 +68,7 @@ start =
useprefix,
usenames
},

# Per-entrytype BibLaTeX options
element bcf:options {
attribute component { "biblatex" },
Expand Down Expand Up @@ -127,7 +127,7 @@ start =
xsd:string
}+
}*,

# datafield sets
element bcf:datafieldset {
attribute name { text },
Expand Down Expand Up @@ -162,13 +162,13 @@ start =
text
}+
}+,

# labelalpha template specification
element bcf:labelalphatemplate {
attribute type { xsd:string }?, # per-type?
element bcf:labelelement {
attribute order { xsd:integer },
element bcf:labelpart {
element bcf:labelpart {
attribute final { xsd:boolean }?,
attribute pad_char { xsd:string {minLength="1"}}?,
attribute pad_side { "left" | "right" }?,
Expand All @@ -187,6 +187,7 @@ start =

# Extradate specification
element bcf:extradatespec {
attribute type { xsd:string }?, # per-type?
# Scope of extradate tracking - an ordered set of fields to try
element bcf:scope {
# A field used to track extradate
Expand All @@ -195,7 +196,7 @@ start =
text
}+
}+
},
}+,

# Cross-reference inheritance specifications
element bcf:inheritance {
Expand Down Expand Up @@ -845,7 +846,7 @@ wrapline =
attribute type { "singlevalued" },
element bcf:key { "wrapline" },
element bcf:value { xsd:integer }
}
}
output_encoding =
element bcf:option {
attribute type { "singlevalued" },
Expand Down
44 changes: 27 additions & 17 deletions data/schemata/bcf.rng
Original file line number Diff line number Diff line change
Expand Up @@ -447,23 +447,33 @@
</oneOrMore>
</element>
</oneOrMore>
<!-- Extradate specification -->
<element name="bcf:extradatespec">
<oneOrMore>
<!-- Scope of extradate tracking - an ordered set of fields to try -->
<element name="bcf:scope">
<oneOrMore>
<!-- A field used to track extradate -->
<element name="bcf:field">
<attribute name="order">
<data type="integer"/>
</attribute>
<text/>
</element>
</oneOrMore>
</element>
</oneOrMore>
</element>
<oneOrMore>
<!-- Extradate specification -->
<element name="bcf:extradatespec">
<optional>
<attribute name="type">
<data type="string"/>
</attribute>
</optional>
<oneOrMore>
<!--
per-type?
Scope of extradate tracking - an ordered set of fields to try
-->
<element name="bcf:scope">
<oneOrMore>
<!-- A field used to track extradate -->
<element name="bcf:field">
<attribute name="order">
<data type="integer"/>
</attribute>
<text/>
</element>
</oneOrMore>
</element>
</oneOrMore>
</element>
</oneOrMore>
<!-- Cross-reference inheritance specifications -->
<element name="bcf:inheritance">
<!-- Defaults -->
Expand Down
20 changes: 10 additions & 10 deletions data/schemata/config.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ start =
empty
}+
}* &

# Annotation marker
element annotation_marker { text }? &
# Can't specify the config file location in the config file ...
# element configfile { text }? &
# element configfile { text }? &
element convert_control { "0" | "1" }? &
element dot_include { text }? &
# Data model specification (mainly for tool mode)
Expand Down Expand Up @@ -380,7 +380,7 @@ map =
}


labelalphanametemplate =
labelalphanametemplate =
element labelalphanametemplate {
attribute name { xsd:string }?,
element namepart {
Expand All @@ -393,13 +393,13 @@ labelalphanametemplate =
text
}+
}
labelalphatemplate =

labelalphatemplate =
element labelalphatemplate {
attribute type { xsd:string }?, # per-type?
element labelelement {
attribute order { xsd:integer },
element labelpart {
element labelpart {
attribute final { "0" | "1" }?,
attribute pad_char { xsd:string {minLength="1"}}?,
attribute pad_side { "left" | "right" }?,
Expand All @@ -417,7 +417,7 @@ labelalphatemplate =
}


uniquenametemplate =
uniquenametemplate =
element uniquenametemplate {
attribute name { xsd:string {minLength="1"} },
element namepart {
Expand All @@ -429,7 +429,7 @@ uniquenametemplate =
}+
}

namehashtemplate =
namehashtemplate =
element namehashtemplate {
attribute name { xsd:string {minLength="1"} },
element namepart {
Expand All @@ -439,7 +439,7 @@ namehashtemplate =
}+
}

sortingnamekeytemplate =
sortingnamekeytemplate =
element sortingnamekeytemplate {
attribute name { text },
attribute visibility { text },
Expand All @@ -455,7 +455,7 @@ sortingnamekeytemplate =
}+
}

sortingtemplate =
sortingtemplate =
element sortingtemplate {
# sorting template name
attribute name { xsd:string {minLength="1"}},
Expand Down
37 changes: 30 additions & 7 deletions lib/Biber.pm
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ sub parse_ctrlfile {
qr/\Acondition\z/,
qr/\Afilter(?:or)?\z/,
qr/\Aoptionscope\z/,
qr/\Aextradatespec\z/
],
'NsStrip' => 1,
'KeyAttr' => []);
Expand Down Expand Up @@ -667,15 +668,37 @@ sub parse_ctrlfile {
}

# EXTRADATE specification
my $ed;
foreach my $scope ($bcfxml->{extradatespec}->{scope}->@*) {
my $fields;
foreach my $field (sort {$a->{order} <=> $b->{order}} $scope->{field}->@*) {
push $fields->@*, $field->{content};
foreach my $eds ($bcfxml->{extradatespec}->@*) {
my $edtype = $eds->{type};
my $ed;
foreach my $scope ($eds->{scope}->@*) {
my $fields;
foreach my $field (sort {$a->{order} <=> $b->{order}} $scope->{field}->@*) {
push $fields->@*, $field->{content};
}
push $ed->@*, $fields;
}

if ($edtype eq 'global') {
Biber::Config->setblxoption(undef, 'extradatespec', $ed);
}
else {
Biber::Config->setblxoption(undef, 'extradatespec',
$ed,
'ENTRYTYPE',
$edtype);
}
push $ed->@*, $fields;
}
Biber::Config->setblxoption(undef, 'extradatespec', $ed);

# my $ed;
# foreach my $scope ($bcfxml->{extradatespec}->{scope}->@*) {
# my $fields;
# foreach my $field (sort {$a->{order} <=> $b->{order}} $scope->{field}->@*) {
# push $fields->@*, $field->{content};
# }
# push $ed->@*, $fields;
# }
# Biber::Config->setblxoption(undef, 'extradatespec', $ed);

# INHERITANCE schemes for crossreferences (always global)
Biber::Config->setblxoption(undef, 'inheritance', $bcfxml->{inheritance});
Expand Down
2 changes: 1 addition & 1 deletion lib/Biber/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ our @EXPORT = qw{

# Version of biblatex control file which this release expects. Matched against version
# passed in control file. Used when checking the .bcf
our $BCF_VERSION = '3.11';
our $BCF_VERSION = '3.12';
# Format version of the .bbl. Used when writing the .bbl
our $BBL_VERSION = '3.3';

Expand Down
5 changes: 3 additions & 2 deletions t/tdata/annotations.bcf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../data/bcf.xsl"?>
<?xml-model href="../../data/schemata/bcf.rnc" type="application/relax-ng-compact-syntax"?>
<bcf:controlfile version="3.11" bltxversion="3.20" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<bcf:controlfile version="3.12" bltxversion="3.21" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<!-- OPTIONS -->
<bcf:options component="biber" type="global">
<bcf:option type="singlevalued">
Expand Down Expand Up @@ -378,6 +378,7 @@
<bcf:option datatype="integer">dateeraauto</bcf:option>
</bcf:optionscope>
<bcf:optionscope type="ENTRYTYPE">
<bcf:option datatype="xml">extradatespec</bcf:option>
<bcf:option datatype="xml">extradatecontext</bcf:option>
<bcf:option datatype="string">alphaothers</bcf:option>
<bcf:option datatype="string">sortalphaothers</bcf:option>
Expand Down Expand Up @@ -590,7 +591,7 @@
</bcf:labelelement>
</bcf:labelalphatemplate>
<!-- EXTRADATE -->
<bcf:extradatespec>
<bcf:extradatespec type="global">
<bcf:scope>
<bcf:field order="1">labelyear</bcf:field>
<bcf:field order="2">year</bcf:field>
Expand Down
5 changes: 3 additions & 2 deletions t/tdata/basic-misc.bcf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../data/bcf.xsl"?>
<?xml-model href="../../data/schemata/bcf.rnc" type="application/relax-ng-compact-syntax"?>
<bcf:controlfile version="3.11" bltxversion="3.20" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<bcf:controlfile version="3.12" bltxversion="3.21" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<!-- OPTIONS -->
<bcf:options component="biber" type="global">
<bcf:option type="singlevalued">
Expand Down Expand Up @@ -384,6 +384,7 @@
<bcf:option datatype="integer">dateeraauto</bcf:option>
</bcf:optionscope>
<bcf:optionscope type="ENTRYTYPE">
<bcf:option datatype="xml">extradatespec</bcf:option>
<bcf:option datatype="xml">extradatecontext</bcf:option>
<bcf:option datatype="string">alphaothers</bcf:option>
<bcf:option datatype="string">sortalphaothers</bcf:option>
Expand Down Expand Up @@ -606,7 +607,7 @@
</bcf:labelelement>
</bcf:labelalphatemplate>
<!-- EXTRADATE -->
<bcf:extradatespec>
<bcf:extradatespec type="global">
<bcf:scope>
<bcf:field order="1">labelyear</bcf:field>
<bcf:field order="2">year</bcf:field>
Expand Down
5 changes: 3 additions & 2 deletions t/tdata/biblatexml.bcf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../data/bcf.xsl"?>
<?xml-model href="../../data/schemata/bcf.rnc" type="application/relax-ng-compact-syntax"?>
<bcf:controlfile version="3.11" bltxversion="3.20" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<bcf:controlfile version="3.12" bltxversion="3.21" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<!-- OPTIONS -->
<bcf:options component="biber" type="global">
<bcf:option type="singlevalued">
Expand Down Expand Up @@ -390,6 +390,7 @@
<bcf:option datatype="integer">dateeraauto</bcf:option>
</bcf:optionscope>
<bcf:optionscope type="ENTRYTYPE">
<bcf:option datatype="xml">extradatespec</bcf:option>
<bcf:option datatype="xml">extradatecontext</bcf:option>
<bcf:option datatype="string">alphaothers</bcf:option>
<bcf:option datatype="string">sortalphaothers</bcf:option>
Expand Down Expand Up @@ -623,7 +624,7 @@
</bcf:labelelement>
</bcf:labelalphatemplate>
<!-- EXTRADATE -->
<bcf:extradatespec>
<bcf:extradatespec type="global">
<bcf:scope>
<bcf:field order="1">labelyear</bcf:field>
<bcf:field order="2">year</bcf:field>
Expand Down
5 changes: 3 additions & 2 deletions t/tdata/bibtex-aliases.bcf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../data/bcf.xsl"?>
<?xml-model href="../../data/schemata/bcf.rnc" type="application/relax-ng-compact-syntax"?>
<bcf:controlfile version="3.11" bltxversion="3.20" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<bcf:controlfile version="3.12" bltxversion="3.21" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<!-- OPTIONS -->
<bcf:options component="biber" type="global">
<bcf:option type="singlevalued">
Expand Down Expand Up @@ -373,6 +373,7 @@
<bcf:option datatype="integer">dateeraauto</bcf:option>
</bcf:optionscope>
<bcf:optionscope type="ENTRYTYPE">
<bcf:option datatype="xml">extradatespec</bcf:option>
<bcf:option datatype="xml">extradatecontext</bcf:option>
<bcf:option datatype="string">alphaothers</bcf:option>
<bcf:option datatype="string">sortalphaothers</bcf:option>
Expand Down Expand Up @@ -649,7 +650,7 @@
</bcf:labelelement>
</bcf:labelalphatemplate>
<!-- EXTRADATE -->
<bcf:extradatespec>
<bcf:extradatespec type="global">
<bcf:scope>
<bcf:field order="1">labelyear</bcf:field>
<bcf:field order="2">year</bcf:field>
Expand Down
5 changes: 3 additions & 2 deletions t/tdata/bibtex-output.bcf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../data/bcf.xsl"?>
<?xml-model href="../../data/schemata/bcf.rnc" type="application/relax-ng-compact-syntax"?>
<bcf:controlfile version="3.11" bltxversion="3.20" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<bcf:controlfile version="3.12" bltxversion="3.21" xmlns:bcf="https://sourceforge.net/projects/biblatex">
<!-- OPTIONS -->
<bcf:options component="biber" type="global">
<bcf:option type="singlevalued">
Expand Down Expand Up @@ -377,6 +377,7 @@
<bcf:option datatype="integer">dateeraauto</bcf:option>
</bcf:optionscope>
<bcf:optionscope type="ENTRYTYPE">
<bcf:option datatype="xml">extradatespec</bcf:option>
<bcf:option datatype="xml">extradatecontext</bcf:option>
<bcf:option datatype="string">alphaothers</bcf:option>
<bcf:option datatype="string">sortalphaothers</bcf:option>
Expand Down Expand Up @@ -594,7 +595,7 @@
</bcf:labelelement>
</bcf:labelalphatemplate>
<!-- EXTRADATE -->
<bcf:extradatespec>
<bcf:extradatespec type="global">
<bcf:scope>
<bcf:field order="1">labelyear</bcf:field>
<bcf:field order="2">year</bcf:field>
Expand Down
Loading

0 comments on commit d5f3373

Please sign in to comment.