mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 09:46:12 +00:00
23 lines
660 B
Ruby
23 lines
660 B
Ruby
#!/usr/bin/env ruby
|
|
|
|
# This file is licensed under the MIT License (MIT) available on
|
|
# http://opensource.org/licenses/MIT.
|
|
|
|
PATH = Dir.pwd
|
|
|
|
if ARGV.empty?
|
|
return
|
|
else
|
|
la = ARGV[0]
|
|
end
|
|
|
|
contents = File.read(PATH + '/_config.yml')
|
|
|
|
if Regexp.new('langsorder:.*?' + "\n" + '- \'' + la + '\'' + "\n", Regexp::MULTILINE).match(contents).nil?
|
|
contents.gsub!(Regexp.new("(langsorder:.*?)\n\n", Regexp::MULTILINE),'\1' + "\n" + '- \'' + la + '\'' + "\n\n")
|
|
contents.gsub!(Regexp.new("(langs:.*?)\n\n", Regexp::MULTILINE),'\1' + "\n" + ' \'' + la + '\': \'' + la + '\'' + "\n\n")
|
|
end
|
|
|
|
File.open(PATH + '/_config.yml', 'w') do |file|
|
|
file.write(contents)
|
|
end
|