Skip to content

Commit 8417536

Browse files
authored
Merge pull request #1361 from p8/features/html-lang
Set language in HTML
2 parents c68ae93 + c0438ac commit 8417536

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/rdoc/generator/darkfish.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def assemble_template(body_file)
595595
<<-TEMPLATE
596596
<!DOCTYPE html>
597597
598-
<html>
598+
<html lang="#{@options.locale&.name || 'en'}">
599599
<head>
600600
#{head_file.read}
601601

test/rdoc/rdoc_generator_darkfish_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,21 @@ def test_template_stylesheets
388388
assert_include File.binread('index.html'), %Q[href="./#{base}"]
389389
end
390390

391+
def test_html_lang
392+
@g.generate
393+
394+
content = File.binread("index.html")
395+
assert_include(content, '<html lang="en">')
396+
end
397+
398+
def test_html_lang_from_locale
399+
@options.locale = RDoc::I18n::Locale.new 'ja'
400+
@g.generate
401+
402+
content = File.binread("index.html")
403+
assert_include(content, '<html lang="ja">')
404+
end
405+
391406
def test_title
392407
title = "RDoc Test".freeze
393408
@options.title = title

0 commit comments

Comments
 (0)