Skip to content

Commit d87823f

Browse files
committed
Merge branch 'mini-master' into main
2 parents 80fdc49 + 2c0d52f commit d87823f

10 files changed

Lines changed: 446 additions & 117 deletions

File tree

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,32 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);
268268
![after_if](https://user-images.githubusercontent.com/38832863/220125435-72ea24b4-2412-45de-961a-ad4b2134417b.PNG)
269269

270270

271+
### ColorText
272+
273+
##### Example
274+
275+
```csharp
276+
var value = new
277+
{
278+
Company_Name = new MiniWordColorText { Text = "MiniSofteware", FontColor = "#eb70AB", },
279+
Name = new[] {
280+
new MiniWordColorText { Text = "Ja", HighlightColor = "#eb70AB" },
281+
new MiniWordColorText { Text = "ck", HighlightColor = "#a56abe" }
282+
},
283+
CreateDate = new MiniWordColorText
284+
{
285+
Text = new DateTime(2021, 01, 01).ToString(),
286+
HighlightColor = "#eb70AB",
287+
FontColor = "#ffffff",
288+
},
289+
VIP = true,
290+
Points = 123,
291+
APP = "Demo APP",
292+
};
293+
MiniWord.SaveAsByTemplate(path, templatePath, value);
294+
```
295+
296+
271297
## Other
272298

273299
### POCO or dynamic parameter

README.zh-CN.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,122 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);
184184

185185
![image](https://user-images.githubusercontent.com/12729184/190843663-c00baf16-21f2-4579-9d08-996a2c8c549b.png)
186186

187+
### 二级列表
188+
189+
Tag 是 `IEnumerable<MiniWordForeach>` 类别. 使用方式`{{foreach``endforeach}}`.
190+
191+
##### Example
192+
193+
```csharp
194+
var value = new Dictionary<string, object>()
195+
{
196+
["TripHs"] = new List<Dictionary<string, object>>
197+
{
198+
new Dictionary<string, object>
199+
{
200+
{ "sDate", DateTime.Parse("2022-09-08 08:30:00") },
201+
{ "eDate", DateTime.Parse("2022-09-08 15:00:00") },
202+
{ "How", "Discussion requirement part1" },
203+
{
204+
"Details", new List<MiniWordForeach>()
205+
{
206+
new MiniWordForeach()
207+
{
208+
Value = new Dictionary<string, object>()
209+
{
210+
{"Text", "Air"},
211+
{"Value", "Airplane"}
212+
},
213+
Separator = " | "
214+
},
215+
new MiniWordForeach()
216+
{
217+
Value = new Dictionary<string, object>()
218+
{
219+
{"Text", "Parking"},
220+
{"Value", "Car"}
221+
},
222+
Separator = " / "
223+
}
224+
}
225+
}
226+
}
227+
}
228+
};
229+
MiniWord.SaveAsByTemplate(path, templatePath, value);
230+
```
231+
232+
##### Template
233+
234+
![before_foreach](https://user-images.githubusercontent.com/38832863/220123955-063c9345-3998-4fd7-982c-8d1e3b48bbf8.PNG)
235+
236+
##### Result
237+
238+
![after_foreach](https://user-images.githubusercontent.com/38832863/220123960-913a7140-2fa2-415e-bb3e-456e04167382.PNG)
239+
240+
### 条件判断
241+
242+
`@if``@endif` tags .
243+
244+
##### Example
245+
246+
```csharp
247+
var value = new Dictionary<string, object>()
248+
{
249+
["Name"] = new List<MiniWordHyperLink>(){
250+
new MiniWordHyperLink(){
251+
Url = "https://google.com",
252+
Text = "測試連結22!!"
253+
},
254+
new MiniWordHyperLink(){
255+
Url = "https://google1.com",
256+
Text = "測試連結11!!"
257+
}
258+
},
259+
["Company_Name"] = "MiniSofteware",
260+
["CreateDate"] = new DateTime(2021, 01, 01),
261+
["VIP"] = true,
262+
["Points"] = 123,
263+
["APP"] = "Demo APP",
264+
};
265+
MiniWord.SaveAsByTemplate(path, templatePath, value);
266+
```
267+
268+
##### Template
269+
270+
![before_if](https://user-images.githubusercontent.com/38832863/220125429-7dd6ce94-35c6-478e-8903-064f9cf9361a.PNG)
271+
272+
##### Result
273+
274+
![after_if](https://user-images.githubusercontent.com/38832863/220125435-72ea24b4-2412-45de-961a-ad4b2134417b.PNG)
275+
276+
### 多彩字体
277+
278+
##### 代码例子
279+
280+
```csharp
281+
var value = new
282+
{
283+
Company_Name = new MiniWordColorText { Text = "MiniSofteware", FontColor = "#eb70AB", },
284+
Name = new[] {
285+
new MiniWordColorText { Text = "Ja", HighlightColor = "#eb70AB" },
286+
new MiniWordColorText { Text = "ck", HighlightColor = "#a56abe" }
287+
},
288+
CreateDate = new MiniWordColorText
289+
{
290+
Text = new DateTime(2021, 01, 01).ToString(),
291+
HighlightColor = "#eb70AB",
292+
FontColor = "#ffffff",
293+
},
294+
VIP = true,
295+
Points = 123,
296+
APP = "Demo APP",
297+
};
298+
MiniWord.SaveAsByTemplate(path, templatePath, value);
299+
```
300+
301+
302+
187303

188304

189305
## 其他

README.zh-Hant.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,122 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);
184184

185185

186186

187+
### 二级列表
188+
189+
Tag 是 `IEnumerable<MiniWordForeach>` 类别. 使用方式`{{foreach``endforeach}}`.
190+
191+
##### Example
192+
193+
```csharp
194+
var value = new Dictionary<string, object>()
195+
{
196+
["TripHs"] = new List<Dictionary<string, object>>
197+
{
198+
new Dictionary<string, object>
199+
{
200+
{ "sDate", DateTime.Parse("2022-09-08 08:30:00") },
201+
{ "eDate", DateTime.Parse("2022-09-08 15:00:00") },
202+
{ "How", "Discussion requirement part1" },
203+
{
204+
"Details", new List<MiniWordForeach>()
205+
{
206+
new MiniWordForeach()
207+
{
208+
Value = new Dictionary<string, object>()
209+
{
210+
{"Text", "Air"},
211+
{"Value", "Airplane"}
212+
},
213+
Separator = " | "
214+
},
215+
new MiniWordForeach()
216+
{
217+
Value = new Dictionary<string, object>()
218+
{
219+
{"Text", "Parking"},
220+
{"Value", "Car"}
221+
},
222+
Separator = " / "
223+
}
224+
}
225+
}
226+
}
227+
}
228+
};
229+
MiniWord.SaveAsByTemplate(path, templatePath, value);
230+
```
231+
232+
##### Template
233+
234+
![before_foreach](https://user-images.githubusercontent.com/38832863/220123955-063c9345-3998-4fd7-982c-8d1e3b48bbf8.PNG)
235+
236+
##### Result
237+
238+
![after_foreach](https://user-images.githubusercontent.com/38832863/220123960-913a7140-2fa2-415e-bb3e-456e04167382.PNG)
239+
240+
### 条件判断
241+
242+
`@if``@endif` tags .
243+
244+
##### Example
245+
246+
```csharp
247+
var value = new Dictionary<string, object>()
248+
{
249+
["Name"] = new List<MiniWordHyperLink>(){
250+
new MiniWordHyperLink(){
251+
Url = "https://google.com",
252+
Text = "測試連結22!!"
253+
},
254+
new MiniWordHyperLink(){
255+
Url = "https://google1.com",
256+
Text = "測試連結11!!"
257+
}
258+
},
259+
["Company_Name"] = "MiniSofteware",
260+
["CreateDate"] = new DateTime(2021, 01, 01),
261+
["VIP"] = true,
262+
["Points"] = 123,
263+
["APP"] = "Demo APP",
264+
};
265+
MiniWord.SaveAsByTemplate(path, templatePath, value);
266+
```
267+
268+
##### Template
269+
270+
![before_if](https://user-images.githubusercontent.com/38832863/220125429-7dd6ce94-35c6-478e-8903-064f9cf9361a.PNG)
271+
272+
##### Result
273+
274+
![after_if](https://user-images.githubusercontent.com/38832863/220125435-72ea24b4-2412-45de-961a-ad4b2134417b.PNG)
275+
276+
### 多彩字體
277+
278+
##### 例子
279+
280+
```csharp
281+
var value = new
282+
{
283+
Company_Name = new MiniWordColorText { Text = "MiniSofteware", FontColor = "#eb70AB", },
284+
Name = new[] {
285+
new MiniWordColorText { Text = "Ja", HighlightColor = "#eb70AB" },
286+
new MiniWordColorText { Text = "ck", HighlightColor = "#a56abe" }
287+
},
288+
CreateDate = new MiniWordColorText
289+
{
290+
Text = new DateTime(2021, 01, 01).ToString(),
291+
HighlightColor = "#eb70AB",
292+
FontColor = "#ffffff",
293+
},
294+
VIP = true,
295+
Points = 123,
296+
APP = "Demo APP",
297+
};
298+
MiniWord.SaveAsByTemplate(path, templatePath, value);
299+
```
300+
301+
302+
187303
## 其他
188304

189305
### POCO or dynamic 參數

release-note/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
---
2424

2525

26-
### 0.6.2
26+
### 0.7.0
2727
- [New] Add support to List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)
2828
- [New] Add support to @if statements inside templates (via @eynarhaji)
29+
- [New] Support multiple color word by word (via @andy505050)
2930

3031
### 0.6.1
3132
- [Bug] Fixed system does not support `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)

release-note/README.zh-CN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222

2323
---
2424

25+
### 0.7.0
26+
- [New] 支持 List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)
27+
- [New] 支持 @if statements inside templates (via @eynarhaji)
28+
- [New] 支持 multiple color word by word (via @andy505050)
29+
2530
### 0.6.1
2631
- [Bug] 修正系统不支持 `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)
2732

release-note/README.zh-Hant.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222

2323
---
2424

25+
### 0.7.0
26+
- [New] 支持 List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)
27+
- [New] 支持 @if statements inside templates (via @eynarhaji)
28+
- [New] 支持 multiple color word by word (via @andy505050)
29+
2530
### 0.6.1
2631
- [Bug] 修正系統不支持 `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)
2732

src/MiniWord/Extensions/ObjectExtension.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ internal static Dictionary<string, object> ToDictionary(this object value)
7878
}
7979
internal static bool IsStrongTypeEnumerable(this object obj)
8080
{
81-
return obj is IEnumerable && !(obj is string) && !(obj is char[]) && !(obj is string[]);
82-
}
81+
return obj is IEnumerable && !(obj is string) && !(obj is char[]) && !(obj is string[]) && !(obj is MiniWordColorText[]);
82+
}
8383
}
8484
}

0 commit comments

Comments
 (0)