Skip to content

LEAN-5987 Contributors Bio Support - #362

Open
mbartenev-atypon wants to merge 11 commits into
masterfrom
LEAN-5987
Open

mbartenev-atypon wants to merge 11 commits into
masterfrom
LEAN-5987

Conversation

@mbartenev-atypon

@mbartenev-atypon mbartenev-atypon commented Sep 20, 2026

Copy link
Copy Markdown
Contributor
  1. Supporting bio inside of contributors.
  2. Minor refactoring: moving generic methods into a base class of JATS exporter to make it more oriented on specific nodes and to move all the rest of creators function into the scope of the class instead of const definition in the createSerializer method. This was also need to make createGraphic method available at the class scope for the bio creator.
  3. Removed obsolete "contents" attribute.

Copilot AI lite review requested due to automatic review settings September 20, 2026 10:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical schema and serialization issues, plus migration and importer correctness gaps, remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 2 Medium severity · 1 Low severity

Open (5)
What changed in this PR

Adds contributor biography support to the ProseMirror schema and JATS import/export paths while removing obsolete attributes.

Changes:

  • Adds and registers the bio node.
  • Allows optional biographies on contributors.
  • Adds JATS bio parsing and serialization mappings.
  • Removes obsolete contents attributes.
File Review summary
src/​schema/​types.ts No final comments.
src/​schema/​nodes/​keywords_element.ts Nit (1 vote): stale contents type/parser field remains.
src/​schema/​nodes/​contributor.ts Critical (3 votes): add migration for legacy content. Nit (1 vote): update the importer snapshot and add bio coverage.
src/​schema/​nodes/​bio.ts Critical (3 votes): missing content hole drops children. Moderate (1 vote): content expression cannot represent multiple JATS bio paragraphs.
src/​schema/​nodes/​bibliography_element.ts No final comments.
src/​schema/​index.ts No final comments.
src/​jats/​importer/​jats-dom-parser.ts Moderate (1 vote): unscoped rule mishandles standalone bios. Moderate (2 votes): bio IDs are not preserved. Nit (2 votes): add contributor-bio round-trip coverage.
src/​jats/​exporter/​jats-exporter.ts Moderate (2 votes): contributor serialization omits nested bios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/schema/nodes/bio.ts
Comment thread src/schema/nodes/contributor.ts
Comment thread src/jats/exporter/jats-exporter.ts
Comment thread src/jats/importer/jats-dom-parser.ts
Comment thread src/jats/importer/jats-dom-parser.ts
// This is a manual builder that is need only if we need to use this.writeParagraph() to strip rich text
// The editor will not allow rich text but if any imported - it will be stripped (can it be imported though)?
//
// private buildBioElement = (bio?: BioNode) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is commented to make a decision on how we want to proceed with exports. If we want to stick with paragraphs stripped off of the rich text, then we need to use this instead of standard serialization approach that I've opted in for.

})
})

// This will be used instead of this.serializeNode(bio) if paragraphs need rich-text stripping

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to proceed with paragraphs stripped off of the rich-text - we need to use this commented implementation instead of the currently active one.


export const contributor: NodeSpec = {
content: 'inline*',
content: 'bio?',

@mbartenev-atypon mbartenev-atypon Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that despite the fact we normally go for attributes whenever we need to add to contributors, here I went for children because:

  1. Internal nodes to it are already present in the schema and serialization and parsing for them is provided (paragraph, alt-text, image_element)
  2. The bio is a nested xml structure and reconstruction and storing in attributes will be a bit clumsy.
  3. If we will ever need to manage more complex content or rich-text in that structure we will have to overhaul attributes anyway into nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants