Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions textbook-lib/src/components/TextbookPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ function renderContentWithComponents(content, textbookPath) {
console.log('textbookPath:', textbookPath);

// Look for component markers with optional props
const combinedRegex = /\{\{(ExamQuestions|VocabList|ConceptMap|YouTube|ExamBrowser|ProTip|AsAProfessor):([^}\s]+)([^}]*)\}\}/g;
const combinedRegex = /\{\{(ExamQuestions|VocabList|ConceptMap|YouTube|ExamBrowser|ProTip|AsAProfessor):([^}\s]+)([^}]*)\}\}/gi;

const parts = [];
let lastIndex = 0;
let match;

while ((match = combinedRegex.exec(content)) !== null) {
const componentType = match[1];
const componentType = match[1].toLowerCase();
const fileName = match[2];
const propsString = match[3] ? match[3].trim() : '';
console.log(`Found ${componentType} marker:`, match[0], 'File:', fileName, 'Props:', propsString);
Expand Down Expand Up @@ -156,7 +156,7 @@ function renderContentWithComponents(content, textbookPath) {
}

// Add the appropriate component
if (componentType === 'ExamQuestions') {
if (componentType === 'examquestions') {
parts.push(
<ExamQuestions
key={`eq-${parts.length}`}
Expand All @@ -165,7 +165,7 @@ function renderContentWithComponents(content, textbookPath) {
{...additionalProps}
/>
);
} else if (componentType === 'VocabList') {
} else if (componentType === 'vocablist') {
parts.push(
<VocabList
key={`vl-${parts.length}`}
Expand All @@ -174,7 +174,7 @@ function renderContentWithComponents(content, textbookPath) {
{...additionalProps}
/>
);
} else if (componentType === 'ConceptMap') {
} else if (componentType === 'conceptmap') {
console.log('Creating ConceptMap component with props:', { yamlPath: fileName, currentPath: textbookPath, ...additionalProps });
parts.push(
<ConceptMap
Expand All @@ -184,15 +184,15 @@ function renderContentWithComponents(content, textbookPath) {
{...additionalProps}
/>
);
} else if (componentType === 'YouTube') {
} else if (componentType === 'youtube') {
parts.push(
<YouTube
key={`yt-${parts.length}`}
url={fileName}
{...additionalProps}
/>
);
} else if (componentType === 'ExamBrowser') {
} else if (componentType === 'exambrowser') {
parts.push(
<ExamBrowser
key={`eb-${parts.length}`}
Expand All @@ -201,15 +201,15 @@ function renderContentWithComponents(content, textbookPath) {
{...additionalProps}
/>
);
} else if (componentType === 'ProTip') {
} else if (componentType === 'protip') {
parts.push(
<ProTip
key={`pt-${parts.length}`}
type={fileName}
{...additionalProps}
/>
);
} else if (componentType === 'AsAProfessor') {
} else if (componentType === 'asaprofessor') {
parts.push(
<AsAProfessor
key={`prof-${parts.length}`}
Expand Down