diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-10-26 10:44:34 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-10-26 10:44:34 -0400 |
| commit | ee31abb5cc18957debba369c33e9e388dd812a4b (patch) | |
| tree | 3612b41d8b801942536469078ae829330f58ed38 | |
| parent | 2e8804f153f7fdc3ec383752175af8a339f03243 (diff) | |
Better messages for validation in markdown conversion
| -rw-r--r-- | md.bqn | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -627,14 +627,14 @@ Fmt ← ⍕ _fmtm ConvertFile ← { MatchStart‿MatchEnd ← { ≤○≠◶0‿(⊣ ≡ (𝕩×≠)⊸↑) }¨ 1‿¯1 - # Input file 𝕩 should be markdown; output file is fileout - ! ".md" MatchEnd 𝕩 + ⟨"Input file ",𝕩," is not markdown (*.md)"⟩ ∾⊸! ".md" MatchEnd 𝕩 fileout ← ".html" ∾˜ (¯6⊸↓∾"index"˙)⍟("README"⊸MatchEnd) ¯3↓𝕩 # Contents of file to convert md ← •LNS 𝕩 # Verify and remove the html link line: the output *is* the html file. - ! ("*View this file"⊸MatchStart ∧ (siteURL∾fileout∾").*")⊸MatchEnd) ⊑md + IsView ← "*View this file"⊸MatchStart ∧ (siteURL∾fileout∾").*")⊸MatchEnd + ⟨"File ",𝕩," has missing or incorrect view link"⟩ ∾⊸! IsView ⊑md out ← 𝕩 Markdown 2↓md parts ← (1-˜·(¬×1++`)'/'⊸=)⊸⊔ (⊑⊐⟜".")⊸↑ 𝕩 @@ -642,10 +642,12 @@ ConvertFile ← { isInd ← "README" ≡ ¯1⊑parts RQ ← {'"'¨⌾(('''=𝕩)⊸/)𝕩} Link ← RQ {∾⟨"<link href='",root,𝕩,"' rel='",𝕨,"'/>"⟩} + h1 ← (2≤≠)◶0‿("# "≡2⊸↑)¨⊸/md + "Wrong number of titles in "‿𝕩 ∾⊸! 1=≠h1 head ← "head" Html lf∾JoinLines " "⊸∾¨⟨ "shortcut icon' type='image/x-icon" Link "favicon.ico" "stylesheet" Link "style.css" - "title" Html "BQN: " ∾⍟(¬·∨´"BQN"⍷⊢) 2↓⊑(2≤≠)◶0‿("# "≡2⊸↑)¨⊸/md + "title" Html "BQN: " ∾⍟(¬·∨´"BQN"⍷⊢) 2↓⊑h1 ⟩ repo ← "a href='"‿repoURL‿"'" ∾⊸Html "BQN" crumbs ← up ("a href='"∾∾⟜"index.html'")⊸Html¨○((-isInd)⊸↓) (<"main")»parts |
