Skip to content

Commit 17982ff

Browse files
committed
docs for releasing 2.0
1 parent d410370 commit 17982ff

File tree

3 files changed

+39
-47
lines changed

3 files changed

+39
-47
lines changed
File renamed without changes.

docs/tag.md

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,27 @@ _return to [overview](https://github.com/DNN-Connect/razor-blade)_
66

77
## The `Tag` Object
88

9-
The `Tag` object is the engine which generates HtmlTags inside _RazorBlade_ and a powerfull API will let you build html from code. These docs will give you what you need to leverage the object. Here you'll find
9+
The `Tag` object is the engine which generates Html tags inside _RazorBlade_ and a powerfull API will let you build html from code. These docs will give you what you need to leverage the object. Here you'll find
1010

1111
1. a Quick-Reference for the common API
1212
2. more instructions for doing specific things
1313
3. advanced API for special stuff
1414

1515
To see this in action with many examples, visit the [RazorBlade Tutorials](https://2sxc.org/dnn-tutorials/en/razor/blade/home) on [2sxc.org](https://2sxc.org/).
1616

17-
## Quick-Reference: Fluent `Tag` Methods with Chaining
17+
## How to get Tag Objects
1818

19-
All these methods below change the object, and return the object itself again. This fluent-API allows chaining them together, like `myImg.Id("someId").Class("float-right")`.
19+
The following APIs will get you `Tag` objects:
20+
21+
1. `Tags.Tag(string tagName)` ([more](tags.md))
22+
2. `new Tag(...)` (see below)
23+
<!-- 3. `new ***(...)` ([more TODO HTML5](html5.md)) -->
24+
25+
## Understanding the Fluent API for `Tag` (Chaining)
26+
27+
All these methods below change the object, and return the object itself again. This fluent-API allows chaining them together, like `someTag.Id("someId").Class("float-right")`.
2028

21-
### Modifying Tag Attributes
29+
## Modifying Tag Attributes
2230

2331
1. `Attr(name, [value], [separator])`
2432
add an attribute - if it already exists, it will replace the value, unless a separator is specified which will then append the new value.
@@ -40,7 +48,7 @@ set / add a class to the tag; if called multiple times, will append with a semic
4048
1. `Title(value)`
4149
set the title attribute - if called multiple times, will always replace previous title
4250

43-
### Modifying the Tag Contents
51+
## Modifying the Tag Contents
4452

4553
1. `Add(value)`
4654
Add something to contents - at the end of existing content.
@@ -49,7 +57,9 @@ Add something to contents - at the end of existing content.
4957
Replaces the content
5058
* `value` _string | `Tag` | `IEnumerable<Tag>`_
5159

52-
### Output/Render API
60+
## Output/Render API
61+
62+
A `Tag` object and the two properties `.Open` and `.Close` all support `IHtmlString`, so you can output them directly:
5363

5464
1. `@myTag`
5565
will render the tag into the html. Implements IHtmlString and will not be encoded.
@@ -58,19 +68,6 @@ will render the opening tag to html. Implements IHtmlString and will not be enco
5868
3. `myTag.Close`
5969
will render the close-tag to html. Implements IHtmlString and will not be encoded.
6070

61-
## How to do Common Things
62-
63-
### How to get Tag Objects
64-
65-
The following APIs will get you `Tag` objects:
66-
67-
1. `Tags.Tag(...)` ([more](tags.md))
68-
2. `new Tag(...)` ([more](tag.md))
69-
3. `new ***(...)` ([more TODO HTML5](htmltags.md))
70-
71-
### How to Render (output) Tag Objects
72-
73-
All `Tag` Objects will directly output to Html since it implements `IHtmlString` both in .net 4 and .net core, so all you need is `@myTag` to render it. If you need to have the open/close tag separately, you can also use `@myTag.Open` or `@myTag.Close`. Here's an example:
7471

7572
```razor
7673
@using Connect.Razor.Blade;
@@ -84,11 +81,7 @@ All `Tag` Objects will directly output to Html since it implements `IHtmlString`
8481
@myStyle.Close
8582
```
8683

87-
## Fluent `Tag` API
88-
89-
90-
91-
## `Tag` Constructors
84+
## Deep Dive to `Tag` Constructors
9285

9386
In most cases you'll use `Tags.Tag(...)` ([more](tags.md)) to create a tag, since it's nicer. But for advanced cases, you can use one of these constructors:
9487

@@ -116,11 +109,13 @@ These properties are for doing advanced stuff and not to be treated as final. We
116109
4. `TagName` _`string` get/set_
117110
5. `TagOverride` _`string` get/set, default `null`_ if not null will be rendered instead of what's normally in the tag. This is used for _verbatim_ tags like comments.
118111

119-
## Tag Objects in HtmlTags _(new in 1.2)_
112+
## Tag Objects _(WIP for 2.1)_
120113

121-
Note that all these tag objects are of type `Tag`, so you can do further manipulation to them as explained below:
114+
Note that all these tag objects are of type `Tag`, so you can do further manipulation to them as explained below. In 2.1 we want to release all tags which are part of the HTML5 standard.
122115

123-
### Basic Tags
116+
...todo WIP
117+
118+
<!-- ### Basic Tags
124119
125120
Note that when you see `[content]`, this means you can pass in optional content into the tag. This can be a string, or another tag.
126121
@@ -146,14 +141,14 @@ Note that when you see `[content]`, this means you can pass in optional content
146141
1. `Script`
147142
2. `Img`
148143
3. `Picture`
149-
4. etc.
144+
4. etc. -->
150145

151146

152147
## Options When Generating Attributes and Tags
153148

154149
Options like `AttributeOptions` and `TagOptions` are an optional parameter in all generator-commands. It allows you to change how attributes are generated, but remember that the default is well thought through, so you usually won't need to use it.
155150

156-
### AttributeOptions _(new in 1.3)_
151+
### AttributeOptions _(new in 2.0)_
157152

158153
The object has the following properties and defaults:
159154

@@ -182,4 +177,6 @@ This is how you would use these:
182177
<div @Attribute("data", "45", options)></div>
183178
```
184179

185-
### TagOptions _(new in 1.2)_ - todo!
180+
### TagOptions _(new in 2.0)_
181+
182+
todo: documentation

readme.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="docs/assets/razor-blade-logo.png" width="100%">
22

3-
# Razor Blade v1.2 stable (1.3 WIP)
3+
# Razor Blade v2.0
44

55
A library of common functions for Razor, to lighten Razor templates and make work easier. Some examples:
66

@@ -76,13 +76,13 @@ This is a short summary of the most used variations of the helpers. Further deta
7676

7777
1. **Tags** - see [detailed docs](docs/tags.md)
7878
1. `Tags.Br2Nl(text)`
79-
1. `Tags.Br2Space(text)`
80-
1. `Tags.Nl2Br(text)`
81-
1. `Tags.Strip(text)`
82-
1. `Tags.Encode(...)` _v1.2_
83-
1. `Tags.Decode(...)` _v1.2_
84-
1. `Tags.Attribute(...)` _v1.3_
85-
1. `Tags.Tag(...)` _v1.3_
79+
2. `Tags.Br2Space(text)`
80+
3. `Tags.Nl2Br(text)`
81+
4. `Tags.Strip(text)`
82+
5. `Tags.Encode(...)` _v1.2_
83+
6. `Tags.Decode(...)` _v1.2_
84+
7. `Tags.Attribute(...)` _v2.0_
85+
8. `Tags.Tag(...)` with fluent API - [docs](docs/tag.md) _v2.0_
8686

8787
2. **Text** - see [detailed docs](docs/text.md)
8888
1. `Text.Crop(string, length)`
@@ -101,23 +101,18 @@ This is a short summary of the most used variations of the helpers. Further deta
101101
7. `AddToHead(tagString)` add any tag string into the page `<head>` section
102102
8. `GetPage()` (WIP)
103103

104-
4. **.HtmlTags** namespace - build safe html in code _new in 1.3_
105-
1. Tool to create Html on the fly
106-
1. `HtmlTools.Attribute(name, value, [options])`
107-
2. `HtmlTools.Attributes(attributesList, [options])`
108-
2. `Tag` class - generic tag which is rendered as html
109104

110-
111-
## Work in Progress v1.4/1.5
105+
## Work in Progress v2.1 / 2.2
112106

113107
* `HtmlPage.AddIcon(...)` - add a single icon header
114108
* `HtmlPage.AddIcons(...)` - add a default set of optimal icon headers
109+
* Typed tag objects for everything in HTML5 like `Img`, `Meta`, etc.
115110

116-
## Work in Progress v1.5+ (WIP / in discussion)
111+
## Work in Progress v2.5+ (WIP / in discussion)
117112

118113
1. **Url**
119114
1. SeoFragment(string) - in discussion, would take a string and save-convert it so it can be added to a url for SEO.
120-
1. AddParameters(...) - would add more url-parameters, and ensure that it only has one ? etc.
115+
2. AddParameters(...) - would add more url-parameters, and ensure that it only has one ? etc.
121116

122117
## Ideas to discuss
123118

0 commit comments

Comments
 (0)