Skip to content

Instantly share code, notes, and snippets.

@maehrm
Created March 24, 2019 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maehrm/bc91a9b5e7ba9181e11cfd06f28b4408 to your computer and use it in GitHub Desktop.
Save maehrm/bc91a9b5e7ba9181e11cfd06f28b4408 to your computer and use it in GitHub Desktop.
平成20年度春期試験_基本情報午後問6(Ruby)
def markup_reference in_filename, out_filename
ref_name_tbl = []
File.open(in_filename, "r") do |ifp|
File.open(out_filename, "w") do |ofp|
str = ifp.read
str.scan(/(.*?)\\(.+?)\\/) {|pre, ref_name|
ofp.print pre
if i = ref_name_tbl.index(ref_name)
ofp.print "[#{i + 1}]"
else
ref_name_tbl << ref_name
ofp.print "[#{ref_name_tbl.size}]"
end
}
ofp.print $'
ofp.print "\n\nReferences\n"
ref_name_tbl.each_with_index {|e, i|
ofp.print "[#{i + 1}] #{e}\n"
}
end
end
end
if $0 == __FILE__
if ARGV.size != 2
puts "Usage: #{__FILE__} infile outfile"
abort
end
markup_reference ARGV[0], ARGV[1]
end
@maehrm
Copy link
Author

maehrm commented Mar 24, 2019

The program language includes C, COBOL, Java, etc\Computer Journal\. The feature of the Java language has been to have taken the idea of object-oriented\Java Report\. In other languages, the idea of object-oriented is being taken\Computer Journal\.

@maehrm
Copy link
Author

maehrm commented Mar 24, 2019

上記の文書に対して、以下の文献リストが表示します。

The program language includes C, COBOL, Java, etc[1]. The feature of the Java language has been to have taken the idea of object-oriented[2]. In other languages, the idea of object-oriented is being taken[1].

References
[1] Computer Journal
[2] Java Report

@maehrm
Copy link
Author

maehrm commented Mar 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment