ydocx 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -1,3 +1,7 @@
1
+ === 1.2.4 / 26.02.2014
2
+
3
+ * Many changes by Niklaus Giger to get ready for Pseudo-Fachinformation.
4
+
1
5
  === 1.2.3 / 12.07.2012
2
6
 
3
7
  * Updated french char handling, lang in filename
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
@@ -4,5 +4,5 @@
4
4
  require 'ydocx/document'
5
5
 
6
6
  module YDocx
7
- VERSION = '1.2.3'
7
+ VERSION = '1.2.4'
8
8
  end
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
- "Name" => /^Name\s+des\s+Pr&auml;parates$/u, # 1
42
- "Zusammens." => /^Zusammensetzung($|\s*\/\s*(Wirkstoffe|Hilsstoffe)$)/u, # 2
43
- "Galen.Form" => /^Galenische\s+Form\s*(und|\/)\s*Wirkstoffmenge\s+pro\s+Einheit$/iu, # 3
44
- "Ind./Anw.m&ouml;gl." => /^Indikationen(\s+|\s*(\/|und)\s*)Anwendungsm&ouml;glichkeiten$/u, # 4
45
- "Dos./Anw." => /^Dosierung\s*(\/|und)\s*Anwendung/u, # 5
46
- "Kontraind." => /^Kontraindikationen($|\s*\(\s*absolute\s+Kontraindikationen\s*\)$)/u, # 6
47
- "Warn.hinw." => /^Warnhinweise\s+und\s+Vorsichtsmassnahmen($|\s*\/\s*(relative\s+Kontraindikationen|Warnhinweise\s*und\s*Vorsichtsmassnahmen)$)/u, # 7
48
- "Interakt." => /^Interaktionen$/u, # 8
49
- "Schwangerschaft" => /^Schwangerschaft(,\s*|\s*\/\s*|\s+und\s+)Stillzeit$/u, # 9
50
- "Fahrt&uuml;cht." => /^Wirkung\s+auf\s+die\s+Fahrt&uuml;chtigkeit\s+und\s+auf\s+das\s+Bedienen\s+von\s+Maschinen$/u, # 10
51
- "Unerw.Wirkungen" => /^Unerw&uuml;nschte\s+Wirkungen$/u, # 11
52
- "&Uuml;berdos." => /^&Uuml;berdosierung$/u, # 12
53
- "Eigensch." => /^Eigenschaften\s*\/\s*Wirkungen($|\s*\(\s*(ATC\-Code|Wirkungsmechanismus|Pharmakodyamik|Klinische\s+Wirksamkeit)\s*\)\s*$)/iu, # 13
54
- "Pharm.kinetik" => /^Pharmakokinetik($|\s*\((Absorption,\s*Distribution,\s*Metabolisms,\s*Elimination\s|Kinetik\s+spezieller\s+Patientengruppen)*\)$)/iu, # 14
55
- "Pr&auml;klin." => /^Pr&auml;klinische\s+Daten$/u, # 15
56
- "Sonstige H." => /^Sonstige\s*Hinweise($|\s*\(\s*(Inkompatibilit&auml;ten|Beeinflussung\s*diagnostischer\s*Methoden|Haltbarkeit|Besondere\s*Lagerungshinweise|Hinweise\s+f&uuml;r\s+die\s+Handhabung)\s*\)$)|^Remarques/u, # 16
57
- "Swissmedic-Nr." => /^Zulassungsnummer(n|:|$|\s*\(\s*Swissmedic\s*\)$)/u, # 17
58
- "Packungen" => /^Packungen($|\s*\(\s*mit\s+Angabe\s+der\s+Abgabekategorie\s*\)$)/u, # 18
59
- "Reg.Inhaber" => /^Zulassungsinhaberin($|\s*\(\s*Firma\s+und\s+Sitz\s+gem&auml;ss\s*Handelsregisterauszug\s*\))/u, # 19
60
- "Stand d. Info." => /^Stand\s+der\s+Information$/iu, # 20
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
- "Nom" => /^Nom$/u, # 1
64
- "Composit." => /^Composition$/u, # 2
65
- "Forme gal." => /^Forme\s+gal&eacute;nique\s+et\s+quantit&eacute;\s+de\s+principe\s+actif\s+par\s+unit&eacute;|^Forme\s*gal.nique/iu, # 3
66
- "Indic./emploi" => /^Indications\s*\/\s*Possibilit&eacute;s\s+d&apos;emploi/u, # 4
67
- "Posolog./mode d&apos;empl." => /^Posologie\s*\/\s*Mode\s+d&apos;emploi/u, # 5
68
- "Contre-Ind." => /^Contre\-indications$/iu, # 6
69
- "Pr&eacute;cautions" => /^Mises\s+en\s+garde\s+et\s+pr&eacute;cautions/u, # 7
70
- "Interact." => /^Interactions$/u, # 8
71
- "Grossesse" => /^Grossesse\s*\/\s*Allaitement/u, # 9
72
- "Apt.conduite" => /^Effet\s+sur\s+l&apos;aptitude\s+&agrave;\s+la\s+conduite\s+et\s+l&apos;utilisation\s+de\s+machines/u, # 10
73
- "Effets ind&eacute;sir." => /^Effets\s+ind&eacute;sirables$/u, # 11
74
- "Surdosage" => /^Surdosage$/u, # 12
75
- "Propri&eacute;t&eacute;s" => /^Propri&eacute;t&eacute;s\s*\/\s*Effets$/iu, # 13
76
- "Pharm.cin&eacute;t." => /^Pharmacocin&eacute;tique$/iu, # 14
77
- "Donn.pr&eacute;cl." => /^Donn&eacute;es\s+pr&eacute;cliniques$/u, # 15
78
- "Remarques" => /^Remarques\s+particuli&egrave;res$/u, # 16
79
- "Estampille" => /^Num&eacute;ro\s+d&apos;autorisation$/u, # 17
80
- "Pr&eacute;sentations" => /^Pr&eacute;sentation$/u, # 18
81
- "Titulaire" => /^Titulaire\s+de\s+l&apos;autorisation$/u, # 19
82
- "Mise &agrave; jour" => /^Mise\s+.\s+jour$|^Etat\s+de\s+l&apos;information/iu, # 20
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(/&apos;/, '').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.3
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: 2012-07-12 00:00:00.000000000 Z
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: &21383980 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: '3.10'
19
+ version: '4.0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *21383980
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: &21383540 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ~>
31
32
  - !ruby/object:Gem::Version
32
- version: '2.13'
33
+ version: '3.6'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *21383540
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: 1.8.15
89
+ rubygems_version: 2.2.1
85
90
  signing_key:
86
- specification_version: 3
91
+ specification_version: 4
87
92
  summary: ''
88
93
  test_files: []