Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
amendments
Commits
9e3cae2b
Commit
9e3cae2b
authored
Sep 24, 2011
by
Michael Witrant
Browse files
parse names
parent
aa5d40e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
consultation_ipred/parser.rb
View file @
9e3cae2b
...
...
@@ -12,6 +12,18 @@ doc = Nokogiri::HTML(File.read(file))
links
=
doc
.
css
(
"a"
).
map
do
|
link
|
href
=
link
[
"href"
]
href
if
href
=~
/\.pdf$/i
end
.
compact
end
.
compact
.
uniq
{
|
url
|
URI
.
parse
(
url
).
path
}
parsed_names
=
[]
links
.
each
do
|
url
|
name
=
File
.
basename
(
URI
.
parse
(
url
).
path
,
".pdf"
)
next
if
parsed_names
.
include?
(
name
)
parsed_names
<<
name
names
=
name
.
split
(
"_"
)
language
=
names
.
pop
name
=
names
.
map
(
&
:capitalize
).
join
(
" "
)
p
[
name
,
language
]
end
p
links
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment