Skip to content

Commit 3c0be24

Browse files
authored
Merge pull request #71 from AngleSharp/devel
Release 0.15.1
2 parents 8f959a7 + d209daf commit 3c0be24

File tree

23 files changed

+353
-11
lines changed

23 files changed

+353
-11
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,45 @@ on: [push, pull_request]
55
env:
66
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
8+
DOCS_PATH: ${{ secrets.DOCS_PATH }}
9+
DOCS_BRANCH: ${{ secrets.DOCS_BRANCH }}
810

911
jobs:
12+
can_document:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
value: ${{ steps.check_job.outputs.value }}
16+
steps:
17+
- name: Checks whether documentation can be built
18+
id: check_job
19+
run: |
20+
echo "value: ${{ env.DOCS_PATH != null && github.ref == env.DOCS_BRANCH }}"
21+
echo "::set-output name=value::${{ env.DOCS_PATH != null && github.ref == env.DOCS_BRANCH }}"
22+
23+
documentation:
24+
needs: [can_document]
25+
runs-on: ubuntu-latest
26+
if: needs.can_document.outputs.value == 'true'
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Use Node.js
32+
uses: actions/setup-node@v1
33+
with:
34+
node-version: "14.x"
35+
registry-url: 'https://registry.npmjs.org'
36+
37+
- name: Install Dependencies
38+
run: |
39+
cd $DOCS_PATH
40+
npm install
41+
42+
- name: Deploy Doclet
43+
run: |
44+
cd $DOCS_PATH
45+
npx pilet publish --fresh --url https://feed.piral.cloud/api/v1/pilet/anglesharp --api-key ${{ secrets.PIRAL_FEED_KEY }}
46+
1047
linux:
1148
runs-on: ubuntu-latest
1249

@@ -24,7 +61,7 @@ jobs:
2461

2562
- name: Build
2663
run: |
27-
if ($env:GITHUB_REF -eq "refs/heads/master") {
64+
if ($env:GITHUB_REF -eq "refs/heads/main") {
2865
.\build.ps1 -Target Publish
2966
} elseif ($env:GITHUB_REF -eq "refs/heads/devel") {
3067
.\build.ps1 -Target PrePublish

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ artifacts/
7575
[Tt]ools/
7676
![Tt]ools/packages.config
7777
TestResults/
78+
node_modules
79+
package-lock.json
7880
*.nuget.targets
7981
*.nuget.props
8082
*.nupkg

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 0.15.1
2+
3+
Release on Sunday, June 6 2021.
4+
5+
- Extended values for the `width` declaration (#69)
6+
17
# 0.15.0
28

39
Released on Thursday, April 22 2021.

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ AngleSharp.Css contains code written by (in order of first pull request / commit
99
* [Jochen Kühner](https://github.com/jogibear9988)
1010
* [Tom Hazell](https://github.com/The-Nutty)
1111
* [Michael Ganss](https://github.com/mganss)
12+
* [Gérald Barré](https://github.com/meziantou)
1213

1314
Without these awesome people AngleSharp.Css could not exist. Thanks to everyone for your contributions! :beers:
1415

doc/index.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# AngleSharp.Css Documentation
2+
3+
We have more detailed information regarding the following subjects:
4+
5+
- [API Documentation](tutorials/01-API.md)

docs/general/01-Basics.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: "Getting Started"
3+
section: "AngleSharp.Css"
4+
---
5+
# Getting Started
6+
7+
## Requirements
8+
9+
AngleSharp.Css comes currently in two flavors: on Windows for .NET 4.6 and in general targetting .NET Standard 2.0 platforms.
10+
11+
Most of the features of the library do not require .NET 4.6, which means you could create your own fork and modify it to work with previous versions of the .NET-Framework.
12+
13+
You need to have AngleSharp installed already. This could be done via NuGet:
14+
15+
```ps1
16+
Install-Package AngleSharp
17+
```
18+
19+
## Getting AngleSharp.Css over NuGet
20+
21+
The simplest way of integrating AngleSharp.Css to your project is by using NuGet. You can install AngleSharp.Css by opening the package manager console (PM) and typing in the following statement:
22+
23+
```ps1
24+
Install-Package AngleSharp.Css
25+
```
26+
27+
You can also use the graphical library package manager ("Manage NuGet Packages for Solution"). Searching for "AngleSharp.Css" in the official NuGet online feed will find this library.
28+
29+
## Setting up AngleSharp.Css
30+
31+
To use AngleSharp.Css you need to add it to your `Configuration` coming from AngleSharp itself.
32+
33+
If you just want a configuration *that works* (as close as possible to real browsers) you should use the following code:
34+
35+
```cs
36+
var config = Configuration.Default
37+
.WithCss(); // from AngleSharp.Css
38+
```
39+
40+
This will register a parser for CSS related content. The CSS parsing options and more could be set with parameters of the `WithCss` method.
41+
42+
Alternatively, all the (desired) parts may be registered individually as well. That mostly boils down to three elementary parts:
43+
44+
- A CSS parser (implementing the `ICssParser` interface, e.g., `CssParser`)
45+
- A factory for creating CSS declarations (`IDeclarationFactory`)
46+
- The styling service that can handle CSS documents, see `CssStylingService`
47+
48+
For an interactive DOM (i.e., to handle `style` attribute changes in the HTML document) an observer needs to be registered as well.
49+
50+
Furthermore, for some CSSOM features (e.g., media queries) a render device is required.
51+
52+
```cs
53+
var config = Configuration.Default
54+
.WithCss()
55+
.WithRenderDevice(new DefaultRenderDevice
56+
{
57+
DeviceHeight = 768,
58+
DeviceWidth = 1024,
59+
});
60+
```
61+
62+
If no specific `IRenderDevice` (e.g., via creating an `DefaultRenderDevice` object) instance is created a default implementation will be set.

doc/Values.md renamed to docs/general/02-Values.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "Types of Values"
3+
section: "AngleSharp.Css"
4+
---
15
# Types of Values
26

37
For details see [CSS2 specification](https://www.w3.org/TR/CSS2/cascade.html#value-stages).

doc/API.md renamed to docs/tutorials/01-API.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "API Documentation"
3+
section: "AngleSharp.Css"
4+
---
15
# API Documentation
26

37
## CSSOM - Basics
@@ -25,7 +29,7 @@ AngleSharp uses converters to parse a given source to an `ICssValue` instance. T
2529

2630
The `ICssValue` interface is split in various interfaces with respect to their usage.
2731

28-
![The CSSOM Value Tree](cssom-value-tree.png)
32+
![The CSSOM Value Tree](./cssom-value-tree.png)
2933

3034
A converter may also implement the `IValueAggregator` interface, which indicates that the declaration behind it is actually a shorthand that can additionally merge values into a shorthand representation or split the shorthand representation into the atoms described by the shorthand.
3135

docs/tutorials/02-Examples.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: "Examples"
3+
section: "AngleSharp.Css"
4+
---
5+
# Example Code
6+
7+
This is a (growing) list of examples for every-day usage of AngleSharp.Css.
8+
9+
## Some Example
10+
11+
(tbd)

docs/tutorials/03-Questions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "Questions"
3+
section: "AngleSharp.Css"
4+
---
5+
# Frequently Asked Questions
6+
7+
## What to ask?
8+
9+
(tbd)
File renamed without changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "AngleSharp.Css",
3+
"author": "Florian Rappl",
4+
"branch": "devel",
5+
"repositoryUrl": "https://github.com/AngleSharp/AngleSharp.Css",
6+
"rootDir": "../../",
7+
"outputDir": "./dist",
8+
"sitemap": {
9+
"general": {
10+
"sections": [
11+
{
12+
"generator": "markdown",
13+
"segment": "css",
14+
"dir": "general"
15+
}
16+
]
17+
},
18+
"docs": {
19+
"sections": [
20+
{
21+
"generator": "markdown",
22+
"segment": "css",
23+
"dir": "tutorials"
24+
}
25+
]
26+
}
27+
}
28+
}

src/AngleSharp.Css.Docs/package.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "@anglesharp/css",
3+
"version": "0.16.0",
4+
"preview": true,
5+
"description": "The doclet for the AngleSharp.Css documentation.",
6+
"keywords": [
7+
"pilet"
8+
],
9+
"dependencies": {},
10+
"devDependencies": {
11+
"@anglesharp/website": "1.0.0",
12+
"@types/react": "^17.0.5",
13+
"@types/react-dom": "^17.0.5",
14+
"@types/react-router": "latest",
15+
"@types/react-router-dom": "^5.1.7",
16+
"@types/node": "^15.3.0",
17+
"typescript": "^4.2.4",
18+
"@dbeining/react-atom": "4.1.19",
19+
"@libre/atom": "1.3.3",
20+
"history": "4.10.1",
21+
"react": "17.0.2",
22+
"react-dom": "17.0.2",
23+
"react-router": "5.2.0",
24+
"react-router-dom": "5.2.0",
25+
"tslib": "2.2.0",
26+
"path-to-regexp": "1.8.0",
27+
"piral-cli": "^0.13.3-pre.2480",
28+
"piral-cli-parcel": "^0.13.3-pre.2480"
29+
},
30+
"peerDependencies": {
31+
"@dbeining/react-atom": "*",
32+
"@libre/atom": "*",
33+
"history": "*",
34+
"react": "*",
35+
"react-dom": "*",
36+
"react-router": "*",
37+
"react-router-dom": "*",
38+
"tslib": "*",
39+
"path-to-regexp": "*",
40+
"@anglesharp/website": "*"
41+
},
42+
"scripts": {
43+
"start": "pilet debug",
44+
"build": "pilet build",
45+
"upgrade": "pilet upgrade"
46+
},
47+
"main": "dist/index.js",
48+
"files": [
49+
"dist"
50+
],
51+
"piral": {
52+
"comment": "Keep this section to use the Piral CLI.",
53+
"name": "@anglesharp/website"
54+
},
55+
"peerModules": [
56+
"piral-docs-tools/components"
57+
]
58+
}

src/AngleSharp.Css.Docs/src/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { PiletApi } from 'piral-docs-tools';
2+
3+
const createDoclet = require('piral-docs-tools/doclet');
4+
5+
export function setup(api: PiletApi) {
6+
createDoclet(api);
7+
}

src/AngleSharp.Css.Docs/tsconfig.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true,
4+
"noImplicitAny": false,
5+
"removeComments": false,
6+
"noLib": false,
7+
"emitDecoratorMetadata": true,
8+
"experimentalDecorators": true,
9+
"target": "es6",
10+
"sourceMap": true,
11+
"outDir": "./dist",
12+
"skipLibCheck": true,
13+
"lib": ["dom", "es2018"],
14+
"moduleResolution": "node",
15+
"module": "esnext",
16+
"jsx": "react",
17+
"importHelpers": true
18+
},
19+
"include": [
20+
"./src"
21+
],
22+
"exclude": [
23+
"node_modules"
24+
]
25+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
namespace AngleSharp.Css.Tests.Declarations
2+
{
3+
using NUnit.Framework;
4+
using static CssConstructionFunctions;
5+
6+
[TestFixture]
7+
public class CssWidthPropertyTests
8+
{
9+
[Test]
10+
public void CssWidthPropertyAutoLegal()
11+
{
12+
var snippet = "width: auto";
13+
var property = ParseDeclaration(snippet);
14+
Assert.AreEqual("width", property.Name);
15+
Assert.IsFalse(property.IsImportant);
16+
Assert.IsFalse(property.IsInherited);
17+
Assert.IsTrue(property.HasValue);
18+
Assert.AreEqual("auto", property.Value);
19+
}
20+
21+
[Test]
22+
public void CssWidthPropertyFitContentLegal()
23+
{
24+
var snippet = "width: fit-content";
25+
var property = ParseDeclaration(snippet);
26+
Assert.AreEqual("width", property.Name);
27+
Assert.IsFalse(property.IsImportant);
28+
Assert.IsFalse(property.IsInherited);
29+
Assert.IsTrue(property.HasValue);
30+
Assert.AreEqual("fit-content", property.Value);
31+
}
32+
33+
[Test]
34+
public void CssWidthPropertyValueInPxLegal()
35+
{
36+
var snippet = "width: 42px";
37+
var property = ParseDeclaration(snippet);
38+
Assert.AreEqual("width", property.Name);
39+
Assert.IsFalse(property.IsImportant);
40+
Assert.IsFalse(property.IsInherited);
41+
Assert.IsTrue(property.HasValue);
42+
Assert.AreEqual("42px", property.Value);
43+
}
44+
}
45+
}

src/AngleSharp.Css/Constants/CssKeywords.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,5 +1566,10 @@ public static class CssKeywords
15661566
/// The closed keyword.
15671567
/// </summary>
15681568
public static readonly String Closed = "closed";
1569+
1570+
/// <summary>
1571+
/// The fit-content keyword.
1572+
/// </summary>
1573+
public static readonly String FitContent = "fit-content";
15691574
}
15701575
}

0 commit comments

Comments
 (0)