-
Notifications
You must be signed in to change notification settings - Fork 5
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
Added array containing all
blocks
#3
base: master
Are you sure you want to change the base?
Conversation
FYI: I need this functionally for my Glyphana unicode viewer. I figured it is generally useful enough to put it in your crate rather than just have the resp. array in my app's code. |
@@ -13,3 +13,8 @@ license = "MIT" | |||
include = ["src/**/*", "Cargo.toml", "README.md", "LICENSE"] | |||
|
|||
[dependencies] | |||
|
|||
[features] | |||
default = [] |
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.
This line can be removed.
|
||
[![CI](https://github.com/magiclen/unicode-blocks/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/unicode-blocks/actions/workflows/ci.yml) | ||
[![Documentation](https://docs.rs/unicode-blocks/badge.svg)](https://docs.rs/unicode-blocks) |
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.
I'm not used to using this badge.
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.
I'm not used to using this badge.
Most users are though.
If you look at the average popular crate updated in the last two years on crates.io
, you'll probably see badges for build/CI status, crates.io
version and docs.rs
link at the top of the README.
The latter two are for people coming to/accrorss the crate via the repo and not via crates.io
. I.e. they will have to dig to find out if this is a published crate at all and if there are docs (the former does not imply the latter, some crates have shoddy docs or the docs.rs
build fails).
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.
Fair enough, I will think about it.
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.
I don't know if shields.io is trustworthy. Displaying their badges might be promoting their services.
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.
Good point.
It's seems what most Rust crate repos on GH are using.
I used something else two years back (forgot the name) but that stopped working some time ago so I switched to shields.io
just copying what I saw in others's READMEs.
|
||
[![CI](https://github.com/magiclen/unicode-blocks/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/unicode-blocks/actions/workflows/ci.yml) | ||
[![Documentation](https://docs.rs/unicode-blocks/badge.svg)](https://docs.rs/unicode-blocks) | ||
[![Crate](https://img.shields.io/crates/v/unicode-blocks.svg)](https://crates.io/crates/unicode-blocks) |
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.
I'm not used to using this badge.
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.
See above.
assert!(unicode_blocks::is_cjk_block(unicode_blocks::CJK_UNIFIED_IDEOGRAPHS)); | ||
assert!( | ||
unicode_blocks::is_cjk_block(unicode_blocks::CJK_UNIFIED_IDEOGRAPHS) | ||
); |
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.
Why do we need to use line breaks?
## Documentation | ||
|
||
https://docs.rs/unicode-blocks | ||
|
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.
All my crates on crates.io have them in README.md
and therefore I don't want to remove them.
&YI_SYLLABLES, | ||
&ZANABAZAR_SQUARE, | ||
&ZNAMENNY_MUSICAL_NOTATION, | ||
]; |
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.
Why not order by the block range?
By the way, I generate UnicodeBlock
by using another Rust program which I haven't open-sourced. If we need an array of UnicodeBlock
s, this array should also be generated by it.
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.
Why not order by the block range?
I guess the order depends on the application. For my case it didn't really matter. So sure, the refs could as well be ordered by block range.
By the way, I generate UnicodeBlock by using another Rust program which I haven't open-sourced. If we need an array of UnicodeBlocks, this array should also be generated by it.
I agree. It would be nice to include your generator in this crate so people submitting PRs like mine could extend the generator.
This crate contains a list of all unicode blocks and provides some functions to search across them. | ||
This crate contains a list of all unicode blocks and provides some functions | ||
to search across them. | ||
|
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.
I don't wrap comments.
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.
Ah, sorry about that. That was habitual. :)
``` | ||
assert!( | ||
unicode_blocks::is_cjk_block(unicode_blocks::CJK_UNIFIED_IDEOGRAPHS) | ||
); | ||
``` |
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.
Again, I don't see the benefits of using line breaks here.
|
||
## Examples | ||
|
||
#### Given a character, determine what unicode block contains it. | ||
|
||
```rust | ||
assert_eq!(unicode_blocks::BASIC_LATIN, unicode_blocks::find_unicode_block('A').unwrap()); | ||
``` |
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.
I prefer using ```rust
.
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.
Just curious: why the reduncancy? Your crate is the first one where I ever see this. After all, this is a comment in a Rust source. :)
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.
Because I copy doc comments in lib.rs
and paste them to README.md
. I don't want to omit the language name for syntax highlighting.
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.
I see. There is also some cargo
extensions that autogenerate (selected parts of) the README from lib.rs
.
They all automatically add the rust
prefix to resp. code blocks and avoid making mistakes/forgetting stuff when those two files have to be synced.
Maybe |
ALL
containing references to all blocks to iterate over them.crates.io
anddocs.rs
badges to README.This closes issue #2.