Update {random,surah-index,surah-stream}.html.erb

Add dir attribute
This commit is contained in:
0x1eef 2024-05-29 03:09:02 -03:00
parent fbb87bdf25
commit 4b041571f3
9 changed files with 15 additions and 12 deletions

2
Rules
View file

@ -61,7 +61,7 @@ passthrough "/json/durations/*/*.json"
# require rules
require_rules "nanoc/rules/assets"
require_rules "nanoc/rules/redirect", {locales:}
require_rules "nanoc/rules/random", {locales:}
require_rules "nanoc/rules/random", {locales:, tdata:}
require_rules "nanoc/rules/stream", {locales:, tdata:, name_by_id:}
require_rules "nanoc/rules/index", {locales:, tdata:}

View file

@ -7,9 +7,8 @@
locales.each do |locale|
compile "/html/main/surah-index.html.erb", rep: "/#{locale}/surah/index" do
context = Ryo.from(filename: "surah-index.html.erb", locale:, locales:)
locals = {locale: context.locale, locales: context.locales, context:}
filter(:erb, {locals:})
context = Ryo.from(filename: "surah-index.html.erb", dir: tdata[locale].dir, locale:, locales:)
filter(:erb, {locals: {locale:, locales:, dir: context.dir, context:}})
filter(:tidy)
write "/#{locale}/index.html"
end

View file

@ -7,8 +7,8 @@
locales.each do |locale|
compile "/html/main/random.html.erb", rep: "random/#{locale}" do
context = Ryo.from({filename: "random.html.erb", locale:})
filter(:erb, locals: {locale:, locales:, context:})
context = Ryo.from({filename: "random.html.erb", dir: tdata[locale].dir, locale:, locales:})
filter(:erb, locals: {locale:, locales:, dir: context.dir, context:})
filter(:tidy)
write("/#{locale}/random/index.html")
end

View file

@ -20,11 +20,12 @@ Ryo.each(name_by_id) do |id, slug|
filename: "surah-stream.html.erb",
locale:,
locales:,
surah: {id:, name:, slug:}
surah: {id:, name:, slug:},
dir: tdata[locale].dir
)
locals = {
locale: context.locale, locales: context.locales,
surah: context.surah, context:
surah: context.surah, dir: context.dir, context:
}
filter(:erb, locals:)
filter(:tidy)

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="<%= locale %>">
<html lang="<%= locale %>" dir="<%= dir %>">
<head>
<title><%= t(locale, "TheNobleQuran") %></title>
<meta name="description" content="<%= t(locale, 'meta.random.description') %>">

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" dir="ltr">
<head>
<title><%= t("en", "TheNobleQuran") %></title>
<%= erb("_revision.html.erb") %>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="<%= locale %>">
<html lang="<%= locale %>" dir="<%= dir %>">
<head>
<title><%= t(locale, "TheNobleQuran") %></title>
<%= inline_css('/css/vendor/postman.css') %>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="<%= locale %>">
<html lang="<%= locale %>" dir="<%= dir %>">
<head>
<title><%= surah.name %></title>
<%= inline_css('/css/vendor/postman.css') %>

View file

@ -1,5 +1,6 @@
{
"en": {
"dir": "ltr",
"TheNobleQuran": "The Noble Quran",
"ChooseRandomChapter": "Select a random surah",
"surah": "Surah",
@ -134,6 +135,7 @@
}
},
"ar": {
"dir": "rtl",
"TheNobleQuran": "القرآن الكريم",
"ChooseRandomChapter": "اختر سورة عشوائية",
"surah": "سورة",
@ -274,6 +276,7 @@
}
},
"fa": {
"dir": "rtl",
"TheNobleQuran": "قرآن کریم",
"ChooseRandomChapter": "یک سوره تصادفی انتخاب کنید",
"surah": "سوره",