- {/* Publication Metadata - only show for top-level publications */}
- {!isNested && (
-
-
-
-
- Publication
-
-
- {metadata.title ||
- (isBookstrEvent
- ? bookMetadata.book
- ? bookMetadata.book
- .split('-')
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
- .join(' ')
- : 'Bookstr Publication'
- : 'Untitled Publication')}
-
- {metadata.author && (
-
- by {metadata.author}
-
- )}
- {(metadata.type || metadata.version || metadata.publishedOn || metadata.publishedBy) && (
-
- {[
- metadata.type ? { label: 'Type', value: metadata.type } : null,
- metadata.version ? { label: 'Version', value: metadata.version } : null,
- metadata.publishedOn ? { label: 'Published', value: metadata.publishedOn } : null,
- metadata.publishedBy ? { label: 'Publisher', value: metadata.publishedBy } : null
- ]
- .filter((item): item is { label: string; value: string } => !!item)
- .map((item, index) => (
-
- {index > 0 && (
-
- ·
-
- )}
- {item.label}
- {item.value}
-
- ))}
-
- )}
- {metadata.tags.length > 0 && (
-
- {metadata.tags.map((tag) => (
-
- {tag}
-
- ))}
-
- )}
- {metadata.source && (
-
- )}
- {/* Display image for top-level 30040 publication */}
- {metadata.image && (
-
-
-
- )}
- {metadata.summary && (
-
-
- Summary
-
-
- {metadata.summary}
-
-
- )}
-
-
-
- {isBookstrEvent && (
- <>
- {bookMetadata.book && (
-
- Book: {bookMetadata.book
- .split('-')
- .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
- .join(' ')}
-
- )}
- {bookMetadata.chapter && (
-
- Chapter: {bookMetadata.chapter}
-
- )}
- {bookMetadata.verse && (
-
- Verse: {bookMetadata.verse}
-
- )}
- {bookMetadata.version && (
-
- Version: {bookMetadata.version.toUpperCase()}
-
- )}
- >
- )}
-
-
-
- )}
- {isNested && (showNestedImagePreview || showNestedSummaryPreview) && (
-
- {showNestedImagePreview && metadata.image && (
-
-
-
- )}
- {showNestedSummaryPreview && metadata.summary && (
-
- {metadata.summary}
-
- )}
-
- )}
-
- {/* Table of Contents - only show for top-level publications */}
- {!isNested && tableOfContents.length > 0 && (
-
-
Table of Contents
-
-
- )}
-
- {/* Failed sections banner */}
- {!isNested && failedKeys.length > 0 && referencesWithEvents.length > 0 && (
-
-
-
- {failedKeys.length} section{failedKeys.length !== 1 ? 's' : ''} failed to load.
-
-
-
-
- )}
-
- {/* Sections */}
- {referencesData.length === 0 ? (
-
- This publication index has no linked sections.
-
- ) : (
-
- {visibleReferences.map((ref, index) => {
- const sectionKey = publicationRefKey(ref)
- const coordinate = ref.coordinate || ref.eventId || ''
- const sectionId = `section-${coordinate.replace(/:/g, '-')}`
- const notesLink = publicationSectionNotesLink(ref)
-
- if (!ref.event) {
- if (ref.loadStatus === 'error') {
- return (
-
-
-
-
-
-
- )
- }
-
- return (
-
-
-
-
-
- )
- }
-
- const eventKind = ref.event?.kind ?? ref.kind ?? 0
- const effectiveParentImageUrl = !isNested ? metadata.image : parentImageUrl
- const sectionSummaryTag = ref.event.tags.find((tag) => tag[0] === 'summary')?.[1]
- const sectionImageTag = ref.event.tags.find((tag) => tag[0] === 'image')?.[1]
- const normalizedParentSummaryForSection = (effectiveParentSummary || '').trim()
- const normalizedSectionSummary = (sectionSummaryTag || '').trim()
- const normalizedParentImageForSection = (effectiveParentImageUrl || '').trim()
- const normalizedSectionImage = (sectionImageTag || '').trim()
- const showSectionSummaryPreview =
- !!normalizedSectionSummary &&
- normalizedSectionSummary !== normalizedParentSummaryForSection
- const showSectionImagePreview =
- !!normalizedSectionImage &&
- normalizedSectionImage !== normalizedParentImageForSection
-
- if (eventKind === ExtendedKind.PUBLICATION) {
- const publicationTitleTag = ref.event.tags.find((tag) => tag[0] === 'title')?.[1]
- const publicationDTag = ref.event.tags.find((tag) => tag[0] === 'd')?.[1]
- const publicationTitle = publicationTitleTag
- ? publicationTitleTag
- : publicationDTag
- ? formatBookstrTitle(publicationDTag, ref.event)
- : 'Publication'
- const publicationDepth = chapterDepth + 1
- const sectionTitleClassName =
- publicationDepth <= 1
- ? 'font-serif text-2xl md:text-3xl font-semibold leading-tight tracking-wide break-words'
- : publicationDepth === 2
- ? 'font-serif text-xl md:text-2xl font-medium leading-tight tracking-wide break-words text-muted-foreground'
- : 'font-serif text-lg md:text-xl font-medium leading-tight tracking-wide break-words text-muted-foreground'
- const useInlinePublicationHeader = forceFlatHierarchy
- const publicationContainerClassName = isNested
- ? forceFlatHierarchy
- ? 'scroll-mt-24 pt-6 relative'
- : 'border-l-4 border-primary pl-6 scroll-mt-24 pt-6 relative'
- : 'scroll-mt-24 pt-6 relative'
- return (
-
- {useInlinePublicationHeader ? (
-
-
-
- {!isNested && (
-
- )}
-
-
-
-
-
- Section
-
-
- {publicationTitle}
-
-
-
- ) : (
-
- {!isNested && (
-
- )}
-
-
- )}
-
-
- )
- }
-
- const renderAsAsciidoc =
- eventKind === ExtendedKind.PUBLICATION_CONTENT ||
- eventKind === ExtendedKind.WIKI_ARTICLE
-
- if (renderAsAsciidoc) {
- return (
-
-
- {!isNested && (
-
- )}
-
-
- {(showSectionImagePreview || showSectionSummaryPreview) && (
-
- {showSectionImagePreview && sectionImageTag && (
-
-
-
- )}
- {showSectionSummaryPreview && sectionSummaryTag && (
-
- {sectionSummaryTag}
-
- )}
-
- )}
-
-
- )
- }
-
- // All non-publication, non-AsciiDoc section kinds use markdown renderer.
- return (
-
-
- {!isNested && (
-
- )}
-
-
-
-
- )
- })}
- {sectionLoadCount < referencesWithEvents.length && (
-
- )}
-
- )}
- {isTopLevelPublication && resolvedPublicationFootnotesContainerId && (
-
- )}
-
- )
-}
-
-// ToC Item Component - renders nested table of contents items
-function ToCItemComponent({
- item,
- onItemClick,
- level
-}: {
- item: ToCItem
- onItemClick: (coordinate: string) => void
- level: number
-}) {
- const indentClass = level > 0 ? `ml-${level * 4}` : ''
-
- return (
-