adiwg-mdtranslator 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/adiwg/mdtranslator.rb +40 -1
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +6 -23
  4. data/lib/adiwg/mdtranslator/internal/module_geoFormat.rb +226 -0
  5. data/lib/adiwg/mdtranslator/version.rb +2 -1
  6. data/lib/adiwg/mdtranslator/writers/html/html_writer.rb +0 -2
  7. data/lib/adiwg/mdtranslator/writers/html/md_html_writer.rb +34 -3
  8. data/lib/adiwg/mdtranslator/writers/html/readme.md +6 -2
  9. data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +321 -0
  10. data/lib/adiwg/mdtranslator/writers/html/sections/html_bodyScript.js +111 -0
  11. data/lib/adiwg/mdtranslator/writers/html/sections/html_browseGraphic.rb +58 -0
  12. data/lib/adiwg/mdtranslator/writers/html/sections/html_citation.rb +91 -0
  13. data/lib/adiwg/mdtranslator/writers/html/sections/html_contact.rb +132 -0
  14. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +110 -0
  15. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataLineage.rb +67 -0
  16. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataSource.rb +66 -0
  17. data/lib/adiwg/mdtranslator/writers/html/sections/html_dateTime.rb +41 -0
  18. data/lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb +80 -0
  19. data/lib/adiwg/mdtranslator/writers/html/sections/html_domainMember.rb +52 -0
  20. data/lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb +137 -0
  21. data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +107 -0
  22. data/lib/adiwg/mdtranslator/writers/html/sections/html_entityIndex.rb +50 -0
  23. data/lib/adiwg/mdtranslator/writers/html/sections/html_extent.rb +107 -0
  24. data/lib/adiwg/mdtranslator/writers/html/sections/html_format.rb +39 -0
  25. data/lib/adiwg/mdtranslator/writers/html/sections/html_geographicElement.rb +211 -0
  26. data/lib/adiwg/mdtranslator/writers/html/sections/html_head.rb +53 -0
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_headScript.js +18 -0
  28. data/lib/adiwg/mdtranslator/writers/html/sections/html_inlineCss.css +223 -0
  29. data/lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb +59 -0
  30. data/lib/adiwg/mdtranslator/writers/html/sections/html_legalConstraint.rb +56 -0
  31. data/lib/adiwg/mdtranslator/writers/html/sections/html_medium.rb +51 -0
  32. data/lib/adiwg/mdtranslator/writers/html/sections/html_metadataInfo.rb +119 -0
  33. data/lib/adiwg/mdtranslator/writers/html/sections/html_onlineResource.rb +63 -0
  34. data/lib/adiwg/mdtranslator/writers/html/sections/html_orderProcess.rb +63 -0
  35. data/lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb +74 -0
  36. data/lib/adiwg/mdtranslator/writers/html/sections/html_resolution.rb +46 -0
  37. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceContact.rb +36 -0
  38. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceFormat.rb +39 -0
  39. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceGeneral.rb +106 -0
  40. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceId.rb +50 -0
  41. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +261 -0
  42. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceMaint.rb +55 -0
  43. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceOther.rb +87 -0
  44. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceUsage.rb +55 -0
  45. data/lib/adiwg/mdtranslator/writers/html/sections/html_responsibleParty.rb +38 -0
  46. data/lib/adiwg/mdtranslator/writers/html/sections/html_securityConstraint.rb +55 -0
  47. data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialReferenceSystem.rb +58 -0
  48. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +108 -0
  49. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomyClass.rb +62 -0
  50. data/lib/adiwg/mdtranslator/writers/html/sections/html_temporalElement.rb +60 -0
  51. data/lib/adiwg/mdtranslator/writers/html/sections/html_timeInstant.rb +55 -0
  52. data/lib/adiwg/mdtranslator/writers/html/sections/html_timePeriod.rb +59 -0
  53. data/lib/adiwg/mdtranslator/writers/html/sections/html_transferOption.rb +51 -0
  54. data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalElement.rb +59 -0
  55. data/lib/adiwg/mdtranslator/writers/html/sections/logo150.txt +25 -0
  56. data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicDescription.rb +12 -12
  57. metadata +50 -2
@@ -0,0 +1,111 @@
1
+ if ( typeof L === "object") {
2
+ (function() {
3
+ //forEach Polyfill, Reference: https://goo.gl/hFIfSd
4
+ if (!Array.prototype.forEach) {
5
+ Array.prototype.forEach = function(callback, thisArg) {
6
+ var T, k;
7
+ if (this == null) {
8
+ throw new TypeError(' this is null or not defined');
9
+ }
10
+ var O = Object(this);
11
+ var len = O.length >>> 0;
12
+ if ( typeof callback !== "function") {
13
+ throw new TypeError(callback + ' is not a function');
14
+ }
15
+ if (arguments.length > 1) {
16
+ T = thisArg;
17
+ }
18
+ k = 0;
19
+ while (k < len) {
20
+ var kValue;
21
+ if ( k in O) {
22
+ kValue = O[k];
23
+ callback.call(T, kValue, k, O);
24
+ }
25
+ k++;
26
+ }
27
+ };
28
+ }
29
+
30
+ var extentNodeList = document.querySelectorAll('section.extent-section');
31
+ var extents = Array.prototype.slice.call(extentNodeList);
32
+
33
+ var mqAttr = '<span>Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png"></span>';
34
+ var osmAttr = '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>';
35
+
36
+ L.TileLayer.OSM = L.TileLayer.extend({
37
+ initialize: function(options) {
38
+ L.TileLayer.prototype.initialize.call(this, 'http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.png', {
39
+ subdomains: '1234',
40
+ type: 'osm',
41
+ attribution: 'Map data ' + osmAttr + ', ' + mqAttr
42
+ });
43
+ }
44
+ });
45
+
46
+ var check = function(i, me, bnds) {
47
+ if (i < 3) {
48
+ var resize = me.getSize().x === 0 && me.getContainer().offsetWidth > 0;
49
+
50
+ me.invalidateSize();
51
+ if (resize) {
52
+ me.fitBounds(bnds);
53
+ } else {
54
+ i++;
55
+ setTimeout(function() {
56
+ check(i, me, bnds);
57
+ }, 100);
58
+ }
59
+ }
60
+ };
61
+
62
+ extents.forEach(function(extent, idx, arr) {
63
+ var map = L.map(extent.querySelector('div.map'));
64
+ var header = extent.querySelector('summary.map-header');
65
+ var geoNodelist = extent.querySelectorAll('div.geojson');
66
+ var geoArray = Array.prototype.slice.call(geoNodelist);
67
+ var geojson = [];
68
+
69
+ geoArray.forEach(function(geo, geoIdx, geoArr) {
70
+ var json = JSON.parse(geo.textContent || geo.innerText);
71
+ var bbox = json.bbox;
72
+ if (json.geometry === null && bbox) {
73
+ json.geometry = {
74
+ "type": "Polygon",
75
+ "coordinates": [[[bbox[2], bbox[3]], [bbox[0], bbox[3]], [bbox[0], bbox[1]], [bbox[2], bbox[1]], [bbox[2], bbox[3]]]]
76
+ };
77
+ if (!json.properties) {
78
+ json.properties = {};
79
+ }
80
+ json.properties.style = {
81
+ color: '#f00',
82
+ fill: false
83
+ };
84
+ }
85
+
86
+ geojson.push(json);
87
+ });
88
+
89
+ var geoLayer = L.geoJson(geojson, {
90
+ style: function(feature) {
91
+ return feature.properties.style || {};
92
+ }
93
+ }).addTo(map);
94
+
95
+ var bnds = geoLayer.getBounds();
96
+
97
+ L.DomEvent.addListener(header, 'click', function() {
98
+ var me = this;
99
+ var i = 0;
100
+
101
+ setTimeout(function() {
102
+ check(i, me, bnds);
103
+ }, 100);
104
+
105
+ }, map);
106
+
107
+ map.fitBounds(bnds);
108
+ map.addLayer(new L.TileLayer.OSM());
109
+ });
110
+ })();
111
+ }
@@ -0,0 +1,58 @@
1
+ # HTML writer
2
+ # browse graphic or graphic overview
3
+
4
+ # History:
5
+ # Stan Smith 2015-03-24 original script
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Html
11
+
12
+ class MdHtmlBrowseGraphic
13
+ def initialize(html)
14
+ @html = html
15
+ end
16
+
17
+ def writeHtml(hBrowseG)
18
+
19
+ @html.section(:class=>'block') do
20
+
21
+ # browse graphic - name
22
+ if !hBrowseG[:bGName].nil?
23
+ @html.em('Name: ')
24
+ @html.text!(hBrowseG[:bGName])
25
+ @html.br
26
+ end
27
+
28
+ # browse graphic - description
29
+ if !hBrowseG[:bGDescription].nil?
30
+ @html.em('Description: ')
31
+ @html.text!(hBrowseG[:bGDescription])
32
+ @html.br
33
+ end
34
+
35
+ # browse graphic - type
36
+ if !hBrowseG[:bGType].nil?
37
+ @html.em('Type: ')
38
+ @html.text!(hBrowseG[:bGType])
39
+ @html.br
40
+ end
41
+
42
+ # browse graphic - URI
43
+ if !hBrowseG[:bGURI].nil?
44
+ @html.em('URI:')
45
+ @html.section(:class=>'block') do
46
+ @html.a(hBrowseG[:bGURI])
47
+ end
48
+ end
49
+ end
50
+
51
+ end # writeHtml
52
+
53
+ end # class
54
+
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,91 @@
1
+ # HTML writer
2
+ # citation
3
+
4
+ # History:
5
+ # Stan Smith 2015-03-23 original script
6
+
7
+ require 'html_dateTime'
8
+ require 'html_resourceId'
9
+ require 'html_responsibleParty'
10
+ require 'html_onlineResource'
11
+
12
+ module ADIWG
13
+ module Mdtranslator
14
+ module Writers
15
+ module Html
16
+
17
+ class MdHtmlCitation
18
+ def initialize(html)
19
+ @html = html
20
+ end
21
+
22
+ def writeHtml(hCitation)
23
+
24
+ # classes used
25
+ htmlDateTime = $HtmlNS::MdHtmlDateTime.new(@html)
26
+ htmlResId = $HtmlNS::MdHtmlResourceId.new(@html)
27
+ htmlResParty = $HtmlNS::MdHtmlResponsibleParty.new(@html)
28
+ htmlOlRes = $HtmlNS::MdHtmlOnlineResource.new(@html)
29
+
30
+ # citation - title - required
31
+ @html.em('Title: ')
32
+ @html.text!(hCitation[:citTitle])
33
+ @html.br
34
+
35
+ # citation - date
36
+ aDates = hCitation[:citDate]
37
+ aDates.each do |hDatetime|
38
+ @html.em('Date: ')
39
+ htmlDateTime.writeHtml(hDatetime)
40
+ end
41
+
42
+ # citation - edition
43
+ s = hCitation[:citEdition]
44
+ if s
45
+ @html.em('Edition: ')
46
+ @html.text!(s)
47
+ @html.br
48
+ end
49
+
50
+ # citation - resource ids - resource identifier
51
+ aIds = hCitation[:citResourceIds]
52
+ aIds.each do |hId|
53
+ htmlResId.writeHtml(hId)
54
+ end
55
+
56
+ # citation - responsible parties
57
+ aResPart = hCitation[:citResponsibleParty]
58
+ if !aResPart.empty?
59
+ @html.em('Responsible party: ')
60
+ @html.section(:class=>'block') do
61
+ aResPart.each do |hParty|
62
+ htmlResParty.writeHtml(hParty)
63
+ end
64
+ end
65
+ end
66
+
67
+ # citation - presentation forms
68
+ aForms = hCitation[:citResourceForms]
69
+ aForms.each do |form|
70
+ @html.em('Resource form: ')
71
+ @html.text!(form)
72
+ @html.br
73
+ end
74
+
75
+ # citation - online resources
76
+ aOlRes = hCitation[:citOlResources]
77
+ aOlRes.each do |hOlRes|
78
+ @html.em('Online resource: ')
79
+ @html.section(:class=>'block') do
80
+ htmlOlRes.writeHtml(hOlRes)
81
+ end
82
+ end
83
+
84
+ end # writeHtml
85
+
86
+ end # class
87
+
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,132 @@
1
+ # HTML writer
2
+ # contact
3
+
4
+ # History:
5
+ # Stan Smith 2015-03-23 original script
6
+
7
+ require 'html_onlineResource'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Html
13
+
14
+ class MdHtmlContact
15
+ def initialize(html)
16
+ @html = html
17
+ end
18
+
19
+ def writeHtml(contactId)
20
+
21
+ # classes used
22
+ htmlOlRes = $HtmlNS::MdHtmlOnlineResource.new(@html)
23
+
24
+ # find contact in contact list
25
+ hContact = {}
26
+ $aContacts.each do |hCont|
27
+ if hCont[:contactId] == contactId
28
+ hContact = hCont
29
+ break
30
+ end
31
+ end
32
+
33
+ # contact - individual name
34
+ s = hContact[:indName]
35
+ if s
36
+ @html.text!(s)
37
+ @html.br
38
+ end
39
+
40
+ # contact - title or position
41
+ s = hContact[:position]
42
+ if s
43
+ @html.text!(s)
44
+ @html.br
45
+ end
46
+
47
+ # contact - organization name
48
+ s = hContact[:orgName]
49
+ if s
50
+ @html.text!(s)
51
+ @html.br
52
+ end
53
+
54
+ # contact - address
55
+ hAddress = hContact[:address]
56
+ if !hAddress.empty?
57
+
58
+ # address - delivery points
59
+ a = hAddress[:deliveryPoints]
60
+ a.each do |addLine|
61
+ @html.text!(addLine)
62
+ @html.br
63
+ end
64
+
65
+ # address - city
66
+ s = hAddress[:city]
67
+ if s
68
+ @html.text!(s)
69
+ end
70
+
71
+ # address - admin area
72
+ s = hAddress[:adminArea]
73
+ if s
74
+ @html.text!(', ' + s)
75
+ end
76
+
77
+ # address - postal code
78
+ s = hAddress[:postalCode]
79
+ if s
80
+ @html.text!(' ' + s)
81
+ end
82
+
83
+ @html.br
84
+
85
+ # contact - email
86
+ a = hContact[:address][:eMailList]
87
+ a.each do |eMail|
88
+ @html.text!(eMail)
89
+ @html.br
90
+ end
91
+
92
+ end
93
+
94
+ # contact - phones
95
+ aPhones = hContact[:phones]
96
+ if !aPhones.empty?
97
+ aPhones.each do |hPhone|
98
+ @html.text!(hPhone[:phoneServiceType] + ': ')
99
+ @html.text!(hPhone[:phoneNumber] + ' ')
100
+ @html.text!(hPhone[:phoneName]) if !hPhone[:phoneName].nil?
101
+ @html.br
102
+ end
103
+ end
104
+
105
+ # contact - online resource
106
+ aOline = hContact[:onlineRes]
107
+ if !aOline.empty?
108
+ aOline.each do |olRes|
109
+ @html.em('Online presence: ')
110
+ @html.section(:class=>'block') do
111
+ htmlOlRes.writeHtml(olRes)
112
+ end
113
+ end
114
+ end
115
+
116
+ # contact - special instructions
117
+ s = hContact[:contactInstructions]
118
+ if s
119
+ @html.em('Note: ')
120
+ @html.text!(s)
121
+ @html.br
122
+ end
123
+
124
+
125
+ end # writeHtml
126
+
127
+ end # class
128
+
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,110 @@
1
+ # HTML writer
2
+ # data dictionary
3
+
4
+ # History:
5
+ # Stan Smith 2015-03-26 original script
6
+
7
+ require 'html_citation'
8
+ require 'html_domain'
9
+ require 'html_entity'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Html
15
+
16
+ class MdHtmlDataDictionary
17
+ def initialize(html)
18
+ @html = html
19
+ end
20
+
21
+ def writeHtml(hDictionary)
22
+
23
+ # classes used
24
+ htmlCitation = $HtmlNS::MdHtmlCitation.new(@html)
25
+ htmlDomain = $HtmlNS::MdHtmlDictionaryDomain.new(@html)
26
+ htmlEntity = $HtmlNS::MdHtmlDictionaryEntity.new(@html)
27
+
28
+ hDictId = hDictionary[:dictionaryInfo]
29
+ aDictDom = hDictionary[:domains]
30
+ aDictEnt = hDictionary[:entities]
31
+
32
+ @html.details do
33
+ @html.summary('Dictionary Identification', {'class'=>'h4'})
34
+ @html.section(:class=>'block') do
35
+
36
+ # dictionary identification - resource type
37
+ s = hDictId[:dictResourceType]
38
+ if !s.nil?
39
+ @html.em('Resource type: ')
40
+ @html.text!(s)
41
+ @html.br
42
+ end
43
+
44
+ # dictionary identification - description
45
+ s = hDictId[:dictDescription]
46
+ if !s.nil?
47
+ @html.em('Description: ')
48
+ @html.text!(s)
49
+ @html.br
50
+ end
51
+
52
+ # dictionary identification - language
53
+ s = hDictId[:dictLanguage]
54
+ if !s.nil?
55
+ @html.em('Language: ')
56
+ @html.text!(s)
57
+ @html.br
58
+ end
59
+
60
+ # dictionary identification - citation
61
+ @html.em('Citation: ')
62
+ @html.section(:class=>'block') do
63
+ htmlCitation.writeHtml(hDictId[:dictCitation])
64
+ end
65
+
66
+ end
67
+ end
68
+
69
+ # data dictionary - resource domains
70
+ @html.details do
71
+ @html.summary('Resource Domains', {'class'=>'h4'})
72
+ if !aDictDom.empty?
73
+ aDictDom.each do |hDomain|
74
+ @html.section(:class=>'block') do
75
+ @html.details do
76
+ @html.summary(hDomain[:domainCode], {'class'=>'h5'})
77
+ @html.section(:class=>'block') do
78
+ htmlDomain.writeHtml(hDomain)
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ # data dictionary - resource schema
87
+ @html.details do
88
+ @html.summary('Resource Entities', {'class'=>'h4'})
89
+ if !aDictEnt.empty?
90
+ aDictEnt.each do |hEntity|
91
+ @html.section(:class=>'block') do
92
+ @html.details do
93
+ @html.summary(hEntity[:entityCode], {'class'=>'h5'})
94
+ @html.section(:class=>'block') do
95
+ htmlEntity.writeHtml(hEntity)
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ end # writeHtml
104
+
105
+ end # class
106
+
107
+ end
108
+ end
109
+ end
110
+ end