Skip to content

Commit 8f7d788

Browse files
authored
Merge pull request #30 from AngleSharp/devel
Release 0.16.0
2 parents 190b69c + 4561071 commit 8f7d788

25 files changed

+318
-5
lines changed

.github/workflows/ci.yml

+38-1
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

+2
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

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 0.16.0
2+
3+
Released on Sunday, June 6 2021.
4+
5+
- Updated to use AngleSharp 0.16
6+
17
# 0.15.0
28

39
Released on Friday, April 23 2021.

docs/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# AngleSharp.Io 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

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: "Getting Started"
3+
section: "AngleSharp.Io"
4+
---
5+
# Getting Started
6+
7+
## Requirements
8+
9+
AngleSharp.Io 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.Io over NuGet
20+
21+
The simplest way of integrating AngleSharp.Io to your project is by using NuGet. You can install AngleSharp.Io by opening the package manager console (PM) and typing in the following statement:
22+
23+
```ps1
24+
Install-Package AngleSharp.Io
25+
```
26+
27+
You can also use the graphical library package manager ("Manage NuGet Packages for Solution"). Searching for "AngleSharp.Io" in the official NuGet online feed will find this library.
28+
29+
## Setting up AngleSharp.Io
30+
31+
To use AngleSharp.Io you need to add it to your `Configuration` coming from AngleSharp itself.
32+
33+
### Requesters
34+
35+
If you just want to use *all* available requesters provided by AngleSharp.Io you can do the following:
36+
37+
```cs
38+
var config = Configuration.Default
39+
.WithRequesters() // from AngleSharp.Io
40+
.WithDefaultLoader(); // from AngleSharp
41+
```
42+
43+
This will register all requesters. Alternatively, the requesters can be provided explicitly. They are located in the `AngleSharp.Io.Network` namespace and have names such as `DataRequester`.
44+
45+
Requesters can make use of `HttpClientHandler` instances. Hence using it, e.g., with a proxy is as simple as the following snippet:
46+
47+
```cs
48+
var handler = new HttpClientHandler
49+
{
50+
Proxy = new WebProxy(myProxyHost, false),
51+
PreAuthenticate = true,
52+
UseDefaultCredentials = false,
53+
};
54+
55+
var config = Configuration.Default
56+
.WithRequesters(handler) // from AngleSharp.Io with a handler config
57+
.WithDefaultLoader();
58+
```
59+
60+
Alternatively, if you don't want to add all possible requesters, you can also just add a single requester from AngleSharp.Io:
61+
62+
```cs
63+
var config = Configuration.Default
64+
.With(new HttpClientRequester()) // only requester
65+
.WithDefaultLoader();
66+
```
67+
68+
In the code above we now only have a single requester - the `HttpClientRequester` coming from AngleSharp.Io. If we have an `HttpClient` already used somewhere we can actually re-use it:
69+
70+
```cs
71+
var config = Configuration.Default
72+
.With(new HttpClientRequester(myHttpClient)) // re-using the HttpClient instance
73+
.WithDefaultLoader();
74+
```
75+
76+
### Cookies
77+
78+
To get improved cookie support, e.g., do
79+
80+
```cs
81+
var config = Configuration.Default
82+
.WithTemporaryCookies(); // Uses memory cookies
83+
```
84+
85+
or if you want to have persistent cookies you can use:
86+
87+
```cs
88+
var syncPath = $"Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)\\anglesharp.cookies";
89+
var config = Configuration.Default
90+
.WithPersistentCookies(syncPath); // Uses sync cookies against the given path
91+
```
92+
93+
Alternatively, the new overloads for the `WithCookies` extension method can be used.
94+
95+
### Downloads
96+
97+
AngleSharp.Io offers you the possibility of a simplified downloading experience. Just use `WithStandardDownload` to redirect resources to a callback.
98+
99+
In the simplest case you can write:
100+
101+
```cs
102+
var config = Configuration.Default
103+
.WithStandardDownload((fileName, content) =>
104+
{
105+
// store fileName with the content stream ...
106+
});
107+
```
108+
109+
Alternatively, use `WithDownload`, which allows you to distinguish also on the provided MIME type.

docs/tutorials/01-API.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "API Documentation"
3+
section: "AngleSharp.Io"
4+
---
5+
# API Documentation
6+
7+
(tbd)

docs/tutorials/02-Examples.md

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

docs/tutorials/03-Questions.md

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

src/AngleSharp.Io.Docs/package.json

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "@anglesharp/io",
3+
"version": "0.16.0",
4+
"preview": true,
5+
"description": "The doclet for the AngleSharp.Io 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.Io.Docs/src/index.tsx

+7
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.Io.Docs/tsconfig.json

+25
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+
}

src/AngleSharp.Io.Tests/Cookie/ParsingTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace AngleSharp.Io.Tests.Cookie
22
{
3+
using AngleSharp.Dom;
34
using AngleSharp.Io.Cookie;
45
using NUnit.Framework;
56
using System;

src/AngleSharp.Io.Tests/Network/AboutTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace AngleSharp.Io.Tests.Network
22
{
3+
using AngleSharp.Dom;
34
using AngleSharp.Io.Network;
45
using NUnit.Framework;
56
using System.Collections.Generic;

src/AngleSharp.Io.Tests/Network/CookieHandlingTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace AngleSharp.Io.Tests.Network
22
{
3+
using AngleSharp.Dom;
34
using NUnit.Framework;
45
using System;
56
using System.Threading.Tasks;

src/AngleSharp.Io.Tests/Network/DataRequesterTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace AngleSharp.Io.Tests.Network
22
{
3+
using AngleSharp.Dom;
34
using AngleSharp.Io;
45
using AngleSharp.Io.Network;
56
using AngleSharp.Text;

src/AngleSharp.Io.Tests/Network/HttpClientRequesterTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace AngleSharp.Io.Tests.Network
22
{
3+
using AngleSharp.Dom;
34
using AngleSharp.Io.Network;
45
using AngleSharp.Io.Tests.Network.Mocks;
56
using FluentAssertions;

src/AngleSharp.Io.Tests/Network/Mocks/HttpMockState.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace AngleSharp.Io.Tests.Network.Mocks
22
{
3+
using AngleSharp.Dom;
34
using AngleSharp.Io.Network;
45
using System;
56
using System.Collections.Generic;

src/AngleSharp.Io.Tests/Network/ResponseTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace AngleSharp.Io.Network.Tests.Integration
22
{
3+
using AngleSharp.Dom;
34
using NUnit.Framework;
45
using System.Collections.Generic;
56

0 commit comments

Comments
 (0)