Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a03f7b0

Browse files
authored
Fix rendering problem with a superscript bigger than 10 (clearloop#39)
* Fix rendering problem with a superscript bigger than 10 * Use nightly-2021年05月16日 for workflow
1 parent 8e246ad commit a03f7b0

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

‎.github/workflows/clippy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v1
1717
- uses: actions-rs/toolchain@v1
1818
with:
19-
toolchain: nightly
19+
toolchain: nightly-2021年05月16日
2020
components: clippy
2121
override: true
2222
- uses: actions-rs/clippy-check@v1

‎.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set nightly toolchain
1919
uses: actions-rs/toolchain@v1
2020
with:
21-
toolchain: nightly
21+
toolchain: nightly-2021年05月16日
2222
override: true
2323
- name: Environment
2424
run: |

‎src/helper.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ mod html {
113113

114114
pub fn superscript(n: u8) -> String {
115115
match n {
116+
x if x >= 10 => format!("{}{}", superscript(n / 10), superscript(n % 10)),
116117
0 => "0".to_string(),
117118
1 => "1".to_string(),
118119
2 => "2".to_string(),
@@ -123,18 +124,13 @@ mod html {
123124
7 => "7".to_string(),
124125
8 => "8".to_string(),
125126
9 => "9".to_string(),
126-
x if x > 10 => (superscript(n / 10).parse().unwrap_or(0)
127-
+ superscript(n % 10).parse().unwrap_or(0))
128-
.to_string(),
129127
_ => n.to_string(),
130128
}
131129
}
132130

133131
pub fn subscript(n: u8) -> String {
134132
match n {
135-
x if x >= 10 => (subscript(n / 10).parse().unwrap_or(0)
136-
+ subscript(n % 10).parse().unwrap_or(0))
137-
.to_string(),
133+
x if x >= 10 => format!("{}{}", subscript(n / 10), subscript(n % 10)),
138134
0 => "0".to_string(),
139135
1 => "1".to_string(),
140136
2 => "2".to_string(),

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /