Dmerge acts only on md, org, and txt files now

This commit is contained in:
Levi Neely 2025-11-29 12:43:04 +01:00
parent ddfa86148b
commit c2f17beff5
1 changed files with 17 additions and 1 deletions

View File

@ -80,6 +80,16 @@ if(~ $mode file) {
exit 1
}
# Verify file extensions
if(! ~ $srcpath *.md *.org *.txt) {
echo 'error: source must be .md, .org, or .txt file' >[1=2]
exit 1
}
if(! ~ $dstpath *.md *.org *.txt) {
echo 'error: destination must be .md, .org, or .txt file' >[1=2]
exit 1
}
# Extract content without frontmatter (everything after first blank line)
awk '
BEGIN { found_blank = 0 }
@ -103,7 +113,7 @@ if(~ $mode file) {
rm /tmp/content.$pid
# Update all backlinks pointing to source
9p read denote/n/$src/backlinks | awk -F'|' '{print $1}' | while(read linkid) {
for(linkid in `{9p read denote/n/$src/backlinks | awk -F'|' '{print $1}'}) {
linkid=`{echo $linkid | awk '{gsub(/^ +| +$/, ""); print}'}
if(! ~ $#linkid 0) {
linkpath=`{9p read denote/n/$linkid/path}
@ -137,6 +147,12 @@ if not if(~ $mode region) {
exit 1
}
# Verify file extension
if(! ~ $dstpath *.md *.org *.txt) {
echo 'error: destination must be .md, .org, or .txt file' >[1=2]
exit 1
}
# Apply formatting to selection
switch($format) {
case plain