openstax_content 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openstax/content/archive.rb +25 -0
- data/lib/openstax/content/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b17dd5822cd85c27b9d83850a0324d3633ef05bfd11793b9ac05bb734a0b8de3
|
4
|
+
data.tar.gz: 36be3946382c3f472ca4cc200ad2e7899505d4abc4101f0d94caebe287fc8d19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d32296abfb1ff02ea5781b62caf6616516459bb66f7a6615fdee3dc66481749f09c42e89df7ff28846b0a5fb97677b8d683150c0e60fa3c8eb4f0c7e870659b9
|
7
|
+
data.tar.gz: fab8643c3358e3cf02be92f59da7a3fc73338dbf679b1e38eeb4fc1364dc8d117c87913de960643e74c649806509694ebf56e68c38c1863e523191fa3d31f8e5
|
@@ -105,4 +105,29 @@ class OpenStax::Content::Archive
|
|
105
105
|
slug
|
106
106
|
end
|
107
107
|
end
|
108
|
+
|
109
|
+
def webview_uri_for(page)
|
110
|
+
uri = if page.is_a?(Addressable::URI)
|
111
|
+
page
|
112
|
+
else
|
113
|
+
begin
|
114
|
+
Addressable::URI.parse page
|
115
|
+
rescue Addressable::URI::InvalidURIError
|
116
|
+
begin
|
117
|
+
Addressable::URI.parse "/#{page}"
|
118
|
+
rescue Addressable::URI::InvalidURIError
|
119
|
+
OpenStax::Content.logger.warn { "Invalid page url: \"#{page}\"" }
|
120
|
+
|
121
|
+
return page
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
object = uri.path.split('/').last
|
126
|
+
book_id, page_id = object.split(':', 2)
|
127
|
+
page_uuid = page_id.split('@', 2).first
|
128
|
+
book_slug = slug book_id
|
129
|
+
page_slug = slug object
|
130
|
+
uri.path = "books/#{book_slug}/pages/#{page_slug}"
|
131
|
+
Addressable::URI.join "https://#{OpenStax::Content.domain}", uri
|
132
|
+
end
|
108
133
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstax_content
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|