Last active
August 29, 2015 13:55
-
-
Save mtrovilho/8752202 to your computer and use it in GitHub Desktop.
Create a list with links for all issues of The-Magazine.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'erb' | |
HTML_FILENAME = 'the-mag.html' | |
LATEST_ISSUE = 58 | |
template = %{ | |
<html> | |
<body> | |
<% LATEST_ISSUE.downto( 1 ) do |i| %> | |
<p> | |
Issue <%= i %>: | |
<a href="https://the-magazine.com/<%= i %>?epub">epub</a> | | |
<a href="https://the-magazine.com/<%= i %>?mobi">mobi</a> | | |
<a href="https://the-magazine.com/<%= i %>?send_epub">send epub</a> | | |
<a href="https://the-magazine.com/<%= i %>?send_mobi">send mobi</a> | |
</p> | |
<% end %> | |
</body> | |
</html> | |
} | |
erb = ERB.new( template ) | |
html = erb.result | |
File.open( HTML_FILENAME, 'w' ) do |f| | |
f.write( html ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment