repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/db/migrate/201007221918342_create_oauth_authorizations.rb | provider/db/migrate/201007221918342_create_oauth_authorizations.rb | class CreateOauthAuthorizations < ActiveRecord::Migration
def self.up
create_table :oauth_authorizations do |t|
t.string :user_id
t.integer :oauth_client_id
t.string :code
t.integer :expires_at
t.timestamps
end
end
def self.down
drop_table :oauth_authorizatio... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/db/migrate/201007221918340_create_oauth_clients.rb | provider/db/migrate/201007221918340_create_oauth_clients.rb | class CreateOauthClients < ActiveRecord::Migration
def self.up
create_table :oauth_clients do |t|
t.string :name
t.string :client_id
t.string :client_secret
t.string :redirect_uri
t.timestamps
end
end
def self.down
drop_table :oauth_clients
end
end
| ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/test_helper.rb | provider/test/test_helper.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::TestCase
# Transactiona... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/unit/ssl_helper_test.rb | provider/test/unit/ssl_helper_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.expand_path(File.dirname(__FILE__)), '/../test_helper')
module Oauth2
module Provider
class SslHelperController < ActionController::Base
... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/unit/oauth_token_test.rb | provider/test/unit/oauth_token_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
module Oauth2
module Provider
class OauthTokenTest < ActiveSupport::TestCase
def setup
... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/unit/clock_test.rb | provider/test/unit/clock_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
module Oauth2
module Provider
class ClockTest < Test::Unit::TestCase
def test_can_fake_now
... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/unit/model_base_test.rb | provider/test/unit/model_base_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
module Oauth2
module Provider
class ModelBaseTest < ActiveSupport::TestCase
class TestDatasourc... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/unit/oauth_authorization_test.rb | provider/test/unit/oauth_authorization_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
module Oauth2
module Provider
class OauthAuthorizationTest < ActiveSupport::TestCase
def setu... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/unit/oauth_client_test.rb | provider/test/unit/oauth_client_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.expand_path(File.dirname(__FILE__)), '/../test_helper')
module Oauth2
module Provider
class OauthClientTest < ActiveSupport::TestCase
... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/unit/route_test.rb | provider/test/unit/route_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.expand_path(File.dirname(__FILE__)), '/../test_helper')
class RouteTest < ActionController::TestCase
def teardown
ENV['ADMIN_OAUTH_URL_PREF... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/protected_resource_controller_test.rb | provider/test/functional/protected_resource_controller_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
class ProtectedResourceControllerTest < ActionController::TestCase
def test_access_protected_resource_wit... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/oauth_token_controller_authorization_code_test.rb | provider/test/functional/oauth_token_controller_authorization_code_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
class OauthTokenControllerAuthorizationCodeTest < ActionController::TestCase
def setup
Oauth2::Provid... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/oauth_user_tokens_controller_test.rb | provider/test/functional/oauth_user_tokens_controller_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
class OauthUserTokensControllerTest < ActionController::TestCase
def setup
@old_ssl_base_url = Oauth2... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/oauth_clients_controller_api_test.rb | provider/test/functional/oauth_clients_controller_api_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
class OauthClientsControllerApiTest < ActionController::TestCase
def setup
@user = User.create!(:email... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/oauth_clients_controller_test.rb | provider/test/functional/oauth_clients_controller_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
class OauthClientsControllerTest < ActionController::TestCase
def setup
@user = User.create!(:email =... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/namespace_routing_test.rb | provider/test/functional/namespace_routing_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
class OauthControllerSmokeTest < ActionController::TestCase
def setup
@controller = OauthClientsContr... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/oauth_token_controller_refresh_token_test.rb | provider/test/functional/oauth_token_controller_refresh_token_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
class OauthTokenControllerRefreshTokenTest < ActionController::TestCase
def setup
Oauth2::Provider::C... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/oauth_authorize_controller_test.rb | provider/test/functional/oauth_authorize_controller_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../test_helper')
class OauthAuthorizeControllerTest < ActionController::TestCase
def setup
@client = Oauth2::Provider:... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/test/functional/o_auth2/provider/application_controller_methods_test.rb | provider/test/functional/o_auth2/provider/application_controller_methods_test.rb | # Copyright (c) 2010 ThoughtWorks Inc. (http://thoughtworks.com)
# Licenced under the MIT License (http://www.opensource.org/licenses/mit-license.php)
require File.join(File.dirname(__FILE__), '../../../test_helper')
require 'ostruct'
module Oauth2
module Provider
class ApplicationControllerMethodsTest < Active... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/environment.rb | provider/config/environment.rb | # Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/routes.rb | provider/config/routes.rb | ActionController::Routing::Routes.draw do |map|
map.resources :users
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :con... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/boot.rb | provider/config/boot.rb | # Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/initializers/session_store.rb | provider/config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Act... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/initializers/new_rails_defaults.rb | provider/config/initializers/new_rails_defaults.rb | # Be sure to restart your server when you modify this file.
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
# Include Active Record class name as root for JSON serialized output.
ActiveReco... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/initializers/inflections.rb | provider/config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person',... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/initializers/oauth2_provider.rb | provider/config/initializers/oauth2_provider.rb | module Oauth2
module Provider
#raise 'OAuth2 provider not configured yet!'
# please go through the readme and configure this file before you can use this plugin!
# A fix for the stupid "A copy of ApplicationController has been removed from the module tree but is still active!"
# error message th... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/initializers/jdbc.rb | provider/config/initializers/jdbc.rb | # This file was generated by the "jdbc" generator, which is provided
# by the activerecord-jdbc-adapter gem.
#
# This file allows the JDBC drivers to be hooked into ActiveRecord
# such that you don't have to change anything else in your Rails
# application.
require 'jdbc_adapter' if defined?(JRUBY_VERSION)
| ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/initializers/backtrace_silencers.rb | provider/config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying do debug a probl... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/initializers/mime_types.rb | provider/config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/environments/mingle_production.rb | provider/config/environments/mingle_production.rb | # Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_reque... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/environments/test.rb | provider/config/environments/test.rb | # Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/environments/development.rb | provider/config/environments/development.rb | # Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/environments/production.rb | provider/config/environments/production.rb | # Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_reque... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
ThoughtWorksStudios/oauth2_provider | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/provider/config/environments/mingle_acceptance_test.rb | provider/config/environments/mingle_acceptance_test.rb | # Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_reque... | ruby | MIT | d54702f194edd05389968cf8947465860abccc5d | 2026-01-04T17:46:04.645080Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/a_run_first_spec.rb | spec/a_run_first_spec.rb | require_relative "spec_helper"
require "fileutils"
require "fontist"
RSpec.describe Metanorma::Compile do
# needs to be run before collection_spec.rb for it to work
it "aborts if include error" do
require "metanorma-iso"
input = <<~INPUT
= Document title
Author
:docfile: test.adoc
:... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require "simplecov"
SimpleCov.start do
add_filter "/spec/"
end
require "bundler/setup"
require "metanorma"
require "rspec/matchers"
require "equivalent-xml"
require "rspec-command"
require "mnconvert"
require "mn2pdf"
require "xml-c14n"
require_relative "support/uuid_mock"
RSpec.confi... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/support/uuid_mock.rb | spec/support/uuid_mock.rb | # This file contains a helper method to mock UUIDTools::UUID.random_create
# to return an incrementing number (1, 2, 3, 4, etc.)
# each time it's called within a test.
# It also overrides the contenthash generation,
# so that the tracked GUIDs can be seen as they are used
# in generated ids and cross-references
requ... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/compile/output_filename_config_spec.rb | spec/compile/output_filename_config_spec.rb | # frozen_string_literal: true
RSpec.describe Metanorma::Compile::OutputFilenameConfig do
describe "#generate_filename" do
let(:relaton_data) do
{
"docidentifier" => "ISO/IEC FDIS 10118-3",
"language" => "en",
"edition" => "2",
"doctype" => "international-standard",
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/compile/compile_spec.rb | spec/compile/compile_spec.rb | require_relative "../spec_helper"
require "fileutils"
RSpec.describe Metanorma::Compile do
def clean_outputs
%w(xml presentation.xml html alt.html doc relaton.xml err rxl pdf)
.each { |ext| FileUtils.rm_f Dir["spec/assets/*.#{ext}"] }
FileUtils.rm_rf "spec/assets/test"
FileUtils.rm_rf "spec/assets... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | true |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/compile/input_spec.rb | spec/compile/input_spec.rb | require_relative "../spec_helper"
require "fileutils"
RSpec.describe Metanorma::Input::Asciidoc do
it "extracts Asciidoctor document attributes" do
input = <<~INPUT
= Document title
Author
:sectionsplit: a
:body-font: b
:header-font: c
:title-font: d
:i18nyaml: e
:... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/compile/registry_spec.rb | spec/compile/registry_spec.rb | require_relative "../spec_helper"
RSpec.describe Metanorma::Registry do
it "has a registry" do
class NewProcessor < Metanorma::Processor
def initialize
@short = :new
end
def output_formats
{ xyz: "xyz" }
end
end
registry = Metanorma::Registry.instance
registry... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/compile/output_filename_spec.rb | spec/compile/output_filename_spec.rb | # frozen_string_literal: true
RSpec.describe Metanorma::Compile::OutputFilename do
let(:filename_noext) { "test" }
let(:output_dir) { "output" }
let(:processor) do
double("processor", output_formats: { html: "html", pdf: "pdf" })
end
subject(:output_filename) do
described_class.new(filename_noext, o... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/metanorma/config_spec.rb | spec/metanorma/config_spec.rb | require "spec_helper"
RSpec.describe Metanorma::Config do
before { restore_to_default_config }
after { restore_to_default_config }
describe ".configure" do
it "allows us to set our configuration" do
logs_types = ["warning", :error]
Metanorma.configuration.logs = logs_types
expect(Metanor... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/collection/collection_complex_spec.rb | spec/collection/collection_complex_spec.rb | require_relative "../spec_helper"
require "stringio"
def capture_stdout
old = $stdout
$stdout = fake = StringIO.new
yield
fake.string
ensure
$stdout = old
end
INPATH = "spec/fixtures/collection".freeze
OUTPATH = "spec/fixtures/output".freeze
# rubocop:disable Layout/LineLength
RSpec.describe Metanorma::Col... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/collection/collection_sectionsplit.rb | spec/collection/collection_sectionsplit.rb | require_relative "../spec_helper"
require "stringio"
require "isodoc"
def capture_stdout
old = $stdout
$stdout = fake = StringIO.new
yield
fake.string
ensure
$stdout = old
end
INPATH = "spec/fixtures/collection".freeze
OUTPATH = "spec/fixtures/output".freeze
# rubocop:disable Layout/LineLength
RSpec.descri... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/collection/collection_spec.rb | spec/collection/collection_spec.rb | # frozen_string_literal: true
require_relative "../spec_helper"
require "stringio"
def capture_stdout
old = $stdout
$stdout = fake = StringIO.new
yield
fake.string
ensure
$stdout = old
end
INPATH = "spec/fixtures/collection"
OUTPATH = "spec/fixtures/output"
RSpec.describe Metanorma::Collection do
contex... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/examples/metanorma-collection/yaml2xml.collection.rb | spec/examples/metanorma-collection/yaml2xml.collection.rb | require "relaton-cli"
require "yaml"
require "tempfile"
require "relaton"
require "metanorma-cli"
require "nokogiri"
def main
@collection = YAML.load_file(ARGV[0])
@docs = []
require "metanorma-#{doctype}"
output
end
def output
print <<~END
<metanorma-collection xmlns="http://metanorma.org">
#{col... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/spec/examples/metanorma-collection/collection-render.rb | spec/examples/metanorma-collection/collection-render.rb | require "nokogiri"
require "metanorma-cli"
require "metanorma"
require "isodoc"
require "fileutils"
# This is only going to render the HTML collection
# ARGV[0]: input file
# ARGV[1]: cover page HTML (Liquid template)
# ARGV[2]: output directory
#
# We presuppose that the bibdata of the document is equivalent to that ... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma.rb | lib/metanorma.rb | # frozen_string_literal: true
class Array
alias orig_filter filter
end
require "metanorma/version"
require "asciidoctor"
require "metanorma/util/util"
require "metanorma/config/config"
require "metanorma/input"
require "metanorma/registry/registry"
require "metanorma/processor/processor"
require "metanorma/asciidoc... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/version.rb | lib/metanorma/version.rb | module Metanorma
VERSION = "2.3.0".freeze
end
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/array_monkeypatch.rb | lib/metanorma/array_monkeypatch.rb | # TODO sidesteps bibdata redefinition of filter, will remove
module Metanorma
module ArrayMonkeypatch
class ::Array
alias filter select
end
end
end
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/processor.rb | lib/metanorma/processor.rb | require_relative "./processor/processor"
module Metanorma
class Processor
end
end
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/asciidoctor_extensions.rb | lib/metanorma/asciidoctor_extensions.rb | require_relative "asciidoctor_extensions/glob_include_processor"
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/input.rb | lib/metanorma/input.rb | require_relative "./input/base"
require_relative "./input/asciidoc"
module Metanorma
module Input
end
end
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/util/fontist_helper.rb | lib/metanorma/util/fontist_helper.rb | require "fontist"
module Metanorma
module Util
class FontistHelper
class << self
private
def validate_options(options)
agree_to_terms = options[:agree_to_terms] || false
continue_without_fonts = options[:continue_without_fonts] || false
no_progress = !options[:... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/util/worker_pool.rb | lib/metanorma/util/worker_pool.rb | module Metanorma
module Util
class WorkersPool
def initialize(workers)
init_vars(workers)
@threads = Array.new(@workers) do
init_thread
end
end
def init_vars(workers)
@workers = workers
@queue = SizedQueue.new(@workers)
end
def init... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/util/util.rb | lib/metanorma/util/util.rb | module Metanorma
module Util
class << self
def log(message, type = :info)
log_types = Metanorma.configuration.logs.map(&:to_s) || []
if log_types.include?(type.to_s)
puts(message)
end
if type == :fatal
exit(1)
end
end
# dependency or... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/writeable.rb | lib/metanorma/compile/writeable.rb | # frozen_string_literal: true
module Metanorma
class Compile
module Writeable
def export_output(fname, content, **options)
mode = options[:binary] ? "wb" : "w:UTF-8"
File.open(fname, mode) { |f| f.write content }
end
end
end
end
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/flavor.rb | lib/metanorma/compile/flavor.rb | # frozen_string_literal: true
module Metanorma
class Compile
module Flavor
# Load the flavor gem for the given standard type
# @param stdtype [Symbol] the standard type
# @return [void]
def load_flavor(stdtype)
new_stdtype = taste2flavor(stdtype)
flavor = stdtype2flavor_ge... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/extract.rb | lib/metanorma/compile/extract.rb | # frozen_string_literal: true
require_relative "writeable"
module Metanorma
class Compile
module Extract
# @param isodoc [String] the XML document
# @param dirname [String, nil] the directory to extract to
# @param extract_types [Array<Symbol>, nil] the types to extract
# @return [void]
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/output_filename.rb | lib/metanorma/compile/output_filename.rb | # frozen_string_literal: true
module Metanorma
class Compile
class OutputFilename
# Returns an instance of OutputFilename from the source filename
# @param source_filename [String] the source filename
# @param output_dir [String, nil] the output directory
# @param processor [Metanorma::Pr... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/relaton_drop.rb | lib/metanorma/compile/relaton_drop.rb | # frozen_string_literal: true
require "liquid"
module Metanorma
class Compile
class RelatonDrop < Liquid::Drop
def initialize(relaton_data)
@relaton = relaton_data
end
def docidentifier
at("./docidentifier")
end
def title
at("./title")
end
def... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/output_filename_config.rb | lib/metanorma/compile/output_filename_config.rb | # frozen_string_literal: true
module Metanorma
class Compile
class OutputFilenameConfig
DEFAULT_TEMPLATE =
"{{ document.docidentifier | downcase" \
" | replace: '/' , '-'" \
" | replace: ' ' , '-' }}"
attr_reader :template
def initialize(template)
@template = i... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/render.rb | lib/metanorma/compile/render.rb | module Metanorma
class Compile
# Generate presentation XML from semantic XML
def generate_presentation_xml(source_file, xml, bibdata, output_paths, opt)
process_ext(:presentation, source_file, xml, bibdata, output_paths, opt)
end
# Generate multiple output formats with parallel processing
d... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/compile_options.rb | lib/metanorma/compile/compile_options.rb | require "csv"
module Metanorma
class Compile
module CompileOptions
def require_libraries(options)
options&.dig(:require)&.each { |r| require r }
end
def extract_xml_options(file)
xml = Nokogiri::XML(file, &:huge)
if xml.root
@registry.root_tags.each do |k, v|
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/validator.rb | lib/metanorma/compile/validator.rb | # frozen_string_literal: true
module Metanorma
class Compile
module Validator
def validate_options!(options)
validate_type!(options)
validate_format!(options)
end
def validate_type!(options)
options[:type] or
Util.log("[metanorma] Error: Please specify a stand... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/compile/compile.rb | lib/metanorma/compile/compile.rb | # frozen_string_literal: true
require "fileutils"
require "nokogiri"
require "htmlentities"
require "yaml"
require "fontist"
require "fontist/manifest"
require "metanorma-taste"
require_relative "writeable"
require_relative "validator"
require_relative "compile_options"
require_relative "../util/fontist_helper"
requir... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/processor/processor.rb | lib/metanorma/processor/processor.rb | # Registry of all Metanorma types and entry points
#
module Metanorma
class Processor
attr_reader :short, :input_format, :asciidoctor_backend
def initialize
raise "This is an abstract class!"
end
def output_formats
{
xml: "xml",
presentation: "presentation.xml",
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/collection.rb | lib/metanorma/collection/collection.rb | require "relaton-cli"
require "metanorma-utils"
require_relative "util/util"
require_relative "util/disambig_files"
require_relative "config/config"
require_relative "config/manifest"
require_relative "helpers"
module Metanorma
class FileNotFoundException < StandardError; end
class AdocFileNotFoundException < Sta... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/log.rb | lib/metanorma/collection/log.rb | module Metanorma
class Collection
METANORMA_LOG_MESSAGES = {
# rubocop:disable Naming/VariableNumber
"METANORMA_1": { category: "Cross-References",
error: "Missing cross-reference: %s",
severity: 2 },
"METANORMA_2": { category: "Cross-References",
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/helpers.rb | lib/metanorma/collection/helpers.rb | module Metanorma
class Collection
class << self
# @param Block [Proc]
# @note allow user-specific function to run in pre-parse model stage
def set_pre_parse_model(&block)
@pre_parse_model_proc = block
end
# @param Block [Proc]
# @note allow user-specific function to re... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/renderer/fileprocess.rb | lib/metanorma/collection/renderer/fileprocess.rb | # frozen_string_literal: true
require "isodoc"
require "metanorma-utils"
require_relative "fileparse"
module Metanorma
class Collection
class Renderer
# compile and output individual file in collection
# warn "metanorma compile -x html #{f.path}"
def file_compile(file, filename, identifier)
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/renderer/svg.rb | lib/metanorma/collection/renderer/svg.rb | module Metanorma
class Collection
class Renderer
def svg_datauri(docxml, docid)
rel = @files.get(docid, :rel_path)
parent = @files.get(docid, :parentid) and
rel = @files.get(parent, :rel_path)
# if sectionsplit, use orig file dir
dir = File.join(@dirname, File.dirna... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/renderer/render_word.rb | lib/metanorma/collection/renderer/render_word.rb | module Metanorma
class Collection
class Renderer
def docconv(added_options = {})
@tempfile_cache ||= []
flavor = Util::taste2flavor(@flavor).to_sym
opts = Util::taste2isodoc_attrs(@flavor, :doc)
x = Asciidoctor.load nil, backend: flavor
x.converter.doc_converter(DocOp... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/renderer/utils.rb | lib/metanorma/collection/renderer/utils.rb | module Metanorma
class Collection
class Renderer
def dir_name_cleanse(name)
path = Pathname.new(name)
clean_regex = /[<>:"|?*\p{Zs}]/
fallback_sym = "_"
path.absolute? or return name.gsub(clean_regex, fallback_sym)
File.join(path.dirname,
path.basena... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/renderer/navigation.rb | lib/metanorma/collection/renderer/navigation.rb | module Metanorma
class Collection
class Renderer
# @param elm [Nokogiri::XML::Element]
# @return [String]
def indexfile_title(entry)
if entry.bibdata &&
x = entry.bibdata.title.detect { |t| t.type == "main" } ||
entry.bibdata.title.first
x.title.cont... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/renderer/fileparse.rb | lib/metanorma/collection/renderer/fileparse.rb | module Metanorma
class Collection
class Renderer
# Resolves references to other files in the collection. Three routines:
# 1. Eref to a document that has been split into multiple documents
# (sectionsplit) are resolved to direct eref to the split document
# 2. Indirect erefs to a file anch... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/renderer/renderer.rb | lib/metanorma/collection/renderer/renderer.rb | require "isodoc"
require "htmlentities"
require_relative "fileprocess"
require_relative "../../util/fontist_helper"
require_relative "../../util/util"
require_relative "../filelookup/filelookup"
require_relative "../multilingual/multilingual"
require_relative "utils"
require_relative "render_word"
require_relative "nav... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/util/disambig_files.rb | lib/metanorma/collection/util/disambig_files.rb | module Metanorma
class Collection
module Util
class DisambigFiles
def initialize
@seen_filenames = []
end
def strip_root(name)
name.sub(%r{^(\./)?(\.\./)+}, "")
end
def source2dest_filename(name, disambig = true)
n = strip_root(name)
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/util/util.rb | lib/metanorma/collection/util/util.rb | module Metanorma
class Collection
module Util
class << self
def anchor_id_attributes
Metanorma::Utils::anchor_attributes(presxml: true) +
[%w(* id), %w(* anchor), %w(link bibitemid), %w(fmt-link bibitemid)]
end
def gather_bibitems(xml)
xml.xpath("//xm... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/multilingual/multilingual.rb | lib/metanorma/collection/multilingual/multilingual.rb | module Metanorma
class Collection
class Multilingual
def to_xml(node)
node&.to_xml(encoding: "UTF-8", indent: 0,
save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
end
def xmldoc(node)
ret = Nokogiri::XML::Document.new
ret.root = node.dup
r... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | true |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/xrefprocess/xrefprocess.rb | lib/metanorma/collection/xrefprocess/xrefprocess.rb | module Metanorma
class Collection
module XrefProcess
class << self
# xml.root["type"] = key # to force recognition of internal refs
# bookmarks etc as new id elements introduced in Presentation XML:
# add doc suffix
# Run on Semantic XML
def xref_preprocess(xml, isodo... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/sectionsplit/collection.rb | lib/metanorma/collection/sectionsplit/collection.rb | module Metanorma
class Collection
class Sectionsplit
def build_collection
collection_setup(@base, @dir)
files = sectionsplit
input_xml = Nokogiri::XML(File.read(@input_filename,
encoding: "UTF-8"), &:huge)
collection_manifest(@base,... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/sectionsplit/sectionsplit.rb | lib/metanorma/collection/sectionsplit/sectionsplit.rb | require "yaml"
require_relative "../../util/util"
require_relative "../xrefprocess/xrefprocess"
require_relative "collection"
require "concurrent-ruby"
module Metanorma
class Collection
class Sectionsplit
attr_accessor :filecache, :key
def initialize(opts)
@input_filename = opts[:input]
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/config/converters.rb | lib/metanorma/collection/config/converters.rb | require "relaton-cli"
module Metanorma
class Collection
module Config
module Converters
def bibdata_from_yaml(model, value)
value and !value.empty? or return
force_primary_docidentifier_yaml(value)
model.bibdata = Relaton::Cli::YAMLConvertor.convert_single_file(value)
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/config/manifest.rb | lib/metanorma/collection/config/manifest.rb | require "lutaml/model"
require "lutaml/model/xml_adapter/nokogiri_adapter"
require_relative "../../array_monkeypatch"
require_relative "converters"
require_relative "bibdata"
module Metanorma
class Collection
module Config
Lutaml::Model::Config.configure do |config|
config.xml_adapter = Lutaml::Mod... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/config/compile_options.rb | lib/metanorma/collection/config/compile_options.rb | require "lutaml/model"
module Metanorma
class Collection
module Config
class CompileOptions < ::Lutaml::Model::Serializable
attribute :install_fonts, :boolean, default: -> { false }
attribute :agree_to_terms, :boolean, default: -> { true }
end
end
end
end
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/config/directive.rb | lib/metanorma/collection/config/directive.rb | module Metanorma
class Collection
module Config
class Directive < ::Lutaml::Model::Serializable
attribute :key, :string
attribute :value, :string
xml do
root "directive"
map_element "key", to: :key
map_element "value", to: :value
end
end
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/config/config.rb | lib/metanorma/collection/config/config.rb | require "lutaml/model"
require_relative "../../array_monkeypatch"
require_relative "compile_options"
require_relative "converters"
require_relative "bibdata"
require_relative "directive"
require_relative "manifest"
module Metanorma
class Collection
module Config
Lutaml::Model::Config.configure do |config|
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/config/bibdata.rb | lib/metanorma/collection/config/bibdata.rb | require "relaton"
require "lutaml/model"
module Metanorma
class Collection
module Config
class Bibdata < ::Lutaml::Model::Serializable
model ::RelatonBib::BibliographicItem
end
end
end
end
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/manifest/manifest.rb | lib/metanorma/collection/manifest/manifest.rb | # frozen_string_literal: true
require_relative "../../util/util"
module Metanorma
class Collection
class Manifest
# @return [Metanorma::Collection]
attr_reader :collection, :config, :lang, :script
# @param level [String]
# @param dir [String]
# @param title [String, nil]
# @... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/document/document.rb | lib/metanorma/collection/document/document.rb | require "relaton-cli"
module Metanorma
class Collection
class Document
# @return [Strin]
attr_reader :file, :attachment, :bibitem, :index
# @param bibitem [RelatonBib::BibliographicItem]
def initialize(bibitem, file, options = {})
@bibitem = bibitem
@file = file
@... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/filelookup/filelookup_sectionsplit.rb | lib/metanorma/collection/filelookup/filelookup_sectionsplit.rb | require_relative "../sectionsplit/sectionsplit"
# require "concurrent-ruby"
module Metanorma
class Collection
class FileLookup
def add_section_split
ret = @files.keys.each_with_object({}) do |k, m|
if @files[k][:sectionsplit] && !@files[k][:attachment]
process_section_split_in... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/collection/filelookup/filelookup.rb | lib/metanorma/collection/filelookup/filelookup.rb | require "isodoc"
require "htmlentities"
require "metanorma-utils"
require_relative "filelookup_sectionsplit"
module Metanorma
class Collection
class FileLookup
attr_accessor :files_to_delete, :parent
# hash for each document in collection of document identifier to:
# document reference (filere... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/input/base.rb | lib/metanorma/input/base.rb | module Metanorma
module Input
class Base
def process(_file, _filename, _type)
raise "This is an abstract class"
end
end
end
end
| ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/input/asciidoc.rb | lib/metanorma/input/asciidoc.rb | require "nokogiri"
module Metanorma
module Input
class Asciidoc < Base
def process(file, filename, type, options = {})
require "asciidoctor"
out_opts = { to_file: false, safe: :safe, backend: type,
header_footer: true, log: options[:log],
novalid: o... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/asciidoctor_extensions/glob_include_processor.rb | lib/metanorma/asciidoctor_extensions/glob_include_processor.rb | module Metanorma
module AsciidoctorExtensions
class GlobIncludeProcessor < ::Asciidoctor::Extensions::IncludeProcessor
def process(_doc, reader, target_glob, attributes)
Dir[File.join reader.dir, target_glob].sort.reverse_each do |target|
content = File.readlines target
content.u... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/config/config.rb | lib/metanorma/config/config.rb | module Metanorma
module Config
def configure
if block_given?
yield configuration
end
end
def configuration
@configuration ||= Configuration.new
end
end
class Configuration
attr_accessor :logs
def initialize
@logs = %i[warning error fatal]
end
end
... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
metanorma/metanorma | https://github.com/metanorma/metanorma/blob/4004ddf0595d04715adade5795e7fe1ffdf69e06/lib/metanorma/registry/registry.rb | lib/metanorma/registry/registry.rb | # Registry of all Metanorma types and entry points
require "singleton"
require "metanorma-taste"
class Error < StandardError
end
module Metanorma
# Central registry for managing Metanorma processors, flavors, and their aliases
#
# This singleton class provides a centralized registry for:
# - Metanorma proces... | ruby | BSD-2-Clause | 4004ddf0595d04715adade5795e7fe1ffdf69e06 | 2026-01-04T17:47:05.146036Z | false |
dalibor/octoshark | https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/spec/spec_helper.rb | spec/spec_helper.rb | require 'octoshark'
require 'fileutils'
ROOT = File.expand_path('../', File.dirname(__FILE__))
TMP = 'tmp'
# Load support files
Dir["#{ROOT}/spec/support/**/*.rb"].each { |f| require f }
RSpec.configure do |config|
config.include Helpers
config.before :suite do
FileUtils.mkdir_p(TMP)
end
config.befor... | ruby | MIT | 0971743cb8e5c8eb2686f60188267d3549001503 | 2026-01-04T17:48:18.822915Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.