-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Generate the charset tables dynamically from codes #3409
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2233147
DOC: Generate the charset tables dynamically in the documentation
seisman 0781417
Merge branch 'main' into doc/encodings
seisman 3b32be4
Set alignments of table cells
seisman 5d6eb1c
Add styles for text alignment
seisman 738dda6
Improve comments
seisman 6ea7d15
Improve the script for the encoding table
seisman 2923b2f
Write links in markdown in 'encodings'
yvonnefroehlich 1ec6557
Remove underscores
yvonnefroehlich 2b4b956
Merge branch 'main' into doc/encodings
seisman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
--- | ||
file_format: mystnb | ||
--- | ||
|
||
```{code-cell} | ||
--- | ||
tags: [remove-input] | ||
--- | ||
from IPython.display import display, Markdown | ||
from pygmt.encodings import charset | ||
|
||
|
||
def get_charset_mdtable(name): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is modified from the original script at #3206 (comment) |
||
""" | ||
Create a markdown table for a charset. | ||
""" | ||
mappings = charset[name] | ||
|
||
undefined = "\ufffd" | ||
text = "| octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |\n" | ||
text += "|---|---|---|---|---|---|---|---|---|\n" | ||
for i in range(0o00, 0o400, 8): | ||
chars = [mappings.get(j, undefined) for j in range(i, i + 8)] | ||
if chars == [undefined] * 8: | ||
continue | ||
chars = [f"&#x{ord(char):04x};" for char in chars] | ||
row = f"\\{i:03o}"[:-1] + "x" | ||
text += f"| **{row}** | {' | '.join(chars)} |\n" | ||
text += "\n" | ||
return Markdown(text) | ||
``` | ||
|
||
# Supported Encodings and Non-ASCII Characters | ||
|
||
GMT supports a number of encodings and each encoding contains a set of ASCII and | ||
|
@@ -10,100 +42,33 @@ that the character is not defined in the encoding. | |
|
||
## Adobe ISOLatin1+ Encoding | ||
|
||
| octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | ||
|---|---|---|---|---|---|---|---|---| | ||
| **\03x** | � | • | … | ™ | — | – | fi | ž | | ||
| **\04x** |   | ! | " | # | $ | % | & | ’ | | ||
| **\05x** | ( | ) | * | + | , | - | . | / | | ||
| **\06x** | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | ||
| **\07x** | 8 | 9 | : | ; | < | = | > | ? | | ||
| **\10x** | @ | A | B | C | D | E | F | G | | ||
| **\11x** | H | I | J | K | L | M | N | O | | ||
| **\12x** | P | Q | R | S | T | U | V | W | | ||
| **\13x** | X | Y | Z | [ | \ | ] | ^ | _ | | ||
| **\14x** | ‘ | a | b | c | d | e | f | g | | ||
| **\15x** | h | i | j | k | l | m | n | o | | ||
| **\16x** | p | q | r | s | t | u | v | w | | ||
| **\17x** | x | y | z | { | | | } | ~ | š | | ||
| **\20x** | Œ | † | ‡ | Ł | ⁄ | ‹ | Š | › | | ||
| **\21x** | œ | Ÿ | Ž | ł | ‰ | „ | “ | ” | | ||
| **\22x** | ı | ` | ´ | ^ | ˜ | ¯ | ˘ | ˙ | | ||
| **\23x** | ¨ | ‚ | ˚ | ¸ | ' | ˝ | ˛ | ˇ | | ||
| **\24x** | � | ¡ | ¢ | £ | ¤ | ¥ | ¦ | § | | ||
| **\25x** | ¨ | © | ª | « | ¬ | ­ | ® | ¯ | | ||
| **\26x** | ° | ± | ² | ³ | ´ | µ | ¶ | · | | ||
| **\27x** | ¸ | ¹ | º | » | ¼ | ½ | ¾ | ¿ | | ||
| **\30x** | À | Á | Â | Ã | Ä | Å | Æ | Ç | | ||
| **\31x** | È | É | Ê | Ë | Ì | Í | Î | Ï | | ||
| **\32x** | Ð | Ñ | Ò | Ó | Ô | Õ | Ö | × | | ||
| **\33x** | Ø | Ù | Ú | Û | Ü | Ý | Þ | ß | | ||
| **\34x** | à | á | â | ã | ä | å | æ | ç | | ||
| **\35x** | è | é | ê | ë | ì | í | î | ï | | ||
| **\36x** | ð | ñ | ò | ó | ô | õ | ö | ÷ | | ||
| **\37x** | ø | ù | ú | û | ü | ý | þ | ÿ | | ||
```{code-cell} | ||
--- | ||
tags: [remove-input] | ||
--- | ||
display(get_charset_mdtable("ISOLatin1+")) | ||
``` | ||
|
||
## Adobe Symbol Encoding | ||
|
||
| octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | ||
|---|---|---|---|---|---|---|---|---| | ||
| **\04x** |   | ! | ∀ | # | ∃ | % | & | ∋ | | ||
| **\05x** | ( | ) | ∗ | + | , | − | . | / | | ||
| **\06x** | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | ||
| **\07x** | 8 | 9 | : | ; | < | = | > | ? | | ||
| **\10x** | ≅ | Α | Β | Χ | ∆ | Ε | Φ | Γ | | ||
| **\11x** | Η | Ι | ϑ | Κ | Λ | Μ | Ν | Ο | | ||
| **\12x** | Π | Θ | Ρ | Σ | Τ | Υ | ς | Ω | | ||
| **\13x** | Ξ | Ψ | Ζ | [ | ∴ | ] | ⊥ | _ | | ||
| **\14x** |  | α | β | χ | δ | ε | φ | γ | | ||
| **\15x** | η | ι | ϕ | κ | λ | μ | ν | ο | | ||
| **\16x** | π | θ | ρ | σ | τ | υ | ϖ | ω | | ||
| **\17x** | ξ | ψ | ζ | { | | | } | ∼ | � | | ||
| **\24x** | € | ϒ | ′ | ≤ | ∕ | ∞ | ƒ | ♣ | | ||
| **\25x** | ♦ | ♥ | ♠ | ↔ | ← | ↑ | → | ↓ | | ||
| **\26x** | ° | ± | ″ | ≥ | × | ∝ | ∂ | • | | ||
| **\27x** | ÷ | ≠ | ≡ | ≈ | … | ⏐ | ⎯ | ↵ | | ||
| **\30x** | ℵ | ℑ | ℜ | ℘ | ⊗ | ⊕ | ∅ | ∩ | | ||
| **\31x** | ∪ | ⊃ | ⊇ | ⊄ | ⊂ | ⊆ | ∈ | ∉ | | ||
| **\32x** | ∠ | ∇ | ® | © | ™ | ∏ | √ | ⋅ | | ||
| **\33x** | ¬ | ∧ | ∨ | ⇔ | ⇐ | ⇑ | ⇒ | ⇓ | | ||
| **\34x** | ◊ | 〈 | ® | © | ™ | ∑ | ⎛ | ⎜ | | ||
| **\35x** | ⎝ | ⎡ | ⎢ | ⎣ | ⎧ | ⎨ | ⎩ | ⎪ | | ||
| **\36x** | � | 〉 | ∫ | ⌠ | ⎮ | ⌡ | ⎞ | ⎟ | | ||
| **\37x** | ⎠ | ⎤ | ⎥ | ⎦ | ⎫ | ⎬ | ⎭ | � | | ||
|
||
**Note**: The octal code `\140` represents the RADICAL EXTENDER character, which is not available in | ||
the Unicode character set. | ||
```{code-cell} | ||
--- | ||
tags: [remove-input] | ||
--- | ||
display(get_charset_mdtable("Symbol")) | ||
``` | ||
|
||
**Note**: The octal code `\140` represents the RADICAL EXTENDER character, which is not | ||
available in the Unicode character set. | ||
|
||
## Adobe ZapfDingbats Encoding | ||
|
||
| octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | ||
|---|---|---|---|---|---|---|---|---| | ||
| **\04x** |   | ✁ | ✂ | ✃ | ✄ | ☎ | ✆ | ✇ | | ||
| **\05x** | ✈ | ✉ | ☛ | ☞ | ✌ | ✍ | ✎ | ✏ | | ||
| **\06x** | ✐ | ✑ | ✒ | ✓ | ✔ | ✕ | ✖ | ✗ | | ||
| **\07x** | ✘ | ✙ | ✚ | ✛ | ✜ | ✝ | ✞ | ✟ | | ||
| **\10x** | ✠ | ✡ | ✢ | ✣ | ✤ | ✥ | ✦ | ✧ | | ||
| **\11x** | ★ | ✩ | ✪ | ✫ | ✬ | ✭ | ✮ | ✯ | | ||
| **\12x** | ✰ | ✱ | ✲ | ✳ | ✴ | ✵ | ✶ | ✷ | | ||
| **\13x** | ✸ | ✹ | ✺ | ✻ | ✼ | ✽ | ✾ | ✿ | | ||
| **\14x** | ❀ | ❁ | ❂ | ❃ | ❄ | ❅ | ❆ | ❇ | | ||
| **\15x** | ❈ | ❉ | ❊ | ❋ | ● | ❍ | ■ | ❏ | | ||
| **\16x** | ❐ | ❑ | ❒ | ▲ | ▼ | ◆ | ❖ | ◗ | | ||
| **\17x** | ❘ | ❙ | ❚ | ❛ | ❜ | ❝ | ❞ | � | | ||
| **\20x** | ❨ | ❩ | ❪ | ❫ | ❬ | ❭ | ❮ | ❯ | | ||
| **\21x** | ❰ | ❱ | ❲ | ❳ | ❴ | ❵ | � | � | | ||
| **\24x** | � | ❡ | ❢ | ❣ | ❤ | ❥ | ❦ | ❧ | | ||
| **\25x** | ♣ | ♦ | ♥ | ♠ | ① | ② | ③ | ④ | | ||
| **\26x** | ⑤ | ⑥ | ⑦ | ⑧ | ⑨ | ⑩ | ❶ | ❷ | | ||
| **\27x** | ❸ | ❹ | ❺ | ❻ | ❼ | ❽ | ❾ | ❿ | | ||
| **\30x** | ➀ | ➁ | ➂ | ➃ | ➄ | ➅ | ➆ | ➇ | | ||
| **\31x** | ➈ | ➉ | ➊ | ➋ | ➌ | ➍ | ➎ | ➏ | | ||
| **\32x** | ➐ | ➑ | ➒ | ➓ | ➔ | → | ↔ | ↕ | | ||
| **\33x** | ➘ | ➙ | ➚ | ➛ | ➜ | ➝ | ➞ | ➟ | | ||
| **\34x** | ➠ | ➡ | ➢ | ➣ | ➤ | ➥ | ➦ | ➧ | | ||
| **\35x** | ➨ | ➩ | ➪ | ➫ | ➬ | ➭ | ➮ | ➯ | | ||
| **\36x** | � | ➱ | ➲ | ➳ | ➴ | ➵ | ➶ | ➷ | | ||
| **\37x** | ➸ | ➹ | ➺ | ➻ | ➼ | ➽ | ➾ | � | | ||
```{code-cell} | ||
--- | ||
tags: [remove-input] | ||
--- | ||
display(get_charset_mdtable("ZapfDingbats")) | ||
``` | ||
|
||
## ISO/IEC 8859 | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value is
'commonmark'
, which doesn't support tables.