34 lines
1.0 KiB
Ruby
34 lines
1.0 KiB
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
require 'open-uri'
|
||
|
|
||
|
def download(pad, tit)
|
||
|
clean(URI.open("https://pad.programando.li/#{pad}/download").read, tit)
|
||
|
end
|
||
|
|
||
|
def clean(content, tit)
|
||
|
content.gsub(/^---(\n|.)+?(\n# )/, '\2')
|
||
|
.gsub(/#\w+:\S+/, tit)
|
||
|
.gsub(/v#(\w+)/, '+++\1+++')
|
||
|
.gsub(/#(frances)/, '{.\1}')
|
||
|
end
|
||
|
|
||
|
pads = %w[jlCAkyqDST-5HG8tQVPpQA Fvf4kt6zSDiygthmIN-xSA
|
||
|
yic1NgzXRfqdEPnjtSHQFw 6Me0yOV0TluiGX-xuYnX-g
|
||
|
vG2T2khBTW60tAOErUtQMw wMhXyjhBTyW__RVD5oWncA
|
||
|
WnIO3M_nSYODaLiGGyd-Vw RuYyNvjeQ0WidMee7unIVQ
|
||
|
jQwG6o40Sm20EGsncIS23w]
|
||
|
tits = ['Agradecimientos', 'Lista de siglas y acrónimos',
|
||
|
'Introducción. Un tema filosófico desatendido', 'Teorías de la propiedad intelectual',
|
||
|
'Críticas de los bienes comunes', 'Puntos de encuentro. XXX',
|
||
|
'Conclusión. YYY', 'Glosario',
|
||
|
'Tareas pendientes']
|
||
|
main = ''
|
||
|
|
||
|
puts "Descargando pads…"
|
||
|
pads.each_with_index do |pad, i|
|
||
|
main += download(pad, tits[i]) + "\n"
|
||
|
end
|
||
|
|
||
|
File.open('md/tesis.md', 'w') { |f| f.write "#{main.strip}\n" }
|