Skip to content

Instantly share code, notes, and snippets.

@inukshuk inukshuk/expand.rb
Created May 6, 2014

Embed
What would you like to do?
Page Range Expander
#!/usr/bin/env ruby
require 'csl/styles'
require 'citeproc/ruby'
r = CiteProc::Ruby::Renderer.new
while input = gets
puts r.format_page_range input, 'expanded'
end
@inukshuk

This comment has been minimized.

Copy link
Owner Author

commented May 6, 2014

Use it interactively:

$ ./expand_page_ranges.rb
2313-34
2313–2334
13-4
13–14

Or by using a pipe (each page range on a new line): ./expand.rb < page_ranges.txt > expanded_page_ranges.txt

@inukshuk

This comment has been minimized.

Copy link
Owner Author

commented May 6, 2014

For the script to work, you need to install the gems csl-styles and citeproc-ruby first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.