1
0
Khosrow Moossavi 7 жил өмнө
parent
commit
fe847fb152

+ 19 - 5
Makefile

@@ -1,15 +1,29 @@
+# LESS params
 LESS_DIR = ./static/less
 LESS_FILE = style.less
+LESS_RTL_FILE = style-rtl.less
+
+# CSS params
 CSS_DIR = ./static/css
 CSS_FILE = style.min.css
+CSS_RTL_FILE = style-rtl.min.css
 CSS_TMP_FILE = tmp.css
 
-.PHONY: clean demo build
-
-build: clean
-	lessc $(LESS_DIR)/$(LESS_FILE) > $(CSS_DIR)/$(CSS_TMP_FILE)
-	uglifycss $(CSS_DIR)/$(CSS_TMP_FILE) > $(CSS_DIR)/$(CSS_FILE)
+define build_less
+	lessc $(LESS_DIR)/$(1) > $(CSS_DIR)/$(CSS_TMP_FILE)
+	uglifycss $(CSS_DIR)/$(CSS_TMP_FILE) > $(CSS_DIR)/$(2)
 	rm -f $(CSS_DIR)/$(CSS_TMP_FILE)
+endef
+
+.PHONY: clean demo build build-ltr build-rtl
+
+build: clean build-ltr build-rtl
+
+build-ltr:
+	$(call build_less,$(LESS_FILE),$(CSS_FILE))
+
+build-rtl:
+	$(call build_less,$(LESS_RTL_FILE),$(CSS_RTL_FILE))
 
 demo: build
 	mkdir -p demo/themes/coder

+ 4 - 1
README.md

@@ -46,7 +46,10 @@ pygmentscodefencesguesssyntax = true # Enable syntax guessing for code fences wi
     hideCopyright = false
 
     # Custom CSS
-	custom_css = []
+    custom_css = []
+
+    # RTL support
+    rtl = false
 
 # Social links
 [[params.social]]

+ 4 - 1
exampleSite/config.toml

@@ -24,7 +24,10 @@ disqusShortname = "yourdiscussshortname"
     hideCopyright = false
 
     # Custom CSS
-	custom_css = []
+    custom_css = []
+
+    # RTL support
+    rtl = false
 
 [[params.social]]
     name = "Github"

+ 5 - 1
layouts/_default/baseof.html

@@ -18,6 +18,10 @@
     <link rel="stylesheet" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
     <link rel="stylesheet" href="{{ "css/style.min.css" | absURL }}">
 
+    {{ if .Site.Params.rtl}}
+      <link rel="stylesheet" href="{{ "css/style-rtl.min.css" | absURL }}">
+    {{ end }}
+
     {{ range .Site.Params.custom_css }}
       <link rel="stylesheet" href="{{ . | absURL }}">
     {{ end }}
@@ -33,7 +37,7 @@
     {{ .Hugo.Generator }}
   </head>
 
-  <body>
+  <body class="{{ if .Site.Params.rtl }}rtl{{ end }}">
     <main class="wrapper">
       {{ partial "header.html" . }}
 

+ 1 - 1
layouts/partials/header.html

@@ -4,7 +4,7 @@
       {{ .Site.Title }}
     </a>
     {{ with .Site.Menus.main }}
-    <ul class="navigation-list float-right">
+    <ul class="navigation-list {{ if $.Site.Params.rtl }} float-left {{ else }} float-right {{ end }}">
       {{ range sort . }}
       <li class="navigation-item">
         <a class="navigation-link" href="{{ .URL }}">{{ .Name }}</a>

+ 1 - 0
static/css/style-rtl.min.css

@@ -0,0 +1 @@
+body.rtl{direction:rtl}body.rtl blockquote{border-right:2px solid #dcdcdc;padding-right:1.6rem}body.rtl table tr td:first-child,body.rtl table tr th:first-child{border-right:0}body.rtl table tr td:last-child,body.rtl table tr th:last-child{border-left:0}body.rtl .navigation ul li{float:right}body.rtl .list ul li span{text-align:left;margin-left:3rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){body.rtl .list ul li span{text-align:right}}

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
static/css/style.min.css


+ 5 - 0
static/less/colors.less

@@ -0,0 +1,5 @@
+@bg-color: #fefefe;
+@fg-color: #323232;
+@darker-bg-color: #dcdcdc;
+@darker-fg-color: #000;
+@link-color: #3366CC;

+ 41 - 0
static/less/style-rtl.less

@@ -0,0 +1,41 @@
+@import "colors.less";
+
+body.rtl {
+  direction: rtl;
+
+  blockquote {
+    border-right: 2px solid @darker-bg-color;
+    padding-right: 1.6rem;
+  }
+
+  table tr td:first-child,
+  table tr th:first-child {
+    border-right: 0;
+  }
+  table tr td:last-child,
+  table tr th:last-child {
+      border-left: 0;
+  }
+
+  .navigation {
+    ul {
+      li {
+        float: right;
+      }
+    }
+  }
+
+  .list {
+    ul {
+      li {
+        span {
+          text-align: left;
+          margin-left: 3.0rem;
+          @media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
+            text-align: right;
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 8
static/less/style.less

@@ -1,9 +1,4 @@
-@bg-color: #fefefe;
-@fg-color: #323232;
-@darker-bg-color: #dcdcdc;
-@darker-fg-color: #000;
-@link-color: #3366CC;
-
+@import "colors.less";
 
 *,
 *:after,
@@ -154,7 +149,6 @@ table tr th:last-child {
     border-right: 0;
 }
 
-
 img {
   max-width: 100%;
 }
@@ -299,7 +293,7 @@ img {
       margin: 3.0rem 0 1.0rem 0;
       padding: 0;
       li {
-        display: inline;
+        display: inline-block;
         position: relative;
         a {
           text-transform: uppercase;

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно