ydocx 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gemtest +0 -0
- data/History.txt +4 -0
- data/README.txt +12 -1
- data/Rakefile +9 -0
- data/lib/ydocx.rb +1 -1
- data/lib/ydocx/parser.rb +1 -1
- data/lib/ydocx/templates/fachinfo.rb +47 -43
- metadata +21 -16
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODg5ZmE1ODM1YTJlMjllZTJiMmMyYzAxNGM0MTQ0NGQ1YzA0NjRkNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjZiOGM3NGVhMGMyNDQxODQyNjgwZTJjOWViOTZhNzE2OWMxODBlMg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OGI0ZDRlNDFlOGEwMWMxN2U5ZjA5NGZkMTJjMzZkMzA4ODdhZWIzMmVhNDA2
|
10
|
+
ZmM4NWRjZmNlMWMxYTIxOTRkNTcyYTc4NGQ2ZjNjOWIzNWI0YTZjNTE4ZWE5
|
11
|
+
NTI1MWQ2MmYzNjUwOWUxNGQ0NjhmNGEwNGE0ZWJmZjNlNjZiOTk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDRmNmY3NTk5NTllZGQzMzU4NDA1ODU1MTRlYTg2ZWU5ODgyMzNlMTBiNWMx
|
14
|
+
NzY1ZDAyNzgxZDY3ZTk4ZTIwYjVlZWYwYWY3MDQzMjg2OTg2M2VkMmRjMDVm
|
15
|
+
Njc4Yjc2NGU4NmMxNjdlMDgxOTQ4M2UyMmFhMzc2YzVkMDdhNWM=
|
data/.gemtest
ADDED
File without changes
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -26,11 +26,22 @@
|
|
26
26
|
|
27
27
|
== Using the great libraries
|
28
28
|
|
29
|
-
* rubyzip
|
29
|
+
* rubyzip (< 1.0.0)
|
30
30
|
* nokogiri
|
31
31
|
* htmlentities
|
32
32
|
* RMagick
|
33
33
|
|
34
|
+
Install them using bundle install.
|
35
|
+
|
36
|
+
Requires Ruby >= 1.9.2.
|
37
|
+
|
38
|
+
== TODO
|
39
|
+
|
40
|
+
For unknown reason the gem fails to parse properly the Présentation for sinovial_fr.
|
41
|
+
Failing spec is: ydocx should convert sinovial_FR to xml
|
42
|
+
Failure/Error: doc.xpath('//chapters/chapter[contains(heading, "Présentation")]').size.should > 0
|
43
|
+
|
44
|
+
|
34
45
|
== License GPLv3.0
|
35
46
|
|
36
47
|
* http://www.gnu.org/licenses/gpl.html
|
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
|
+
require 'simplecov'
|
5
6
|
|
6
7
|
# Hoe.plugin :compiler
|
7
8
|
# Hoe.plugin :gem_prelude_sucks
|
@@ -15,3 +16,11 @@ Hoe.spec 'ydocx' do
|
|
15
16
|
developer('Yasuhiro Asaka, Zeno R.R. Davatz', 'yasaka@ywesee.com, zdavatz@ywesee.com')
|
16
17
|
|
17
18
|
end
|
19
|
+
|
20
|
+
namespace :spec do
|
21
|
+
desc "Create rspec coverage"
|
22
|
+
task :coverage do
|
23
|
+
ENV['COVERAGE'] = 'true'
|
24
|
+
Rake::Task["spec"].execute
|
25
|
+
end
|
26
|
+
end
|
data/lib/ydocx.rb
CHANGED
data/lib/ydocx/parser.rb
CHANGED
@@ -8,7 +8,7 @@ require 'ydocx/markup_method'
|
|
8
8
|
module YDocx
|
9
9
|
class Parser
|
10
10
|
include MarkupMethod
|
11
|
-
attr_accessor :indecies, :images, :result, :space
|
11
|
+
attr_accessor :indecies, :images, :result, :space, :lang
|
12
12
|
def initialize(doc, rel)
|
13
13
|
@doc = Nokogiri::XML.parse(doc)
|
14
14
|
@rel = Nokogiri::XML.parse(rel)
|
@@ -12,7 +12,6 @@ module YDocx
|
|
12
12
|
@code = nil
|
13
13
|
@lang ||= 'de'
|
14
14
|
end
|
15
|
-
private
|
16
15
|
###
|
17
16
|
# Fachinfo Chapters
|
18
17
|
# 1. name
|
@@ -38,56 +37,61 @@ module YDocx
|
|
38
37
|
def chapters
|
39
38
|
chapters = {
|
40
39
|
:de => {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
40
|
+
'name' => /^Name\s+des\s+Präparates$/u, # 1
|
41
|
+
'composition' => /^Zusammensetzung|Wirkstoffe|Hilsstoffe/u, # 2
|
42
|
+
'galenic_form' => /^Galenische\s+Form\s*(und|\/)\s*Wirkstoffmenge\s+pro\s+Einheit$/iu, # 3
|
43
|
+
'indications' => /^Indikationen(\s+|\s*(\/|und)\s*)Anwendungsmöglichkeiten$/u, # 4
|
44
|
+
'usage' => /^Dosierung\s*(\/|und)\s*Anwendung/u, # 5
|
45
|
+
'contra_indications' => /^Kontraindikationen($|\s*\(\s*absolute\s+Kontraindikationen\s*\)$)/u, # 6
|
46
|
+
'restrictions' => /^Warnhinweise\s+und\s+Vorsichtsmassnahmen($|\s*\/\s*(relative\s+Kontraindikationen|Warnhinweise\s*und\s*Vorsichtsmassnahmen)$)/u, # 7
|
47
|
+
'interactions' => /^Interaktionen$/u, # 8
|
48
|
+
'pregnancy' => /^Schwangerschaft(,\s*|\s*\/\s*|\s+und\s+)Stillzeit$/u, # 9
|
49
|
+
'driving_ability' => /^Wirkung\s+auf\s+die\s+Fahrtüchtigkeit\s+und\s+auf\s+das\s+Bedienen\s+von\s+Maschinen$/u, # 10
|
50
|
+
'unwanted_effects' => /^Unerwünschte\s+Wirkungen$/u, # 11
|
51
|
+
'overdose' => /^Überdosierung$/u, # 12
|
52
|
+
'effects' => /^Eigenschaften\s*\/\s*Wirkungen($|\s*\(\s*(ATC\-Code|Wirkungsmechanismus|Pharmakodyamik|Klinische\s+Wirksamkeit)\s*\)\s*$)/iu, # 13
|
53
|
+
'kinetic' => /^Pharmakokinetik($|\s*\((Absorption,\s*Distribution,\s*Metabolisms,\s*Elimination\s|Kinetik\s+spezieller\s+Patientengruppen)*\)$)/iu, # 14
|
54
|
+
'preclinic' => /^Präklinische\s+Daten$/u, # 15
|
55
|
+
'other_advice' => /^Sonstige\s*Hinweise($|\s*\(\s*(Inkompatibilitäten|Beeinflussung\s*diagnostischer\s*Methoden|Haltbarkeit|Besondere\s*Lagerungshinweise|Hinweise\s+für\s+die\s+Handhabung)\s*\)$)|^Remarques/u, # 16
|
56
|
+
'iksnrs' => /^Zulassungsnummer(n|:|$|\s*\(\s*Swissmedic\s*\)$)/u, # 17
|
57
|
+
'packages' => /^Packungen($|\s*\(\s*mit\s+Angabe\s+der\s+Abgabekategorie\s*\)$)/u, # 18
|
58
|
+
'registration_owner' => /^Zulassungsinhaberin($|\s*\(\s*Firma\s+und\s+Sitz\s+gemäss\s*Handelsregisterauszug\s*\))/u, # 19
|
59
|
+
'date' => /^Stand\s+der\s+Information$/iu, # 20
|
60
|
+
'fabrication' => /^Herstellerin/u,
|
61
|
+
'company' => /^Vertriebsfirma/u,
|
61
62
|
},
|
62
63
|
:fr => {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
64
|
+
'name' => /^Nom$/u, # 1
|
65
|
+
'composition' => /^Composition$/u, # 2
|
66
|
+
'galenic_form' => /^Forme\s+galénique\s+et\s+quantité\s+de\s+principe\s+actif\s+par\s+unité|^Forme\s*gal.nique/iu, # 3
|
67
|
+
'indications' => /^Indications/u, # 4
|
68
|
+
'usage' => /^Posologiei/u, # 5
|
69
|
+
'contra_indications' => /^Contre\-indications/iu, # 6
|
70
|
+
'restrictions' => /^Mises/u, # 7
|
71
|
+
'interactions' => /^Interactions/u, # 8
|
72
|
+
'pregnancy' => /^Grossesse\s*\/\s*Allaitement/u, # 9
|
73
|
+
'driving_ability' => /^Effet\s+sur\s+l'aptitude\s+à;\s+la\s+conduite\s+et\s+l'utilisation\s+de\s+machines/u, # 10
|
74
|
+
'unwanted_effects' => /^Effets/u, # 11
|
75
|
+
'overdose' => /^Surdosage$/u, # 12
|
76
|
+
'effects' => /^Propriétés/iu, # 13
|
77
|
+
'kinetic' => /^Pharmacocinétique$/iu, # 14
|
78
|
+
'preclinic' => /^Données\s+précliniques$/u, # 15
|
79
|
+
'other_advice' => /^Remarques/u, # 16
|
80
|
+
'iksnrs' => /^Numéro\s+d'autorisation$/u, # 17
|
81
|
+
'packages' => /^Présentation/iu, # 18
|
82
|
+
'registration_owner' => /^Titulaire\s+de\s+l'autorisation$/u, # 19
|
83
|
+
'date' => /^Mise à jour/iu, # 20
|
84
|
+
'fabrication' => /^Fabricant$/u,
|
85
|
+
'company' => /^Distributeur/u,
|
83
86
|
}
|
84
87
|
}
|
85
|
-
if @lang == 'fr'
|
88
|
+
if @lang == 'fr' || @lang == :fr
|
86
89
|
chapters[:fr]
|
87
90
|
else
|
88
91
|
chapters[:de]
|
89
92
|
end
|
90
93
|
end
|
94
|
+
private
|
91
95
|
def escape_id(text)
|
92
96
|
CGI.escape(text.
|
93
97
|
gsub(/&(.)uml;/, '\1e').gsub(/'/, '').gsub(/&(eacute|agrave);/, 'e').
|
@@ -105,7 +109,7 @@ module YDocx
|
|
105
109
|
return markup(:h2, text, {:id => id})
|
106
110
|
end
|
107
111
|
def parse_title(node, text)
|
108
|
-
if @indecies.empty? and !text.empty? and
|
112
|
+
if @indecies.empty? and !text.empty? and node.previous and
|
109
113
|
(node.previous.inner_text.strip.empty? or node.parent.previous.nil?)
|
110
114
|
# The first line as package name
|
111
115
|
title = (@lang == 'fr' ? 'Titre' : 'Titel')
|
metadata
CHANGED
@@ -1,38 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ydocx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Yasuhiro Asaka, Zeno R.R. Davatz
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rdoc
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '4.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: hoe
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
33
|
+
version: '3.6'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.6'
|
36
41
|
description: ''
|
37
42
|
email:
|
38
43
|
- yasaka@ywesee.com, zdavatz@ywesee.com
|
@@ -45,6 +50,7 @@ extra_rdoc_files:
|
|
45
50
|
- Manifest.txt
|
46
51
|
- README.txt
|
47
52
|
files:
|
53
|
+
- .gemtest
|
48
54
|
- History.txt
|
49
55
|
- Manifest.txt
|
50
56
|
- README.txt
|
@@ -53,14 +59,15 @@ files:
|
|
53
59
|
- bin/docx2xml
|
54
60
|
- lib/ydocx.rb
|
55
61
|
- lib/ydocx/builder.rb
|
62
|
+
- lib/ydocx/command.rb
|
56
63
|
- lib/ydocx/document.rb
|
57
64
|
- lib/ydocx/markup_method.rb
|
58
65
|
- lib/ydocx/parser.rb
|
59
|
-
- lib/ydocx/command.rb
|
60
66
|
- lib/ydocx/templates/fachinfo.rb
|
61
67
|
- lib/ydocx/templates/patinfo.rb
|
62
68
|
homepage: https://github.com/zdavatz/ydocx
|
63
69
|
licenses: []
|
70
|
+
metadata: {}
|
64
71
|
post_install_message:
|
65
72
|
rdoc_options:
|
66
73
|
- --main
|
@@ -68,21 +75,19 @@ rdoc_options:
|
|
68
75
|
require_paths:
|
69
76
|
- lib
|
70
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
78
|
requirements:
|
73
79
|
- - ! '>='
|
74
80
|
- !ruby/object:Gem::Version
|
75
81
|
version: '0'
|
76
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
83
|
requirements:
|
79
84
|
- - ! '>='
|
80
85
|
- !ruby/object:Gem::Version
|
81
86
|
version: '0'
|
82
87
|
requirements: []
|
83
88
|
rubyforge_project: ydocx
|
84
|
-
rubygems_version:
|
89
|
+
rubygems_version: 2.2.1
|
85
90
|
signing_key:
|
86
|
-
specification_version:
|
91
|
+
specification_version: 4
|
87
92
|
summary: ''
|
88
93
|
test_files: []
|