aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/tag.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tag.rb')
-rw-r--r--lib/tag.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/tag.rb b/lib/tag.rb
new file mode 100644
index 0000000..a7c13b2
--- /dev/null
+++ b/lib/tag.rb
@@ -0,0 +1,26 @@
+module Nuldoc
+ Tag = Struct.new(:slug, :label, keyword_init: true) do
+ LABELS = {
+ 'conference' => 'カンファレンス',
+ 'cpp' => 'C++',
+ 'cpp17' => 'C++ 17',
+ 'note-to-self' => '備忘録',
+ 'php' => 'PHP',
+ 'phpcon' => 'PHP カンファレンス',
+ 'phperkaigi' => 'PHPerKaigi',
+ 'python' => 'Python',
+ 'python3' => 'Python 3',
+ 'ruby' => 'Ruby',
+ 'ruby3' => 'Ruby 3',
+ 'rust' => 'Rust',
+ 'vim' => 'Vim',
+ }
+
+ def self.from_slug(slug)
+ Tag.new(
+ slug: slug,
+ label: (LABELS[slug] || raise("No label for tag '#{slug}'")),
+ )
+ end
+ end
+end