Skip to content

Commit 66e778a

Browse files
committed
Deploy preview for PR 37 🛫
1 parent 2a29c3a commit 66e778a

5 files changed

Lines changed: 110 additions & 91 deletions

File tree

pr-preview/pr-37/auth-check.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22
(function() {
33
const SESSION_KEY = 'disasters_docs_auth';
44

5+
// Get the base path for the current page
6+
function getBasePath() {
7+
const path = window.location.pathname;
8+
// Extract base directory from current path
9+
const parts = path.split('/').filter(p => p);
10+
// Find the index.html or last segment
11+
const fileIndex = parts.findIndex(p => p.endsWith('.html'));
12+
if (fileIndex > 0) {
13+
return '/' + parts.slice(0, fileIndex).join('/') + '/';
14+
}
15+
// Default: go to root of disasters-docs
16+
return '/disasters-docs/';
17+
}
18+
19+
function getLoginPage() {
20+
const basePath = getBasePath();
21+
return basePath + 'password-protect.html';
22+
}
23+
524
function checkAuth() {
625
// Skip authentication on localhost (for development)
726
if (window.location.hostname === 'localhost' ||
@@ -20,7 +39,7 @@
2039

2140
if (!auth) {
2241
// No authentication, redirect to login
23-
window.location.href = '/disasters-docs/password-protect.html';
42+
window.location.href = getLoginPage();
2443
return;
2544
}
2645

@@ -31,15 +50,15 @@
3150
if (authData.expires <= now || !authData.authenticated) {
3251
// Expired or invalid session
3352
localStorage.removeItem(SESSION_KEY);
34-
window.location.href = '/disasters-docs/password-protect.html';
53+
window.location.href = getLoginPage();
3554
return;
3655
}
3756

3857
// Valid session - allow page to load
3958
} catch (e) {
4059
// Invalid auth data
4160
localStorage.removeItem(SESSION_KEY);
42-
window.location.href = '/disasters-docs/password-protect.html';
61+
window.location.href = getLoginPage();
4362
}
4463
}
4564

@@ -57,7 +76,7 @@
5776
logoutBtn.style.cssText = 'position: fixed; top: 10px; right: 10px; padding: 8px 16px; background: #e74c3c; color: white; border: none; border-radius: 5px; cursor: pointer; z-index: 9999; font-size: 14px;';
5877
logoutBtn.onclick = function() {
5978
localStorage.removeItem(SESSION_KEY);
60-
window.location.href = '/disasters-docs/password-protect.html';
79+
window.location.href = getLoginPage();
6180
};
6281
document.body.appendChild(logoutBtn);
6382
}

pr-preview/pr-37/quarto-guide.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ <h4 class="anchored" data-anchor-id="qmd-files-quarto-markdown">.qmd Files (Quar
731731
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a></span>
732732
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>This is a Quarto document with **markdown** formatting.</span>
733733
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a></span>
734-
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a>::: {#93c2380b .cell execution_count=1}</span>
734+
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a>::: {#60f7ed55 .cell execution_count=1}</span>
735735
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="in">``` {.python .cell-code}</span></span>
736736
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="co"># You can include code</span></span>
737737
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(<span class="st">"Hello from Python!"</span>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
@@ -975,7 +975,7 @@ <h3 class="anchored" data-anchor-id="code-blocks">Code Blocks</h3>
975975
<h3 class="anchored" data-anchor-id="executable-vs.-non-executable-code">Executable vs.&nbsp;Non-Executable Code</h3>
976976
<p>By default, code blocks in <code>.qmd</code> files are <strong>executable</strong>. To display code without running:</p>
977977
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb18"><pre class="sourceCode markdown code-with-copy"><code class="sourceCode markdown"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a></span>
978-
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a>::: {#44609943 .cell execution_count=2}</span>
978+
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a>::: {#b8036479 .cell execution_count=2}</span>
979979
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a><span class="in">``` {.python .cell-code}</span></span>
980980
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a><span class="co"># This code is shown but not executed</span></span>
981981
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
@@ -1263,7 +1263,7 @@ <h3 class="anchored" data-anchor-id="issue-code-not-executing">Issue: Code not e
12631263
<p><strong>Solution:</strong> Check code block syntax</p>
12641264
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb35"><pre class="sourceCode markdown code-with-copy"><code class="sourceCode markdown"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a><span class="fu"># Correct (with braces)</span></span>
12651265
<span id="cb35-2"><a href="#cb35-2" aria-hidden="true" tabindex="-1"></a></span>
1266-
<span id="cb35-3"><a href="#cb35-3" aria-hidden="true" tabindex="-1"></a>::: {#c36839d6 .cell execution_count=3}</span>
1266+
<span id="cb35-3"><a href="#cb35-3" aria-hidden="true" tabindex="-1"></a>::: {#b25c7701 .cell execution_count=3}</span>
12671267
<span id="cb35-4"><a href="#cb35-4" aria-hidden="true" tabindex="-1"></a><span class="in">``` {.python .cell-code}</span></span>
12681268
<span id="cb35-5"><a href="#cb35-5" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(<span class="st">"Hello"</span>)</span>
12691269
<span id="cb35-6"><a href="#cb35-6" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>

pr-preview/pr-37/search.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,7 +2427,7 @@
24272427
"href": "quarto-guide.html#file-types-and-formats",
24282428
"title": "Quarto Guide for Beginners",
24292429
"section": "File Types and Formats",
2430-
"text": "File Types and Formats\n\nSource Files\n\n.qmd Files (Quarto Markdown)\nThe primary file type for Quarto documents:\n---\ntitle: \"My Document\"\nformat: html\n---\n\n## Introduction\n\nThis is a Quarto document with **markdown** formatting.\n\n::: {#93c2380b .cell execution_count=1}\n``` {.python .cell-code}\n# You can include code\nprint(\"Hello from Python!\")\n\nHello from Python!\n\n:::\n\n#### .ipynb Files (Jupyter Notebooks)\n\nQuarto can directly render Jupyter notebooks:\n\n- Keep your existing notebook workflow\n- Add Quarto features through cell metadata\n- Render notebooks to any format\n\n#### .md Files (Plain Markdown)\n\nStandard Markdown files can be rendered by Quarto, though they lack code execution capabilities.\n\n### Output Formats\n\nQuarto can generate:\n\n| Format | Extension | Use Case |\n|--------|-----------|----------|\n| HTML | .html | Websites, interactive documents |\n| PDF | .pdf | Print publications, reports |\n| Word | .docx | Microsoft Word documents |\n| PowerPoint | .pptx | Presentations |\n| Reveal.js | .html | Interactive HTML presentations |\n| EPUB | .epub | E-books |\n| Markdown | .md | GitHub, other platforms |\n\n## Creating Different Types of Documents\n\n### Basic Document\n\nSimplest Quarto document:\n\n```yaml\n---\ntitle: \"My First Document\"\nauthor: \"Your Name\"\ndate: today\nformat: html\n---\n\n## Section 1\n\nContent goes here.\n\n\n\nMulti-Format Document\nOutput to multiple formats:\n---\ntitle: \"Multi-Format Document\"\nformat:\n html:\n toc: true\n code-fold: true\n pdf:\n documentclass: article\n docx:\n reference-doc: template.docx\n---\n\n\nPresentation (PowerPoint)\n---\ntitle: \"My Presentation\"\nformat:\n pptx:\n slide-level: 2\n---\n\n# Section Title\n\n## Slide 1\n\n- First point\n- Second point\n\n## Slide 2\n\nMore content here.\nImportant: Level 1 headers (#) create section dividers, Level 2 headers (##) create new slides.\n\n\nPresentation (Reveal.js)\n---\ntitle: \"Interactive Presentation\"\nformat:\n revealjs:\n theme: dark\n transition: slide\n---\n\n\nWebsite/Book\nRequires a _quarto.yml configuration file (covered below).",
2430+
"text": "File Types and Formats\n\nSource Files\n\n.qmd Files (Quarto Markdown)\nThe primary file type for Quarto documents:\n---\ntitle: \"My Document\"\nformat: html\n---\n\n## Introduction\n\nThis is a Quarto document with **markdown** formatting.\n\n::: {#60f7ed55 .cell execution_count=1}\n``` {.python .cell-code}\n# You can include code\nprint(\"Hello from Python!\")\n\nHello from Python!\n\n:::\n\n#### .ipynb Files (Jupyter Notebooks)\n\nQuarto can directly render Jupyter notebooks:\n\n- Keep your existing notebook workflow\n- Add Quarto features through cell metadata\n- Render notebooks to any format\n\n#### .md Files (Plain Markdown)\n\nStandard Markdown files can be rendered by Quarto, though they lack code execution capabilities.\n\n### Output Formats\n\nQuarto can generate:\n\n| Format | Extension | Use Case |\n|--------|-----------|----------|\n| HTML | .html | Websites, interactive documents |\n| PDF | .pdf | Print publications, reports |\n| Word | .docx | Microsoft Word documents |\n| PowerPoint | .pptx | Presentations |\n| Reveal.js | .html | Interactive HTML presentations |\n| EPUB | .epub | E-books |\n| Markdown | .md | GitHub, other platforms |\n\n## Creating Different Types of Documents\n\n### Basic Document\n\nSimplest Quarto document:\n\n```yaml\n---\ntitle: \"My First Document\"\nauthor: \"Your Name\"\ndate: today\nformat: html\n---\n\n## Section 1\n\nContent goes here.\n\n\n\nMulti-Format Document\nOutput to multiple formats:\n---\ntitle: \"Multi-Format Document\"\nformat:\n html:\n toc: true\n code-fold: true\n pdf:\n documentclass: article\n docx:\n reference-doc: template.docx\n---\n\n\nPresentation (PowerPoint)\n---\ntitle: \"My Presentation\"\nformat:\n pptx:\n slide-level: 2\n---\n\n# Section Title\n\n## Slide 1\n\n- First point\n- Second point\n\n## Slide 2\n\nMore content here.\nImportant: Level 1 headers (#) create section dividers, Level 2 headers (##) create new slides.\n\n\nPresentation (Reveal.js)\n---\ntitle: \"Interactive Presentation\"\nformat:\n revealjs:\n theme: dark\n transition: slide\n---\n\n\nWebsite/Book\nRequires a _quarto.yml configuration file (covered below).",
24312431
"crumbs": [
24322432
"Documentation",
24332433
"Quarto Guide for Beginners"
@@ -2460,7 +2460,7 @@
24602460
"href": "quarto-guide.html#working-with-code",
24612461
"title": "Quarto Guide for Beginners",
24622462
"section": "Working with Code",
2463-
"text": "Working with Code\n\nCode Blocks\n```python\n# Python code\nimport pandas as pd\ndata = pd.read_csv('file.csv')\nprint(data.head())\n```\n\n\nExecutable vs. Non-Executable Code\nBy default, code blocks in .qmd files are executable. To display code without running:\n\n::: {#44609943 .cell execution_count=2}\n``` {.python .cell-code}\n# This code is shown but not executed\n```\n:::\n\n\n\nInline Code\nExecute code inline: 4\nOutput: 4\n\n\nCode Options\n#| echo: false # Hide code, show output\n#| eval: false # Show code, don't run\n#| warning: false # Hide warnings\n#| message: false # Hide messages\n#| label: fig-plot # For cross-references\n#| fig-cap: \"Caption\" # Figure caption",
2463+
"text": "Working with Code\n\nCode Blocks\n```python\n# Python code\nimport pandas as pd\ndata = pd.read_csv('file.csv')\nprint(data.head())\n```\n\n\nExecutable vs. Non-Executable Code\nBy default, code blocks in .qmd files are executable. To display code without running:\n\n::: {#b8036479 .cell execution_count=2}\n``` {.python .cell-code}\n# This code is shown but not executed\n```\n:::\n\n\n\nInline Code\nExecute code inline: 4\nOutput: 4\n\n\nCode Options\n#| echo: false # Hide code, show output\n#| eval: false # Show code, don't run\n#| warning: false # Hide warnings\n#| message: false # Hide messages\n#| label: fig-plot # For cross-references\n#| fig-cap: \"Caption\" # Figure caption",
24642464
"crumbs": [
24652465
"Documentation",
24662466
"Quarto Guide for Beginners"
@@ -2526,7 +2526,7 @@
25262526
"href": "quarto-guide.html#common-issues-and-solutions",
25272527
"title": "Quarto Guide for Beginners",
25282528
"section": "Common Issues and Solutions",
2529-
"text": "Common Issues and Solutions\n\nIssue: “File not found”\nProblem: Referenced image or data file not found\nSolution: Use relative paths from the .qmd file location\n# Good\n![Logo](images/logo.png)\n\n# Bad (absolute paths break portability)\n![Logo](/Users/name/project/images/logo.png)\n\n\nIssue: Code not executing\nProblem: Code block shown but not running\nSolution: Check code block syntax\n# Correct (with braces)\n\n::: {#c36839d6 .cell execution_count=3}\n``` {.python .cell-code}\nprint(\"Hello\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nHello\n```\n:::\n:::\n\n\n# Wrong (no braces - just displays)\n```python\nprint(\"Hello\")\n```\n\n\nIssue: Links not working in rendered site\nProblem: Cross-references broken after rendering\nSolution: Use .qmd extension in links - Quarto converts automatically\n# Correct\n[See guide](guide.qmd)\n\n# Incorrect\n[See guide](guide.html)\n\n\nIssue: Changes not showing\nProblem: Made changes but don’t see them in preview\nSolution: - Refresh browser (hard refresh: Cmd+Shift+R or Ctrl+Shift+R) - Stop and restart quarto preview - Check if file is saved\n\n\nIssue: Table of contents not showing\nProblem: TOC enabled but not visible\nSolution: Need at least 2 headers for TOC to appear\n---\nformat:\n html:\n toc: true\n---\n\n## First Section\nContent\n\n## Second Section\nMore content",
2529+
"text": "Common Issues and Solutions\n\nIssue: “File not found”\nProblem: Referenced image or data file not found\nSolution: Use relative paths from the .qmd file location\n# Good\n![Logo](images/logo.png)\n\n# Bad (absolute paths break portability)\n![Logo](/Users/name/project/images/logo.png)\n\n\nIssue: Code not executing\nProblem: Code block shown but not running\nSolution: Check code block syntax\n# Correct (with braces)\n\n::: {#b25c7701 .cell execution_count=3}\n``` {.python .cell-code}\nprint(\"Hello\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nHello\n```\n:::\n:::\n\n\n# Wrong (no braces - just displays)\n```python\nprint(\"Hello\")\n```\n\n\nIssue: Links not working in rendered site\nProblem: Cross-references broken after rendering\nSolution: Use .qmd extension in links - Quarto converts automatically\n# Correct\n[See guide](guide.qmd)\n\n# Incorrect\n[See guide](guide.html)\n\n\nIssue: Changes not showing\nProblem: Made changes but don’t see them in preview\nSolution: - Refresh browser (hard refresh: Cmd+Shift+R or Ctrl+Shift+R) - Stop and restart quarto preview - Check if file is saved\n\n\nIssue: Table of contents not showing\nProblem: TOC enabled but not visible\nSolution: Need at least 2 headers for TOC to appear\n---\nformat:\n html:\n toc: true\n---\n\n## First Section\nContent\n\n## Second Section\nMore content",
25302530
"crumbs": [
25312531
"Documentation",
25322532
"Quarto Guide for Beginners"

0 commit comments

Comments
 (0)