pro-editor-schema 1.6.13-dev.3 → 1.6.14-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +187 -41
  2. package/dist/index.mjs +187 -41
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4698,6 +4698,182 @@ var validateReferenceMarkup = (reference, typeSchema) => {
4698
4698
  );
4699
4699
  };
4700
4700
 
4701
+ // src/validation/referenceBlockCopy.ts
4702
+ var BLOCK = "bibliomset";
4703
+ var BLOCK_TITLE_FIELDS = ["title", "containerTitle"];
4704
+ var BLOCK_NAMES = {
4705
+ part: "chapter",
4706
+ book: "book",
4707
+ article: "article",
4708
+ journal: "journal"
4709
+ };
4710
+ var capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
4711
+ var joinWords = (words, conjunction = "and") => words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} ${conjunction} ${words[words.length - 1]}`;
4712
+ var isBlockRelation = (value) => !!value && Object.prototype.hasOwnProperty.call(BLOCK_NAMES, value);
4713
+ var getRelation = (element) => {
4714
+ const relation = element?.getAttribute("relation");
4715
+ return isBlockRelation(relation) ? relation : void 0;
4716
+ };
4717
+ var getRelations = (blocks) => [
4718
+ ...new Set(
4719
+ blocks.map(getRelation).filter((relation) => !!relation)
4720
+ )
4721
+ ];
4722
+ var nameBlocks = (relations) => relations.length > 0 ? `${joinWords(relations.map((relation) => BLOCK_NAMES[relation]))} details` : "details";
4723
+ var getTitleLabel = ({ relation, typeSchema }) => {
4724
+ const index = typeSchema.bibliomsetRelations?.indexOf(relation) ?? -1;
4725
+ const field = BLOCK_TITLE_FIELDS[index];
4726
+ if (!field) return `${capitalize(BLOCK_NAMES[relation])} title`;
4727
+ return typeSchema.fieldLabels?.[field] ?? REFERENCE_FIELD_SCHEMAS[field].label;
4728
+ };
4729
+ var isWorkBlock = ({ relation, typeSchema }) => typeSchema.bibliomsetRelations?.indexOf(relation) === 0;
4730
+ var getUntitledBlockCopy = ({
4731
+ elements,
4732
+ typeSchema
4733
+ }) => {
4734
+ const relations = getRelations(elements);
4735
+ const [relation] = relations;
4736
+ const allKnown = elements.every((element) => getRelation(element));
4737
+ if (relations.length !== 1 || !relation || !allKnown) {
4738
+ return {
4739
+ title: "Titles missing from the details",
4740
+ description: `The ${allKnown ? nameBlocks(relations) : "details"} have no titles. Tag each title inside its details.`
4741
+ };
4742
+ }
4743
+ const name = BLOCK_NAMES[relation];
4744
+ const title = getTitleLabel({ relation, typeSchema }).toLowerCase();
4745
+ return {
4746
+ title: `${capitalize(title)} missing from the ${name} details`,
4747
+ description: `The ${name} details have no ${title}. Tag the ${title} inside them.`
4748
+ };
4749
+ };
4750
+ var getMissingBlockCopy = ({
4751
+ elements,
4752
+ typeSchema
4753
+ }) => {
4754
+ const relations = typeSchema.bibliomsetRelations ?? [];
4755
+ const present = new Set(
4756
+ getRelations(
4757
+ elements.flatMap(
4758
+ (reference) => Array.from(reference.querySelectorAll(BLOCK)).filter(
4759
+ isLiveReferenceContent
4760
+ )
4761
+ )
4762
+ )
4763
+ );
4764
+ const missing = relations.filter((relation) => !present.has(relation));
4765
+ const shown = missing.length > 0 ? missing : relations;
4766
+ const groups = shown.map((relation) => {
4767
+ const name = BLOCK_NAMES[relation];
4768
+ const contents = isWorkBlock({ relation, typeSchema }) ? `the ${name}'s title and authors` : `the ${name}'s title`;
4769
+ return `${contents} in the ${name} details`;
4770
+ });
4771
+ const titles = shown.map(
4772
+ (relation) => `the ${getTitleLabel({ relation, typeSchema }).toLowerCase()}`
4773
+ );
4774
+ return {
4775
+ title: `${capitalize(nameBlocks(shown))} missing`,
4776
+ description: `${typeSchema.label} references group ${groups.join(", and ")}. Tag ${joinWords(titles)} to create them.`
4777
+ };
4778
+ };
4779
+ var getRepeatedBlockCopy = ({
4780
+ elements
4781
+ }) => {
4782
+ const relations = getRelations(elements);
4783
+ const blocks = nameBlocks(relations);
4784
+ const repeatsPerRelation = elements.map(getRelation);
4785
+ const eachAppearsTwice = relations.every(
4786
+ (relation) => repeatsPerRelation.filter((repeat) => repeat === relation).length === 1
4787
+ );
4788
+ return {
4789
+ title: `${capitalize(blocks)} repeated`,
4790
+ description: eachAppearsTwice && repeatsPerRelation.every(Boolean) ? `The ${blocks} appear twice. Move what is in the second into the first.` : `The ${blocks} appear more than once. Move what is in each repeat into the first.`
4791
+ };
4792
+ };
4793
+ var getNestedBlockCopy = ({
4794
+ elements
4795
+ }) => {
4796
+ const pairs = [
4797
+ ...new Set(
4798
+ elements.map(
4799
+ (block) => `${getRelation(block)}|${getRelation(block.parentElement?.closest(BLOCK))}`
4800
+ )
4801
+ )
4802
+ ];
4803
+ const [inner, outer] = pairs.length === 1 ? pairs[0].split("|") : [];
4804
+ if (!isBlockRelation(inner) || !isBlockRelation(outer)) {
4805
+ return {
4806
+ title: "Details inside other details",
4807
+ description: "Move each one out so they sit side by side."
4808
+ };
4809
+ }
4810
+ return {
4811
+ title: `${capitalize(BLOCK_NAMES[inner])} details inside the ${BLOCK_NAMES[outer]} details`,
4812
+ description: `Move the ${BLOCK_NAMES[inner]} details out so the two sit side by side.`
4813
+ };
4814
+ };
4815
+ var getUnusedBlockCopy = ({
4816
+ elements,
4817
+ typeSchema
4818
+ }) => {
4819
+ const relations = typeSchema.bibliomsetRelations ?? [];
4820
+ const title = `${capitalize(nameBlocks(getRelations(elements)))} not used by ${typeSchema.label.toLowerCase()} references`;
4821
+ if (relations.length === 0) {
4822
+ return { title, description: "Remove the grouping and keep its contents." };
4823
+ }
4824
+ const used = relations.map(
4825
+ (relation) => `the ${BLOCK_NAMES[relation]} details`
4826
+ );
4827
+ return {
4828
+ title,
4829
+ description: `${typeSchema.label} references use ${joinWords(used)}. Change the grouping to one of them.`
4830
+ };
4831
+ };
4832
+ var getMisplacedFieldCopy = ({
4833
+ elements,
4834
+ typeSchema
4835
+ }) => {
4836
+ const typeRelations = typeSchema.bibliomsetRelations ?? [];
4837
+ const moves = [
4838
+ ...new Map(
4839
+ elements.flatMap((element) => {
4840
+ const field = findReferenceFieldByElement(element);
4841
+ const relation = getRelation(element.closest(BLOCK));
4842
+ const allowed = FIELD_BIBLIOMSETS[element.localName] ?? [];
4843
+ const usedByType = allowed.filter(
4844
+ (home) => typeRelations.includes(home)
4845
+ );
4846
+ const homes = usedByType.length > 0 ? usedByType : allowed;
4847
+ if (!field) return [];
4848
+ const label = REFERENCE_FIELD_SCHEMAS[field].label;
4849
+ const source = relation ? `the ${BLOCK_NAMES[relation]}` : "the wrong";
4850
+ return [
4851
+ [
4852
+ `${field}|${relation}`,
4853
+ {
4854
+ title: `${label} in ${source} details`,
4855
+ description: `Move the ${label.toLowerCase()} to the ${joinWords(
4856
+ homes.map((home) => BLOCK_NAMES[home]),
4857
+ "or"
4858
+ )} details.`
4859
+ }
4860
+ ]
4861
+ ];
4862
+ })
4863
+ ).values()
4864
+ ];
4865
+ const [move] = moves;
4866
+ if (moves.length === 1 && move) return move;
4867
+ return {
4868
+ title: "Fields in the wrong details",
4869
+ description: moves.map(({ description }) => description).join(" ") || "Move each field to the details it belongs in."
4870
+ };
4871
+ };
4872
+ var PART_EDITOR_COPY = {
4873
+ title: "Editor tagged in the chapter details",
4874
+ description: "The chapter details hold the chapter and its authors. Tag the name as an author, or move the editor to the book details."
4875
+ };
4876
+
4701
4877
  // src/validation/validateReferenceStructure.ts
4702
4878
  var getLiveReferenceFieldElements = (reference) => getReferenceFieldElements(reference).filter(
4703
4879
  ({ element }) => isLiveReferenceContent(element)
@@ -4775,11 +4951,7 @@ var getFieldLabel = (field, typeSchema) => {
4775
4951
  }
4776
4952
  return typeSchema.fieldLabels?.[field] ?? REFERENCE_FIELD_SCHEMAS[field].label;
4777
4953
  };
4778
- var getBibliomsetRelationCopy = (typeSchema) => {
4779
- const relations = typeSchema.bibliomsetRelations ?? [];
4780
- return relations.length > 0 ? `${typeSchema.label} references use bibliomset with the relation ${relations.join(" and ")}. Please correct the relation.` : `${typeSchema.label} references do not use bibliomset. Please remove it and keep its contents.`;
4781
- };
4782
- var getMarkupCopy = (rule, typeSchema) => {
4954
+ var getMarkupCopy = (rule, blockCopyParams) => {
4783
4955
  switch (rule) {
4784
4956
  case "missing_id":
4785
4957
  return {
@@ -4788,41 +4960,17 @@ var getMarkupCopy = (rule, typeSchema) => {
4788
4960
  description: "Every reference needs an xml:id. Please add one."
4789
4961
  };
4790
4962
  case "bibliomset_relation":
4791
- return {
4792
- title: "Wrong bibliomset for this reference type",
4793
- kind: "forbidden",
4794
- description: getBibliomsetRelationCopy(typeSchema)
4795
- };
4963
+ return { kind: "forbidden", ...getUnusedBlockCopy(blockCopyParams) };
4796
4964
  case "bibliomset_missing":
4797
- return {
4798
- title: "Bibliomset missing",
4799
- kind: "missing",
4800
- description: `${typeSchema.label} references need one bibliomset with the relation ${(typeSchema.bibliomsetRelations ?? []).join(" and one with ")}. Please wrap the details in them.`
4801
- };
4965
+ return { kind: "missing", ...getMissingBlockCopy(blockCopyParams) };
4802
4966
  case "bibliomset_repeated":
4803
- return {
4804
- title: "Bibliomset repeated",
4805
- kind: "forbidden",
4806
- description: "A reference holds one bibliomset of each relation. Please move the details of the repeated bibliomset into the first one."
4807
- };
4967
+ return { kind: "forbidden", ...getRepeatedBlockCopy(blockCopyParams) };
4808
4968
  case "bibliomset_title":
4809
- return {
4810
- title: "Bibliomset without a title",
4811
- kind: "missing",
4812
- description: "Every bibliomset must contain a title. Please move its title into it or remove the bibliomset."
4813
- };
4969
+ return { kind: "missing", ...getUntitledBlockCopy(blockCopyParams) };
4814
4970
  case "bibliomset_nested":
4815
- return {
4816
- title: "Bibliomset inside another bibliomset",
4817
- kind: "forbidden",
4818
- description: "A bibliomset cannot sit inside another bibliomset. Please move it out so the two sit side by side."
4819
- };
4971
+ return { kind: "forbidden", ...getNestedBlockCopy(blockCopyParams) };
4820
4972
  case "part_editor":
4821
- return {
4822
- title: "Editor tagged in the chapter part",
4823
- kind: "forbidden",
4824
- description: "The part bibliomset holds the chapter and its author. Please tag the name as an author or move the editor to the book bibliomset."
4825
- };
4973
+ return { kind: "forbidden", ...PART_EDITOR_COPY };
4826
4974
  case "personname_role":
4827
4975
  return {
4828
4976
  title: "Name order not set",
@@ -4842,11 +4990,7 @@ var getMarkupCopy = (rule, typeSchema) => {
4842
4990
  description: "An author, editor or credit holds one personname or orgname. Please tag each name as its own creator."
4843
4991
  };
4844
4992
  case "bibliomset_field":
4845
- return {
4846
- title: "Field in the wrong bibliomset",
4847
- kind: "forbidden",
4848
- description: "Volume and issue belong in the journal bibliomset, and pages in the book or journal bibliomset or after the bibliomsets. Please move the field."
4849
- };
4993
+ return { kind: "forbidden", ...getMisplacedFieldCopy(blockCopyParams) };
4850
4994
  case "bibliomisc_role":
4851
4995
  return {
4852
4996
  title: "Description type not set",
@@ -4910,7 +5054,9 @@ var getIssueCopy = (issue, typeSchema) => {
4910
5054
  };
4911
5055
  }
4912
5056
  const typeLabel = typeSchema.label.toLowerCase();
4913
- if (issue.code === "markup") return getMarkupCopy(issue.rule, typeSchema);
5057
+ if (issue.code === "markup") {
5058
+ return getMarkupCopy(issue.rule, { elements: issue.elements, typeSchema });
5059
+ }
4914
5060
  if (issue.code === "wrong_element") {
4915
5061
  return {
4916
5062
  title: `${issue.tag} not allowed`,
package/dist/index.mjs CHANGED
@@ -4572,6 +4572,182 @@ var validateReferenceMarkup = (reference, typeSchema) => {
4572
4572
  );
4573
4573
  };
4574
4574
 
4575
+ // src/validation/referenceBlockCopy.ts
4576
+ var BLOCK = "bibliomset";
4577
+ var BLOCK_TITLE_FIELDS = ["title", "containerTitle"];
4578
+ var BLOCK_NAMES = {
4579
+ part: "chapter",
4580
+ book: "book",
4581
+ article: "article",
4582
+ journal: "journal"
4583
+ };
4584
+ var capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
4585
+ var joinWords = (words, conjunction = "and") => words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} ${conjunction} ${words[words.length - 1]}`;
4586
+ var isBlockRelation = (value) => !!value && Object.prototype.hasOwnProperty.call(BLOCK_NAMES, value);
4587
+ var getRelation = (element) => {
4588
+ const relation = element?.getAttribute("relation");
4589
+ return isBlockRelation(relation) ? relation : void 0;
4590
+ };
4591
+ var getRelations = (blocks) => [
4592
+ ...new Set(
4593
+ blocks.map(getRelation).filter((relation) => !!relation)
4594
+ )
4595
+ ];
4596
+ var nameBlocks = (relations) => relations.length > 0 ? `${joinWords(relations.map((relation) => BLOCK_NAMES[relation]))} details` : "details";
4597
+ var getTitleLabel = ({ relation, typeSchema }) => {
4598
+ const index = typeSchema.bibliomsetRelations?.indexOf(relation) ?? -1;
4599
+ const field = BLOCK_TITLE_FIELDS[index];
4600
+ if (!field) return `${capitalize(BLOCK_NAMES[relation])} title`;
4601
+ return typeSchema.fieldLabels?.[field] ?? REFERENCE_FIELD_SCHEMAS[field].label;
4602
+ };
4603
+ var isWorkBlock = ({ relation, typeSchema }) => typeSchema.bibliomsetRelations?.indexOf(relation) === 0;
4604
+ var getUntitledBlockCopy = ({
4605
+ elements,
4606
+ typeSchema
4607
+ }) => {
4608
+ const relations = getRelations(elements);
4609
+ const [relation] = relations;
4610
+ const allKnown = elements.every((element) => getRelation(element));
4611
+ if (relations.length !== 1 || !relation || !allKnown) {
4612
+ return {
4613
+ title: "Titles missing from the details",
4614
+ description: `The ${allKnown ? nameBlocks(relations) : "details"} have no titles. Tag each title inside its details.`
4615
+ };
4616
+ }
4617
+ const name = BLOCK_NAMES[relation];
4618
+ const title = getTitleLabel({ relation, typeSchema }).toLowerCase();
4619
+ return {
4620
+ title: `${capitalize(title)} missing from the ${name} details`,
4621
+ description: `The ${name} details have no ${title}. Tag the ${title} inside them.`
4622
+ };
4623
+ };
4624
+ var getMissingBlockCopy = ({
4625
+ elements,
4626
+ typeSchema
4627
+ }) => {
4628
+ const relations = typeSchema.bibliomsetRelations ?? [];
4629
+ const present = new Set(
4630
+ getRelations(
4631
+ elements.flatMap(
4632
+ (reference) => Array.from(reference.querySelectorAll(BLOCK)).filter(
4633
+ isLiveReferenceContent
4634
+ )
4635
+ )
4636
+ )
4637
+ );
4638
+ const missing = relations.filter((relation) => !present.has(relation));
4639
+ const shown = missing.length > 0 ? missing : relations;
4640
+ const groups = shown.map((relation) => {
4641
+ const name = BLOCK_NAMES[relation];
4642
+ const contents = isWorkBlock({ relation, typeSchema }) ? `the ${name}'s title and authors` : `the ${name}'s title`;
4643
+ return `${contents} in the ${name} details`;
4644
+ });
4645
+ const titles = shown.map(
4646
+ (relation) => `the ${getTitleLabel({ relation, typeSchema }).toLowerCase()}`
4647
+ );
4648
+ return {
4649
+ title: `${capitalize(nameBlocks(shown))} missing`,
4650
+ description: `${typeSchema.label} references group ${groups.join(", and ")}. Tag ${joinWords(titles)} to create them.`
4651
+ };
4652
+ };
4653
+ var getRepeatedBlockCopy = ({
4654
+ elements
4655
+ }) => {
4656
+ const relations = getRelations(elements);
4657
+ const blocks = nameBlocks(relations);
4658
+ const repeatsPerRelation = elements.map(getRelation);
4659
+ const eachAppearsTwice = relations.every(
4660
+ (relation) => repeatsPerRelation.filter((repeat) => repeat === relation).length === 1
4661
+ );
4662
+ return {
4663
+ title: `${capitalize(blocks)} repeated`,
4664
+ description: eachAppearsTwice && repeatsPerRelation.every(Boolean) ? `The ${blocks} appear twice. Move what is in the second into the first.` : `The ${blocks} appear more than once. Move what is in each repeat into the first.`
4665
+ };
4666
+ };
4667
+ var getNestedBlockCopy = ({
4668
+ elements
4669
+ }) => {
4670
+ const pairs = [
4671
+ ...new Set(
4672
+ elements.map(
4673
+ (block) => `${getRelation(block)}|${getRelation(block.parentElement?.closest(BLOCK))}`
4674
+ )
4675
+ )
4676
+ ];
4677
+ const [inner, outer] = pairs.length === 1 ? pairs[0].split("|") : [];
4678
+ if (!isBlockRelation(inner) || !isBlockRelation(outer)) {
4679
+ return {
4680
+ title: "Details inside other details",
4681
+ description: "Move each one out so they sit side by side."
4682
+ };
4683
+ }
4684
+ return {
4685
+ title: `${capitalize(BLOCK_NAMES[inner])} details inside the ${BLOCK_NAMES[outer]} details`,
4686
+ description: `Move the ${BLOCK_NAMES[inner]} details out so the two sit side by side.`
4687
+ };
4688
+ };
4689
+ var getUnusedBlockCopy = ({
4690
+ elements,
4691
+ typeSchema
4692
+ }) => {
4693
+ const relations = typeSchema.bibliomsetRelations ?? [];
4694
+ const title = `${capitalize(nameBlocks(getRelations(elements)))} not used by ${typeSchema.label.toLowerCase()} references`;
4695
+ if (relations.length === 0) {
4696
+ return { title, description: "Remove the grouping and keep its contents." };
4697
+ }
4698
+ const used = relations.map(
4699
+ (relation) => `the ${BLOCK_NAMES[relation]} details`
4700
+ );
4701
+ return {
4702
+ title,
4703
+ description: `${typeSchema.label} references use ${joinWords(used)}. Change the grouping to one of them.`
4704
+ };
4705
+ };
4706
+ var getMisplacedFieldCopy = ({
4707
+ elements,
4708
+ typeSchema
4709
+ }) => {
4710
+ const typeRelations = typeSchema.bibliomsetRelations ?? [];
4711
+ const moves = [
4712
+ ...new Map(
4713
+ elements.flatMap((element) => {
4714
+ const field = findReferenceFieldByElement(element);
4715
+ const relation = getRelation(element.closest(BLOCK));
4716
+ const allowed = FIELD_BIBLIOMSETS[element.localName] ?? [];
4717
+ const usedByType = allowed.filter(
4718
+ (home) => typeRelations.includes(home)
4719
+ );
4720
+ const homes = usedByType.length > 0 ? usedByType : allowed;
4721
+ if (!field) return [];
4722
+ const label = REFERENCE_FIELD_SCHEMAS[field].label;
4723
+ const source = relation ? `the ${BLOCK_NAMES[relation]}` : "the wrong";
4724
+ return [
4725
+ [
4726
+ `${field}|${relation}`,
4727
+ {
4728
+ title: `${label} in ${source} details`,
4729
+ description: `Move the ${label.toLowerCase()} to the ${joinWords(
4730
+ homes.map((home) => BLOCK_NAMES[home]),
4731
+ "or"
4732
+ )} details.`
4733
+ }
4734
+ ]
4735
+ ];
4736
+ })
4737
+ ).values()
4738
+ ];
4739
+ const [move] = moves;
4740
+ if (moves.length === 1 && move) return move;
4741
+ return {
4742
+ title: "Fields in the wrong details",
4743
+ description: moves.map(({ description }) => description).join(" ") || "Move each field to the details it belongs in."
4744
+ };
4745
+ };
4746
+ var PART_EDITOR_COPY = {
4747
+ title: "Editor tagged in the chapter details",
4748
+ description: "The chapter details hold the chapter and its authors. Tag the name as an author, or move the editor to the book details."
4749
+ };
4750
+
4575
4751
  // src/validation/validateReferenceStructure.ts
4576
4752
  var getLiveReferenceFieldElements = (reference) => getReferenceFieldElements(reference).filter(
4577
4753
  ({ element }) => isLiveReferenceContent(element)
@@ -4649,11 +4825,7 @@ var getFieldLabel = (field, typeSchema) => {
4649
4825
  }
4650
4826
  return typeSchema.fieldLabels?.[field] ?? REFERENCE_FIELD_SCHEMAS[field].label;
4651
4827
  };
4652
- var getBibliomsetRelationCopy = (typeSchema) => {
4653
- const relations = typeSchema.bibliomsetRelations ?? [];
4654
- return relations.length > 0 ? `${typeSchema.label} references use bibliomset with the relation ${relations.join(" and ")}. Please correct the relation.` : `${typeSchema.label} references do not use bibliomset. Please remove it and keep its contents.`;
4655
- };
4656
- var getMarkupCopy = (rule, typeSchema) => {
4828
+ var getMarkupCopy = (rule, blockCopyParams) => {
4657
4829
  switch (rule) {
4658
4830
  case "missing_id":
4659
4831
  return {
@@ -4662,41 +4834,17 @@ var getMarkupCopy = (rule, typeSchema) => {
4662
4834
  description: "Every reference needs an xml:id. Please add one."
4663
4835
  };
4664
4836
  case "bibliomset_relation":
4665
- return {
4666
- title: "Wrong bibliomset for this reference type",
4667
- kind: "forbidden",
4668
- description: getBibliomsetRelationCopy(typeSchema)
4669
- };
4837
+ return { kind: "forbidden", ...getUnusedBlockCopy(blockCopyParams) };
4670
4838
  case "bibliomset_missing":
4671
- return {
4672
- title: "Bibliomset missing",
4673
- kind: "missing",
4674
- description: `${typeSchema.label} references need one bibliomset with the relation ${(typeSchema.bibliomsetRelations ?? []).join(" and one with ")}. Please wrap the details in them.`
4675
- };
4839
+ return { kind: "missing", ...getMissingBlockCopy(blockCopyParams) };
4676
4840
  case "bibliomset_repeated":
4677
- return {
4678
- title: "Bibliomset repeated",
4679
- kind: "forbidden",
4680
- description: "A reference holds one bibliomset of each relation. Please move the details of the repeated bibliomset into the first one."
4681
- };
4841
+ return { kind: "forbidden", ...getRepeatedBlockCopy(blockCopyParams) };
4682
4842
  case "bibliomset_title":
4683
- return {
4684
- title: "Bibliomset without a title",
4685
- kind: "missing",
4686
- description: "Every bibliomset must contain a title. Please move its title into it or remove the bibliomset."
4687
- };
4843
+ return { kind: "missing", ...getUntitledBlockCopy(blockCopyParams) };
4688
4844
  case "bibliomset_nested":
4689
- return {
4690
- title: "Bibliomset inside another bibliomset",
4691
- kind: "forbidden",
4692
- description: "A bibliomset cannot sit inside another bibliomset. Please move it out so the two sit side by side."
4693
- };
4845
+ return { kind: "forbidden", ...getNestedBlockCopy(blockCopyParams) };
4694
4846
  case "part_editor":
4695
- return {
4696
- title: "Editor tagged in the chapter part",
4697
- kind: "forbidden",
4698
- description: "The part bibliomset holds the chapter and its author. Please tag the name as an author or move the editor to the book bibliomset."
4699
- };
4847
+ return { kind: "forbidden", ...PART_EDITOR_COPY };
4700
4848
  case "personname_role":
4701
4849
  return {
4702
4850
  title: "Name order not set",
@@ -4716,11 +4864,7 @@ var getMarkupCopy = (rule, typeSchema) => {
4716
4864
  description: "An author, editor or credit holds one personname or orgname. Please tag each name as its own creator."
4717
4865
  };
4718
4866
  case "bibliomset_field":
4719
- return {
4720
- title: "Field in the wrong bibliomset",
4721
- kind: "forbidden",
4722
- description: "Volume and issue belong in the journal bibliomset, and pages in the book or journal bibliomset or after the bibliomsets. Please move the field."
4723
- };
4867
+ return { kind: "forbidden", ...getMisplacedFieldCopy(blockCopyParams) };
4724
4868
  case "bibliomisc_role":
4725
4869
  return {
4726
4870
  title: "Description type not set",
@@ -4784,7 +4928,9 @@ var getIssueCopy = (issue, typeSchema) => {
4784
4928
  };
4785
4929
  }
4786
4930
  const typeLabel = typeSchema.label.toLowerCase();
4787
- if (issue.code === "markup") return getMarkupCopy(issue.rule, typeSchema);
4931
+ if (issue.code === "markup") {
4932
+ return getMarkupCopy(issue.rule, { elements: issue.elements, typeSchema });
4933
+ }
4788
4934
  if (issue.code === "wrong_element") {
4789
4935
  return {
4790
4936
  title: `${issue.tag} not allowed`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pro-editor-schema",
3
- "version": "1.6.13-dev.3",
3
+ "version": "1.6.14-dev.0",
4
4
  "description": "Pro Editor XML schemas",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",