Skip to content

Commit ab4f810

Browse files
committed
Added category: web
1 parent 00f2cba commit ab4f810

7 files changed

Lines changed: 49 additions & 40 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,8 @@ This category also contains `ascii85`, `adobe`, `[x]btoa`, `zeromq` with the `ba
315315
#### [Others](https://python-codext.readthedocs.io/en/latest/enc/others.html)
316316

317317
- [X] `dna`: implements the 8 rules of DNA sequences (N belongs to [1,8])
318-
- [X] `html`: implements entities according to [this reference](https://dev.w3.org/html5/html-author/charref)
319318
- [X] `letter-indices`: encodes consonants and/or vowels with their corresponding indices
320319
- [X] `markdown`: unidirectional encoding from Markdown to HTML
321-
- [X] `url`: aka URL encoding
322320

323321
#### [Steganography](https://python-codext.readthedocs.io/en/latest/enc/stegano.html)
324322

@@ -330,6 +328,11 @@ This category also contains `ascii85`, `adobe`, `[x]btoa`, `zeromq` with the `ba
330328
- [X] `whitespace`: replaces bits with whitespaces and tabs
331329
- [X] `whitespace_after_before`: variant of `whitespace` ; encodes characters as new characters with whitespaces before and after according to an equation described in the codec name (e.g. "`whitespace+2*after-3*before`")
332330

331+
#### [Web](https://python-codext.readthedocs.io/en/latest/enc/web.html)
332+
333+
- [X] `html`: implements entities according to [this reference](https://dev.w3.org/html5/html-author/charref)
334+
- [X] `url`: aka URL encoding
335+
333336

334337
## :clap: Supporters
335338

codext/others/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: UTF-8 -*-
22
from .dna import *
3-
from .html import *
43
from .letters import *
54
from .markdown import *
6-
from .url import *
75

codext/web/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# -*- coding: UTF-8 -*-
2+
from .html import *
3+
from .url import *
4+
File renamed without changes.

docs/enc/others.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ CACTCGGTCGGCCATATGTTCGGCCATATGTTCGTCTGTTCACTCGCCCATACACT
3131

3232
-----
3333

34-
### HTML Entities
35-
36-
This implements the full list of characters available at [this reference](https://dev.w3.org/html5/html-author/charref).
37-
38-
**Codec** | **Conversions** | **Aliases** | **Comment**
39-
:---: | :---: | --- | ---
40-
`html` | text <-> HTML entities | `html-entity`, `html_entities` | implements entities according to [this reference](https://dev.w3.org/html5/html-author/charref)
41-
42-
```python
43-
>>> codext.encode("Тħĩş Їś ą Ţêšŧ", "html")
44-
'&Tcy;&hstrok;&itilde;&scedil; &YIcy;&sacute; &aogon; &Tcedil;&ecirc;&scaron;&tstrok;'
45-
>>> codext.decode("&Tcy;&hstrok;&itilde;&scedil; &YIcy;&sacute; &aogon; &Tcedil;&ecirc;&scaron;&tstrok;", "html-entities")
46-
'Тħĩş Їś ą Ţêšŧ'
47-
```
48-
49-
-----
50-
5134
### Letter indices
5235

5336
This encodes consonants and/or vowels with their respective indices. This codec is case insensitive, strips white spaces and only applies to letters.
@@ -94,22 +77,3 @@ This is only for "encoding" (converting) Markdown to HTML.
9477
'<h1>Test</h1>\n\n<p>paragraph</p>\n'
9578
```
9679

97-
-----
98-
99-
### URL
100-
101-
This handles URL encoding, regardless of the case when decoding and with no error.
102-
103-
**Codec** | **Conversions** | **Aliases** | **Comment**
104-
:---: | :---: | --- | ---
105-
`url` | text <-> URL encoded text | `url`, `urlencode` |
106-
107-
```python
108-
>>> codecs.encode("?=this/is-a_test/../", "url")
109-
'%3F%3Dthis%2Fis-a_test%2F%2E%2E%2F'
110-
>>> codext.decode("%3F%3Dthis%2Fis-a_test%2F%2E%2E%2F", "urlencode")
111-
'?=this/is-a_test/../'
112-
>>> codext.decode("%3f%3dthis%2fis-a_test%2f%2e%2e%2f", "urlencode")
113-
'?=this/is-a_test/../'
114-
```
115-

docs/enc/web.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Web
2+
3+
`codext` implements some common Web-related encodings.
4+
5+
-----
6+
7+
### HTML Entities
8+
9+
This implements the full list of characters available at [this reference](https://dev.w3.org/html5/html-author/charref).
10+
11+
**Codec** | **Conversions** | **Aliases** | **Comment**
12+
:---: | :---: | --- | ---
13+
`html` | text <-> HTML entities | `html-entity`, `html_entities` | implements entities according to [this reference](https://dev.w3.org/html5/html-author/charref)
14+
15+
```python
16+
>>> codext.encode("Тħĩş Їś ą Ţêšŧ", "html")
17+
'&Tcy;&hstrok;&itilde;&scedil; &YIcy;&sacute; &aogon; &Tcedil;&ecirc;&scaron;&tstrok;'
18+
>>> codext.decode("&Tcy;&hstrok;&itilde;&scedil; &YIcy;&sacute; &aogon; &Tcedil;&ecirc;&scaron;&tstrok;", "html-entities")
19+
'Тħĩş Їś ą Ţêšŧ'
20+
```
21+
22+
-----
23+
24+
### URL
25+
26+
This handles URL encoding, regardless of the case when decoding and with no error.
27+
28+
**Codec** | **Conversions** | **Aliases** | **Comment**
29+
:---: | :---: | --- | ---
30+
`url` | text <-> URL encoded text | `url`, `urlencode` |
31+
32+
```python
33+
>>> codecs.encode("?=this/is-a_test/../", "url")
34+
'%3F%3Dthis%2Fis-a_test%2F%2E%2E%2F'
35+
>>> codext.decode("%3F%3Dthis%2Fis-a_test%2F%2E%2E%2F", "urlencode")
36+
'?=this/is-a_test/../'
37+
>>> codext.decode("%3f%3dthis%2fis-a_test%2f%2e%2e%2f", "urlencode")
38+
'?=this/is-a_test/../'
39+
```
40+

0 commit comments

Comments
 (0)