-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
358 lines (310 loc) · 13.4 KB
/
index.html
File metadata and controls
358 lines (310 loc) · 13.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!DOCTYPE html>
<html>
<head>
<title>MbSoftLab.TemplateEngine.Core</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://jprencipe.bitbucket.io/md-template/css/md-template.css">
<!-- <link rel="stylesheet" href="css/md-template.css">-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/themes/prism.css" rel="stylesheet" type="text/css" />
<!--https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript-->
<link href="https://jprencipe.bitbucket.io/md-template/css/autocomplete.css" rel="stylesheet" type="text/css" />
<script src="https://jprencipe.bitbucket.io/md-template/js/AutoCompleteSuggestionFinder.js"></script>
<script src="https://jprencipe.bitbucket.io/md-template/js/autocomplete.js"></script>
<script type="text/javascript" src="https://jprencipe.bitbucket.io/md-template/js/md-template.js"></script>
<!-- <script type="text/javascript" src="js/md-template.js"></script>-->
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/prism.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/components/prism-csharp.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/components/prism-css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/components/prism-c.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/components/prism-clike.min.js"></script>
<script src="https://raw.githubusercontent.com/bartaz/sandbox.js/master/jquery.highlight.js"></script>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top ">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExample10" aria-controls="navbarsExample10" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="/">
<img src="https://api.nuget.org/v3-flatcontainer/mbsoftlab.templateengine.core/1.0.0/icon"
width="30" height="30" class="d-inline-block align-top" alt="">
MbSoftLab.TemplateEngine.Core
</a>
<div class="collapse navbar-collapse justify-content-md-center" id="navbarsExample10">
<ul class="navbar-nav">
<li class="nav-item active">
<div class="autocomplete nav-item">
<!-- <input class="form-control" type="search" placeholder="Dokumentation durchsuchen..."
aria-label="Search"
id="searcher" name="searcher"
onkeyup="search()"
onchange="search()"
autocomplete="off"
style="width:785px;" />-->
</div>
</li>
</ul>
</div>
</nav>
<div>
<div class="row mt-xl-1">
<div class="col-sm-3" style="border-right:thin;">
<div class="mt-xl-5">
<div style="max-height:15vh;">
<h3 class="margin-top:15px">Table of content</h3>
<input type="text" class="form-control" id="tocSearchInput" onkeyup="searchInToc()" placeholder="search..." title="Type in a category">
</div>
<div class="container overflow-auto" style="max-height:76vh;">
<ul id="toc"></ul>
</div>
</div>
</div>
<div class="col-sm-9">
<div id="content" class="container mt-xl-5 overflow-auto" style="max-height:85vh; max-width:100vw;">
<h1 id="mbsoftlab.templateengine.core">MbSoftLab.TemplateEngine.Core</h1>
<pre><code class="language-csharp">namespace MbSoftLab.TemplateEngine.Core
{
public class TemplateEngine : TemplateEngine<object>{}
public class TemplateEngine<T>{...}
}
</code></pre>
<p>The TemplateEngine replaces values from properties of C# classes in template strings.
The C# class with the data holding properties is called the TemplateDataModel class.
The string with the placeholders is called a string template or template string.</p>
<p>You can bind the value from your C-property to your string template by using <code>${YourPropertyName}</code>.
You can set a custom delimiters. Use the <code>OpeningDelimiter</code> and <code>CloseingDelimiter</code> properties to handle this.</p>
<p>Also you can access parameterless public methods of TemplateDataModell classes by using <code>${MethodName()}</code> in your template.</p>
<p>The default is <code>${</code> for the start delimiter and <code>}</code> for the end delimiter.</p>
<p><img src="https://mbsoftlab.bitbucket.io/MbSoftlab.TemplateEngine.Core/ProblemDescription.PNG" alt="picture of what can done by the TemplateEngine" title="What the Engine can do" /></p>
<pre><code class="language-csharp"> Person person = new Person
{
FirstName = "Jo",
LastName="Doe"
};
string template = "<MyTag>${FirstName}, ${LastName}</MyTag>";
TemplateEngine templateEngine = new TemplateEngine(person,template);
string outputString = templateEngine.CreateStringFromTemplate();
Console.Write(outputString); // Output: <MyTag>Jo, Doe</MyTag>
</code></pre>
<hr />
<h2 id="install-package">Install Package</h2>
<p><strong>NuGet Package:</strong>
<a href="https://www.nuget.org/packages/MbSoftLab.TemplateEngine.Core/">https://www.nuget.org/packages/MbSoftLab.TemplateEngine.Core/</a></p>
<pre><code class="language-PM">PM> Install-Package MbSoftLab.TemplateEngine.Core
</code></pre>
<hr />
<h2 id="methods">Methods</h2>
<table>
<thead>
<tr>
<th>Methodname</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>string CreateStringFromTemplate([string template])</code></td>
<td><em>Creates a String from Datamodell and Template</em></td>
</tr>
<tr>
<td><code>void LoadTemplateFromFile(string filename)</code></td>
<td><em>Loads a Stringtemplate from file</em>.</td>
</tr>
<tr>
<td><code>TemplateEngine()</code></td>
<td>Constructor</td>
</tr>
<tr>
<td><code>TemplateEngine(object templateDataModel, string stringTemplate)</code></td>
<td>Constructor</td>
</tr>
<tr>
<td><code>TemplateEngine(object templateDataModel)</code></td>
<td>Constructor</td>
</tr>
<tr>
<td><code>TemplateEngine<T>()</code></td>
<td>Constructor</td>
</tr>
<tr>
<td><code>TemplateEngine<T>(T templateDataModel, string stringTemplate)</code></td>
<td>Constructor</td>
</tr>
<tr>
<td><code>TemplateEngine<T>(T templateDataModel)</code></td>
<td>Constructor</td>
</tr>
</tbody>
</table>
<hr />
<h2 id="propertys">Propertys</h2>
<table>
<thead>
<tr>
<th>Propertyname</th>
<th>Datatype</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>OpeningDelimiter</code></td>
<td>String</td>
<td>Set the beginning delimiter for propertyreplacement</td>
</tr>
<tr>
<td><code>CloseingDelimiter</code></td>
<td>String</td>
<td>Set the ending delimiter for propertyreplacement</td>
</tr>
<tr>
<td><code>TemplateDataModel</code></td>
<td>Generic / object</td>
<td>Modell with Properys for Dataholding</td>
</tr>
<tr>
<td><code>TemplateString</code></td>
<td>string</td>
<td>Templatestring</td>
</tr>
<tr>
<td><code>NullStringValue</code></td>
<td>string</td>
<td>String for NULL-Values</td>
</tr>
</tbody>
</table>
<hr />
<h2 id="exampels">Exampels</h2>
<h3 id="load-the-template-and-fill-with-data-from-modell"><strong>Load the template and fill with Data from modell</strong></h3>
<pre><code class="language-csharp">// Create a modell Class for Data
TemplateDataModel templateDataModel = new TemplateDataModel
{
ProjektName = "Projektname"
};
string template = "<MyTag>${ProjektName}</MyTag>";
TemplateEngine templateEngine = new TemplateEngine(templateDataModel,template);
string outputString = templateEngine.CreateStringFromTemplate();
Console.Write(outputString); // Ausgabe: <MyTag>Projektname</MyTag>
</code></pre>
<h3 id="load-template-from-file"><strong>Load template from file</strong></h3>
<pre><code class="language-csharp"> TemplateDataModel templateDataModel = new TemplateDataModel
{
ProjektName = "Projektname",
KundeNummer = "1234",
ProjektLink = "https://google.de",
ProjektKuerzel = "PKZL"
};
TemplateEngine templateEngine = new TemplateEngine(templateDataModel);
templateEngine.LoadTemplateFromFile("Html.template.html");
string outputString = templateEngine.CreateStringFromTemplate();
Console.WriteLine(outputString);
</code></pre>
<h3 id="template-and-model-over-propertyinjection"><strong>Template and model over PropertyInjection</strong></h3>
<pre><code class="language-csharp"> TemplateDataModel templateDataModel = new TemplateDataModel
{
ProjectName = "Projectname",
KundeNummer = "1234",
ProjektLink = "https://google.de",
ProjektKuerzel = "PKZL"
};
string template = "<p>${ProjectName}</p>";
TemplateEngine templateEngine = new TemplateEngine();
templateEngine.TemplateDataModel = templateDataModel;
templateEngine.TemplateString = template;
Console.WriteLine(templateEngine.CreateStringFromTemplate());
</code></pre>
<h3 id="template-and-model-over-dependencyinjection"><strong>Template and model over DependencyInjection</strong></h3>
<pre><code class="language-csharp">
TemplateDataModel templateDataModel = new TemplateDataModel
{
ProjectName = "Projectname",
KundeNummer = "1234",
ProjektLink = "https://google.de",
ProjektKuerzel = "PKZL"
};
string template = "<p>${ProjectName}</p>";
TemplateEngine templateEngine = new TemplateEngine(templateDataModel,template);
Console.WriteLine(templateEngine.CreateStringFromTemplate());
</code></pre>
<h3 id="templateengine-with-propertyinjection-and-generic-type"><strong>TemplateEngine with PropertyInjection and generic type</strong></h3>
<pre><code class="language-csharp"> TemplateDataModel templateDataModel = new TemplateDataModel
{
ProjectName = "Projectname",
KundeNummer = null,
ProjektLink = "https://google.de",
ProjektKuerzel = "KZ"
};
string template = "<p>{{ProjectName}}</p><p>{{KundeNummer}}</p>";
TemplateEngine<TemplateDataModel> templateEngine = new TemplateEngine<TemplateDataModel>()
{
TemplateDataModel = templateDataModel,
TemplateString = template,
OpeningDelimiter = "{{",
CloseingDelimiter = "}}",
NullStringValue = "???"
};
Console.WriteLine(templateEngine.CreateStringFromTemplate());
</code></pre>
<hr />
<h2 id="datatype-compatibility">Datatype compatibility</h2>
<ul>
<li>✔ String</li>
<li>✔ Byte</li>
<li>✔ Short</li>
<li>✔ UShort</li>
<li>✔ Long</li>
<li>✔ ULong</li>
<li>✔ SByte</li>
<li>✔ Char</li>
<li>✔ UInt16</li>
<li>✔ Int32</li>
<li>✔ UInt64</li>
<li>✔ Int16</li>
<li>✔ Int32</li>
<li>✔ Int64</li>
<li>✔ Decimal</li>
<li>✔ Double</li>
<li>✔ DateTime</li>
<li>✔ Boolean</li>
<li>❌ Object</li>
<li>❌ CustomClasses</li>
<li>❌ IList, List, Dictionary, IEnumerable, etc..</li>
</ul>
<hr />
<h2 id="repository">Repository</h2>
<p><a href="https://bitbucket.org/MbSoftLab/mbsoftlab.templateengine/src/master/">https://bitbucket.org/MbSoftLab/mbsoftlab.templateengine/src/master/</a></p>
<hr />
<h2 id="issues">Issues</h2>
<p><a href="https://bitbucket.org/MbSoftLab/mbsoftlab.templateengine/issues?status=new&status=open">report an issue</a></p>
<hr />
<h2 id="license">License</h2>
<p>Code licensed under <a href="https://licenses.nuget.org/MIT">MIT</a></p>
<p>Documentation licensed under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0.</a></p>
</div>
</div>
</div>
</div>
<script type="text/javascript">
window.onload = function () {
createTableOfContent();
var autocompleteSuggestionFinder = new AutoCompleteSuggestionFinder("content");
autocomplete(document.getElementById("searcher"), autocompleteSuggestionFinder.getContentWords());
var toggler = document.getElementsByClassName("caret");
var i;
for (i = 0; i < toggler.length; i++) {
toggler[i].addEventListener("click", function () {
this.parentElement.parentElement.querySelector(".nested").classList.toggle("active");
this.classList.toggle("caret-down");
});
}
};
</script>
<footer class="modal-footer">
<p> <a href="">Created with mdoc.exe | md-template v0.0.18</a> </p>
</footer>
</body>
</html>