Skip to content

Commit cbad27a

Browse files
committed
formatting
1 parent 6d19060 commit cbad27a

File tree

8 files changed

+32
-94
lines changed

8 files changed

+32
-94
lines changed

.JuliaFormatter.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
style = "blue"

app/Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[deps]
2+
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
23
NodeJS = "2bd173c7-0d6d-553b-b6af-13a54713934c"
34
Oxygen = "df9a0d86-3283-4920-82dc-4555fc0d1d8b"
4-
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
55
Readability = "4455ec5f-b558-4ef1-b6d8-c3694046c382"
66

77
[compat]
8+
HTTP = "1"
89
NodeJS = "2"
910
Oxygen = "1"
10-
HTTP = "1"
1111
Readability = "0.4"
1212
julia = "1"

app/src-oxygen/index.jl

+22-87
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function serve_reactjs(; build_directory::String)::Nothing
4949
<div id="root"></div>
5050
</body>
5151
</html>
52-
"""
52+
""",
5353
)
5454

5555
for path in Base.Filesystem.readdir(build_directory; join=true)
@@ -72,12 +72,7 @@ function start_app()::Nothing
7272
build_reactjs(; build_directory=BUILD_DIRECTORY)
7373
serve_reactjs(; build_directory=BUILD_DIRECTORY)
7474

75-
Oxygen.serve(
76-
host="0.0.0.0",
77-
port=5050,
78-
docs=false,
79-
metrics=false
80-
)
75+
Oxygen.serve(; host="0.0.0.0", port=5050)
8176

8277
return nothing
8378
end
@@ -89,86 +84,26 @@ function post_request_handler(endpoint::String, readability_function::Function)
8984
end
9085

9186
readability_endpoints::Vector{Tuple{String,Function}} = [
92-
(
93-
"/api/ari",
94-
Readability.ari
95-
),
96-
(
97-
"/api/characters",
98-
Readability.characters
99-
),
100-
(
101-
"/api/characters-per-word",
102-
Readability.characters_per_word
103-
),
104-
(
105-
"/api/coleman-liau",
106-
Readability.coleman_liau
107-
),
108-
(
109-
"/api/dale-chall",
110-
Readability.dale_chall
111-
),
112-
(
113-
"/api/flesch-kincaid-grade-level",
114-
Readability.flesch_kincaid_grade_level
115-
),
116-
(
117-
"/api/flesch-reading-ease-score",
118-
Readability.flesch_reading_ease
119-
),
120-
(
121-
"/api/gunning-fog",
122-
Readability.gunning_fog
123-
),
124-
(
125-
"/api/lines",
126-
Readability.lines
127-
),
128-
(
129-
"/api/paragraphs",
130-
Readability.paragraphs
131-
),
132-
(
133-
"/api/reading-time",
134-
Readability.reading_time
135-
),
136-
(
137-
"/api/sentences",
138-
Readability.sentences
139-
),
140-
(
141-
"/api/sentences-per-paragraph",
142-
Readability.sentences_per_paragraph
143-
),
144-
(
145-
"/api/smog",
146-
Readability.smog
147-
),
148-
(
149-
"/api/spache",
150-
Readability.spache
151-
),
152-
(
153-
"/api/speaking-time",
154-
Readability.speaking_time
155-
),
156-
(
157-
"/api/syllables",
158-
Readability.syllables
159-
),
160-
(
161-
"/api/syllables-per-word",
162-
Readability.syllables_per_word
163-
),
164-
(
165-
"/api/words",
166-
Readability.words
167-
),
168-
(
169-
"/api/words-per-sentence",
170-
Readability.words_per_sentence
171-
)
87+
("/api/ari", Readability.ari),
88+
("/api/characters", Readability.characters),
89+
("/api/characters-per-word", Readability.characters_per_word),
90+
("/api/coleman-liau", Readability.coleman_liau),
91+
("/api/dale-chall", Readability.dale_chall),
92+
("/api/flesch-kincaid-grade-level", Readability.flesch_kincaid_grade_level),
93+
("/api/flesch-reading-ease-score", Readability.flesch_reading_ease),
94+
("/api/gunning-fog", Readability.gunning_fog),
95+
("/api/lines", Readability.lines),
96+
("/api/paragraphs", Readability.paragraphs),
97+
("/api/reading-time", Readability.reading_time),
98+
("/api/sentences", Readability.sentences),
99+
("/api/sentences-per-paragraph", Readability.sentences_per_paragraph),
100+
("/api/smog", Readability.smog),
101+
("/api/spache", Readability.spache),
102+
("/api/speaking-time", Readability.speaking_time),
103+
("/api/syllables", Readability.syllables),
104+
("/api/syllables-per-word", Readability.syllables_per_word),
105+
("/api/words", Readability.words),
106+
("/api/words-per-sentence", Readability.words_per_sentence),
172107
]
173108

174109
for (endpoint, readability_function) in readability_endpoints

app/src-react/assets/css/header.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ nav {
5353
align-items: center;
5454
justify-content: space-between;
5555
height: 100%;
56-
min-width: 7%;
56+
min-width: 6%;
5757
}
5858

5959
.header-link:active {

app/src-react/assets/css/index.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ textarea {
9292
padding: 10px;
9393
border-radius: 5px;
9494
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
95-
resize: none;
95+
resize: vertical;
9696
overflow: auto;
9797
margin-bottom: 20px;
9898
}

app/src-react/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ const onTextInput = (
8484
}
8585
};
8686

87-
8887
const App = () => {
8988
const [metrics, setMetrics] = useState({
9089
ari: 0,
@@ -115,6 +114,7 @@ const App = () => {
115114
<main className="main">
116115
<div className="textarea-container">
117116
<textarea
117+
id="readability-textarea"
118118
className="textarea"
119119
placeholder="Paste your text here..."
120120
spellCheck="false"

src/ari.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ Returns the Automated Readability Index (ARI) of `text`.
1616
- [ARI](https://en.wikipedia.org/wiki/Automated_readability_index)
1717
"""
1818
function ari(text::String)::Int
19-
return Base.ceil(Int, 4.71 * characters_per_word(text) + 0.5 * words_per_sentence(text) - 21.43)
19+
return Base.ceil(
20+
Int, 4.71 * characters_per_word(text) + 0.5 * words_per_sentence(text) - 21.43
21+
)
2022
end

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const TEXTS = [
1010
"This one is a bit tricky; let's see how the metrics work.",
1111
"Will it work with... ellipses? Or maybe, parentheses (like these)?",
1212
"Hypothetical paragraph designed to test reading times and word complexities.",
13-
"Final sample text to verify sentence and paragraph counts. Good luck!"
13+
"Final sample text to verify sentence and paragraph counts. Good luck!",
1414
]
1515

1616
@testset "Readability.ari" begin

0 commit comments

Comments
 (0)