Skip to content

Combine WordPress blog posts

David-Apps edited this page Mar 24, 2024 · 2 revisions

This function combines a series of WordPress blog posts into a single buffer. Start the function on a blog post. The function stops when it cannot find a link to the next blog post.

# Combine WordPress blog posts.
# usage: <wpblog
function:wpblog {
db0
H-
sw+
e/temporary buffer for function wpblog to use
if(*) {
eret
p temporary buffer already exists
} else {
enew
f temporary buffer for function wpblog to use
M0
js-
ub
if(?) {
}
while(*) {
,s/\(>\)\(\t<\/header>.*\)/$1\n$2/gf
/<header class="entry-header">/f+X
.,/<\/header>/f-w/temporary buffer for function wpblog to use@$
/<div class="entry-content">/f+X
.,/<div id="atatags-/f-w/temporary buffer for function wpblog to use@$
if(?) {
.,/<div id="jp-post-flair"/f-w/temporary buffer for function wpblog to use@$
}
/<div id="comments"/f+X
if(*) {
.,/<div id="respond" class="comment-respond">/f-w/temporary buffer for function wpblog to use@$
}
,s/\(.\)\(<a \)/$1\n$2/gf
/<a .*rel="next">/f g-
}
e/temporary buffer for function wpblog to use
g/^\t*$/fd
g/<h2[^>]*>$/fj
# Some WordPress blogs use this id, so we remove each such id to avoid having the id more than once.
,s/<h2 id="comments-title">/<h2>/gf
bw
eret
enew
r/temporary buffer for function wpblog to use
q/temporary buffer for function wpblog to use
bw
}
}