32 lines
1000 B
Ruby
Executable File
32 lines
1000 B
Ruby
Executable File
#!/usr/bin/env/ ruby
|
|
# frozen_string_literal: true
|
|
|
|
require 'open-uri'
|
|
|
|
def download(pad, tit)
|
|
clean(open("https://pad.programando.li/#{pad}/download").read, tit)
|
|
end
|
|
|
|
def clean(content, tit)
|
|
"\n#{content.gsub(/^---(\n|.)+?(\n# )/, '\2').gsub(/@\w+:t\w+/, tit)}"
|
|
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])
|
|
end
|
|
|
|
File.open('md/tesis.md', 'w') { |f| f.write "#{main.strip}\n" }
|