Skip to content

Commit

Permalink
relative paths fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren committed Dec 27, 2024
1 parent 32c4502 commit a15d848
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions script/node-export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@

text += "# " + node.title + "\n\n"

text += "by [#{node.author.username}](../../../profile/#{node.author.username}) | #{node.created_at.to_s(:long)}\n\n" if node.type == "note"
text += "by [#{node.author.username}](../../profile/#{node.author.username}) | #{node.created_at.to_s(:long)}\n\n" if node.type == "map"
text += "by [#{node.author.username}](/profile/#{node.author.username}) | #{node.created_at.to_s(:long)}\n\n" if node.type == "note"
text += "by [#{node.author.username}](/profile/#{node.author.username}) | #{node.created_at.to_s(:long)}\n\n" if node.type == "map"
if node.type == "page"
text += "by "
authors = []
node.authors.compact.collect(&:username).each do |username|
authors << "[#{username}](../profile/#{username})"
authors << "[#{username}](/profile/#{username})"
end
text += authors.join(', ') + "\n\n"
end
tags = []
node.tags.each do |tag|
tags << "[#{tag.name}](../tag/#{tag.name})"
tags << "[#{tag.name}](/tag/#{tag.name})"
end
text += "#{node.created_at.to_s(:long)} | Tags: #{tags.join(', ')}\n\n"
text += "----\n\n"
body = node.body.gsub(/(?<![\>`])(\<p\>)?\[activities\:(\S+)\]/, '[\2](../../tag/activity:\2)')
body = body.gsub(/(?<![\>`])(\<p\>)?\[questions\:(\S+)\]/, '[\2](../../tag/question:\2)')
body = body.gsub(/(?<![\>`])(\<p\>)?\[notes\:(\S+)\]/, '[\2](../../tag/\2)')
body = node.body.gsub(/(?<![\>`])(\<p\>)?\[activities\:(\S+)\]/, '[\2](/tag/activity:\2)')
body = body.gsub(/(?<![\>`])(\<p\>)?\[questions\:(\S+)\]/, '[\2](/tag/question:\2)')
body = body.gsub(/(?<![\>`])(\<p\>)?\[notes\:(\S+)\]/, '[\2](/tag/\2)')
text += body
file.write(text)
end
Expand Down

0 comments on commit a15d848

Please sign in to comment.