mirror of
https://github.com/seigler/dash-docs
synced 2025-07-28 10:16:15 +00:00
Add script used to build and update website
This commit is contained in:
parent
84f5b6f160
commit
bd5a114cba
6 changed files with 702 additions and 0 deletions
23
_build/txpreview/addlang.rb
Normal file
23
_build/txpreview/addlang.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue