aboutsummaryrefslogtreecommitdiff
path: root/md.bqn
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-09-13 15:25:08 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-09-13 15:25:08 -0400
commitd784a9cfb449b4dd9878713f6eb12a814142765f (patch)
tree642af30eb1c0c73234137fe37ddddecaff7c70fd /md.bqn
parent55dd46871b8b4d7e1fdd44fc819cc649edade6a8 (diff)
Add monadic «» to dzref
Diffstat (limited to 'md.bqn')
-rw-r--r--md.bqn20
1 files changed, 10 insertions, 10 deletions
diff --git a/md.bqn b/md.bqn
index 3fdd087e..8faaa830 100644
--- a/md.bqn
+++ b/md.bqn
@@ -45,7 +45,7 @@ CountRuns ← { (1+↕≠𝕩) (⊣ - ⌈`∘×) ¬𝕩 }
# is, preceded by an odd number of backslashes (since a backslash can
# escape another backslash).
IsEscaped ← {
- 0 » 2 | CountRuns 𝕩 = '\'
+ » 2 | CountRuns 𝕩 = '\'
}
# Remove leading (∧`) and trailing (∧`⌾⌽) spaces
@@ -220,7 +220,7 @@ Markdown ← {filename𝕊𝕩:
𝕩 ↓˜↩ 𝕨+1
trsp ← ∧`⌾⌽ 𝕩=' '
tail ← ∧`⌾⌽ trsp∨𝕩='#' # Mask of trailing hashes
- f ← tail < 0 « tail # Character before trailing hashes
+ f ← <⟜« tail # Character before trailing hashes
𝕩 /˜↩ ¬ f (⊑⟨"\"," ",""⟩⊐<f/𝕩)◶⟨⊣,⊢,⊢,0¨⊢⟩ tail
# Add an id, containing only a-z, digits, and hyphens
Slugify ← {
@@ -251,7 +251,7 @@ Markdown ← {filename𝕊𝕩:
CutTableRow ← {
b ← '|' = 𝕩 # Mask of bars
o ← (¬b) ≠○Lead ' '=𝕩 # Leading | omitted
- r ← b > 0 » '\' = 𝕩 # Non-escaped bars
+ r ← b > » '\' = 𝕩 # Non-escaped bars
1 -˜ (¬r∨1⌽b>r) × o + +` r
}
ProcTable ← {
@@ -311,12 +311,12 @@ Markdown ← {filename𝕊𝕩:
# Code spans
tick ← 𝕩 = '`'
- tend ← / (⊢ > 0⊸«) tick
+ tend ← / >⟜« tick
tcount ← CountRuns tick
# 𝕨 are tick lengths and 𝕩 are positions, both sorted by length
MatchTicks ← {
# Tick runs other than the last of each length
- notLast ← (⊢=0⊸«) 𝕨
+ notLast ← =⟜« 𝕨
# Ticks preceded by backslashes can't start code blocks, but can
# end them. This approach is wrong for multiple ticks with a
# leading backslash in front, which are excluded but should just
@@ -363,7 +363,7 @@ Markdown ← {filename𝕊𝕩:
# Emphasis (still rudimentary)
eMasks ← (unused ∧ 𝕩⊸=)¨ "*_"
- eMasks ↩ 0⊸«⊸∧¨⊸(⊣∾˜0⊸»⊸∨⊸<¨) eMasks
+ eMasks ↩ «⊸∧¨⊸(⊣∾˜»⊸∨⊸<¨) eMasks
eInds ← (⊢-2|⊢)∘≠⊸↑∘/¨ eMasks
include ∧↩ ¬ I2M ∧ ∾ eInds∾1+2↓eInds
eInds ∾↩ ⟨codeBounds⟩
@@ -507,7 +507,7 @@ GetHighlights ← {
le← /(𝕩=lf)∾1
# Line endings (le) end every comment (/c) on the line, so take a copy
# for each # before that line but not the previous.
- ce← le /˜ -⟜(0⊸») c/⊸⍋le
+ ce← le /˜ -⟜» c/⊸⍋le
# A single quote can only be used if there's another two places down.
s ← /0‿0⊸«⊸∧𝕩='''
d ← /𝕩='"'
@@ -527,9 +527,9 @@ GetHighlights ← {
# Color numeric literals and identifiers
id ← col=5 # ←→ 𝕩∊idChars
- w ← 0⊸»⊸< id # Word (identifier or number) beginning mask
+ w ← »⊸< id # Word (identifier or number) beginning mask
wt ← idChars FindGroup w/𝕩 # Type based on first character
- wt+↩ '_' = (0⊸«⊸<id)/𝕩 # Modifier1 to Modifier2 based on word end
+ wt+↩ '_' = («⊸<id)/𝕩 # Modifier1 to Modifier2 based on word end
wt+↩ 5×0=wt # Shift 0 to Number
wi ← 1-˜+`id/w # Index of word containing each of /id
col↩(wi⊏wt)⌾(id⊸/) col
@@ -547,7 +547,7 @@ GetHighlights ← {
# Return highlights for areas in 𝕩 where 𝕨 is true.
GetMultiHighlights ← {
- start ← 0⊸»⊸< 𝕨
+ start ← »⊸< 𝕨
groups ← (1 -˜ 𝕨 × +` start) ⊔ 𝕩
<∘∾˘ ⍉ ((≠∾2˙) ⥊ ·> (/start) {𝕨⊸+⌾(1⊸⊑)𝕩}⟜GetHighlights¨ ⊢) groups
}