From a175314c3e5827eb193872241446f2f8f5c9d33c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 20:07:14 +0200 Subject: Adding upstream version 1:10.5.12. Signed-off-by: Daniel Baumann --- storage/mroonga/tools/Makefile.am | 6 + storage/mroonga/tools/prepare-sphinx-html.rb | 175 ++++++++++++++++++++++++++ storage/mroonga/tools/travis/before_script.sh | 97 ++++++++++++++ storage/mroonga/tools/travis/install.sh | 157 +++++++++++++++++++++++ storage/mroonga/tools/travis/script.sh | 136 ++++++++++++++++++++ storage/mroonga/tools/upload-to-github.rb | 42 +++++++ 6 files changed, 613 insertions(+) create mode 100644 storage/mroonga/tools/Makefile.am create mode 100755 storage/mroonga/tools/prepare-sphinx-html.rb create mode 100755 storage/mroonga/tools/travis/before_script.sh create mode 100755 storage/mroonga/tools/travis/install.sh create mode 100755 storage/mroonga/tools/travis/script.sh create mode 100755 storage/mroonga/tools/upload-to-github.rb (limited to 'storage/mroonga/tools') diff --git a/storage/mroonga/tools/Makefile.am b/storage/mroonga/tools/Makefile.am new file mode 100644 index 00000000..b65b9300 --- /dev/null +++ b/storage/mroonga/tools/Makefile.am @@ -0,0 +1,6 @@ +noinstall_ruby_scripts = \ + prepare-sphinx-html.rb \ + upload-to-github.rb + +EXTRA_DIST = \ + $(noinstall_ruby_scripts) diff --git a/storage/mroonga/tools/prepare-sphinx-html.rb b/storage/mroonga/tools/prepare-sphinx-html.rb new file mode 100755 index 00000000..71e12f0e --- /dev/null +++ b/storage/mroonga/tools/prepare-sphinx-html.rb @@ -0,0 +1,175 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +if ARGV.size != 2 + puts "Usage: #{$0} SOURCE_DIR DEST_DIR" + exit(false) +end + +require 'pathname' +require "fileutils" + +def fix_link(text, extension, language) + send("fix_#{extension}_link", text, language) +end + +def fix_link_path(text) + text.gsub(/\b_(sources|static|images)\b/, '\1') +end + +def fix_language_link(url, language) + url.gsub(/\A((?:\.\.\/){2,})([a-z]{2})\/html\//) do + relative_base_path = $1 + link_language = $2 + close_quote = $3 + if language == "en" + relative_base_path = relative_base_path.gsub(/\A\.\.\//, '') + end + if link_language != "en" + relative_base_path += "#{link_language}/" + end + "#{relative_base_path}docs/" + end +end + +def fix_html_link(html, language) + html = html.gsub(/(href|src)="(.+?)"/) do + attribute = $1 + link = $2 + link = fix_link_path(link) + link = fix_language_link(link, language) + "#{attribute}=\"#{link}\"" + end + html.gsub(/(id="top-link" href=)"(.+?)"/) do + prefix = $1 + top_path = $2.gsub(/\/index\.html\z/, '/') + top_path = "./" if ["index.html", "#"].include?(top_path) + "#{prefix}\"#{top_path}../\"" + end +end + +def fix_js_link(js, language) + fix_link_path(js) +end + +LANGUAGE_TO_LOCALE = { + "ja" => "ja_JP", + "en" => "en_US", +} + +def insert_facebook_html_header(html) + html.gsub(/<\/head>/) do + <<-HTML + + + + + + + + + HTML + end +end + +def insert_facebook_html_fb_root(html) + html.gsub(//) do + <<-HTML + +
+ HTML + end +end + +def insert_facebook_html_buttons(html) + html.gsub(/(