Browse Source

change the book:: default to book

imwald
Silberengel 3 months ago
parent
commit
31056c816e
  1. 8
      src/components/Bookstr/BookstrContent.tsx
  2. 4
      src/lib/bookstr-parser.ts

8
src/components/Bookstr/BookstrContent.tsx

@ -244,7 +244,7 @@ export function BookstrContent({ wikilink, sourceUrl, className, skipWebPreview
const result = parseBookWikilink(wikilinkToParse) const result = parseBookWikilink(wikilinkToParse)
if (result) { if (result) {
const inferredBookType = result.bookType || 'bible' const inferredBookType = result.bookType || 'book'
const parsedResult = { ...result, bookType: inferredBookType } const parsedResult = { ...result, bookType: inferredBookType }
// Only log if this is a new parse (not a re-render with same wikilink) // Only log if this is a new parse (not a re-render with same wikilink)
@ -399,7 +399,7 @@ export function BookstrContent({ wikilink, sourceUrl, className, skipWebPreview
const newSections: BookSection[] = [] const newSections: BookSection[] = []
// Step 1: Check cache for ALL references first (in parallel) // Step 1: Check cache for ALL references first (in parallel)
const bookType = (parsed as any).bookType || 'bible' const bookType = (parsed as any).bookType || 'book'
const cacheChecks = parsed.references.map(async (ref) => { const cacheChecks = parsed.references.map(async (ref) => {
const normalizedBook = ref.book.toLowerCase().replace(/\s+/g, '-') const normalizedBook = ref.book.toLowerCase().replace(/\s+/g, '-')
const versionsToFetch = parsed.versions || (ref.version ? [ref.version] : []) const versionsToFetch = parsed.versions || (ref.version ? [ref.version] : [])
@ -979,8 +979,8 @@ export function BookstrContent({ wikilink, sourceUrl, className, skipWebPreview
{/* External URL preview/button for bible/torah/quran */} {/* External URL preview/button for bible/torah/quran */}
{(() => { {(() => {
// Get bookType from parsed wikilink (defaults to 'bible') // Get bookType from parsed wikilink (defaults to 'book')
const bookType = parsed?.bookType || 'bible' const bookType = parsed?.bookType || 'book'
// Only show external link for bible, torah, or quran collections // Only show external link for bible, torah, or quran collections
// Other collections (secular books) don't have external links // Other collections (secular books) don't have external links

4
src/lib/bookstr-parser.ts

@ -125,8 +125,8 @@ export function parseBookWikilink(wikilink: string): { references: BookReference
} }
// Use collection as bookType (e.g., "bible", "quran", "torah") // Use collection as bookType (e.g., "bible", "quran", "torah")
// If no collection, default to "bible" // If no collection, default to "book"
const inferredBookType = collection || 'bible' const inferredBookType = collection || 'book'
return { references, versions, bookType: inferredBookType } return { references, versions, bookType: inferredBookType }
} }

Loading…
Cancel
Save