File tree Expand file tree Collapse file tree 1 file changed +30
-15
lines changed Expand file tree Collapse file tree 1 file changed +30
-15
lines changed Original file line number Diff line number Diff line change @@ -121,20 +121,28 @@ function get_dir_list(dir::AbstractString)
121
121
enc = " utf-8" # sys.getfilesystemencoding()
122
122
title = " Directory listing for $(dir) "
123
123
write (io, """
124
- <!DOCTYPE HTML>
125
- <html>
126
- <head>
127
- """ )
128
- write (io, """ <meta http-equiv="Content-Type" content="text/html; charset=$(enc) ">""" )
129
- write (io, """ <title>$(title) </title>\n </head>""" )
130
- write (io, """ <body>\n <h1>$(title) </h1>""" )
131
- write (io, """ <hr>\n <ul>""" )
124
+ <!DOCTYPE HTML>
125
+ <html>
126
+ <head>
127
+ <meta charset="utf-8">
128
+ <meta name="viewport" content="width=device-width, initial-scale=1">
129
+ <title>$(title) </title>
130
+ </head>
131
+ <body>
132
+ <h1>$(title) </h1>
133
+ <hr>
134
+ <ul>
135
+ """
136
+ )
132
137
133
138
if isfile (path)
134
139
linkname = path
135
140
displayname = basename (path)
136
- write (io, """ <li><a href="$(linkname) ">$(displayname) </a></li>""" )
137
- list = []
141
+ write (io, """
142
+ <li><a href="$(linkname) ">$(displayname) </a></li>
143
+ """
144
+ )
145
+ empty! (list)
138
146
end
139
147
140
148
for name in list
@@ -149,12 +157,19 @@ function get_dir_list(dir::AbstractString)
149
157
displayname = name * " @"
150
158
# Note: a link to a directory displays with @ and links with /
151
159
end
152
- write (io, """ <li><a href="$(linkname) ">$(displayname) </a></li>""" )
160
+ write (io, """
161
+ <li><a href="$(linkname) ">$(displayname) </a></li>
162
+ """
163
+ )
153
164
end
154
- write (io, """ </ul>\n <hr>\n </body>\n </html>\n """ )
155
- index_page = take! (io)
156
-
157
- return index_page
165
+ write (io, """
166
+ </ul>
167
+ <hr>
168
+ </body>
169
+ </html>
170
+ """
171
+ )
172
+ return String (take! (io))
158
173
end
159
174
160
175
"""
You can’t perform that action at this time.
0 commit comments