indydoc 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7d15ff3b619425fd11ab09a560b077ad0a010d85
4
+ data.tar.gz: 63ce1209b39224380e9ff5a7ead3109d4b0d0045
5
+ SHA512:
6
+ metadata.gz: 9cdd0bf715bbbca7cc296115ab3debff15709f1f0ec097974b2634126c5b7beacd23b16b82e2c2c940ae602ad63b705256d8a9fb9cf35d7fbe40f7fe975e639e
7
+ data.tar.gz: adafa3ff43b8e02b07f776c6c64542d2ccdd0dc27e2b77fc8d587641d98f9ad9a107e149407e526a9cd6591d527dc6699d28fba2fd4857c7271492eb9f7bbdf1
Binary file
Binary file
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: indydoc.rb
4
+
5
+ require 'nokogiri'
6
+ require 'open-uri'
7
+ require 'method_parser'
8
+
9
+
10
+ class IndyDoc
11
+
12
+ def initialize(file=nil, path: File.dirname(__FILE__))
13
+ @file = file
14
+ @px = File.read(file) if file
15
+ @path = path
16
+ end
17
+
18
+ def parse(filepath)
19
+ mp = MethodParser.new File.read(filepath)
20
+ @raw_xml = mp.to_xml
21
+ end
22
+
23
+ def save(filepath=@file)
24
+
25
+ raise 'IndyDoc#save: please supply a file path' if filepath.nil?
26
+
27
+ @px ||= self.to_px
28
+ File.write filepath, @px
29
+ puts 'saved'
30
+ end
31
+
32
+ def to_px
33
+ doc = Nokogiri::XML(@raw_xml)
34
+ xsl_source = File.read(File.join(@path,'to_polyrex.xsl'))
35
+ #xsl_source = open(File.join(@path,'template.xsl'),
36
+ # 'UserAgent' => 'IndyDoc').read
37
+ xslt = Nokogiri::XSLT(xsl_source)
38
+ xslt.transform(doc).to_s
39
+ end
40
+ end
@@ -0,0 +1,50 @@
1
+ <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
2
+ <xsl:output method="xml" indent="yes" />
3
+
4
+ <xsl:template match='doc'>
5
+
6
+ <xsl:element name='doc'>
7
+ <xsl:element name='summary'>
8
+ <xsl:element name="project">project1</xsl:element>
9
+ <xsl:element name="desc"><xsl:text> </xsl:text></xsl:element>
10
+ </xsl:element>
11
+ <xsl:element name='records'>
12
+ <xsl:apply-templates select='klass' />
13
+ </xsl:element>
14
+ </xsl:element>
15
+
16
+ </xsl:template>
17
+
18
+ <xsl:template match='klass'>
19
+
20
+ <xsl:element name='klass'>
21
+ <xsl:element name="summary">
22
+ <xsl:element name='name'>
23
+ <xsl:value-of select='@name'/>
24
+ </xsl:element>
25
+ </xsl:element>
26
+ <xsl:element name='records'>
27
+ <xsl:apply-templates select='def' />
28
+ </xsl:element>
29
+ </xsl:element>
30
+
31
+ </xsl:template>
32
+
33
+ <xsl:template match='def'>
34
+
35
+ <xsl:element name='def'>
36
+ <xsl:element name="summary">
37
+ <xsl:element name='name'>
38
+ <xsl:value-of select='@name'/>
39
+ </xsl:element>
40
+ <xsl:element name='scope'>
41
+ <xsl:value-of select='@scope'/>
42
+ </xsl:element>
43
+ <xsl:element name="desc"><xsl:text> </xsl:text></xsl:element>
44
+ </xsl:element>
45
+ <xsl:element name="records"></xsl:element>
46
+ </xsl:element>
47
+
48
+ </xsl:template>
49
+
50
+ </xsl:stylesheet>
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: indydoc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE0MDkxODE1NDczMFoXDTE1MDkxODE1NDczMFowSD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la4CrzcJW0P5NjbgUPEy9xfTnms03KvNvL6Gx
32
+ 5ZaE7gNbPGDp7Q==
33
+ -----END CERTIFICATE-----
34
+ date: 2014-09-18 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: nokogiri
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.6'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.6.2.1
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.6'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.6.2.1
56
+ - !ruby/object:Gem::Dependency
57
+ name: method_parser
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.1'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.1.5
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.1'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.5
76
+ description:
77
+ email: james@r0bertson.co.uk
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/indydoc.rb
83
+ - lib/to_polyrex.xsl
84
+ homepage: https://github.com/jrobertson/indydoc
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.2.2
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Generate source code documentation from source code + Polyrex file.
108
+ test_files: []
Binary file