myoutline 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90f597b4aa3692f9be8c6ddc0b7bedb34de51b66
4
- data.tar.gz: b70bec17e1364b873bac2cd3bf44ede0c8c676ca
3
+ metadata.gz: b4a0da8fbdd54aa465b6b42d98b0d5a7efb6612b
4
+ data.tar.gz: fbc5c84534132fa2a9b9bf67e3332e74f572b43e
5
5
  SHA512:
6
- metadata.gz: 7183ec997a00fbb122f4103dd9d87b724b58373de635356a7301eccc35bdf2a5286af52cfab6acdf079b7a0ba3297a3987c063ccfbe9bed2c301c46e0fbb0eb1
7
- data.tar.gz: 669ede0d2938f1f132c481b55c7cf62858cfad77e93203d1bc8e148d02724bde210ae17a2b050b17fbac64f48c3a7d21ede4449240d83e7037f9e093793e541f
6
+ metadata.gz: 70f5d5ac636616fbacdb6056fb92c7eb789b9cb58bcaae203e9a13124a53312090eea39bf4695a83db88c14d6246250e769138387fed1144b86229f37892a561
7
+ data.tar.gz: 3b1512d0cfe823326387b8e142db482b1c2592e3e241ae6cb27cf16c7825891191424cbbb5828eb5819aab8d0bb18cac1786b67b620475fb7e4fb628704e7cc5
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/myoutline.rb CHANGED
@@ -3,13 +3,15 @@
3
3
  # file: myoutline.rb
4
4
 
5
5
  require 'pxindex'
6
+ require 'nokogiri'
6
7
 
7
8
 
8
9
  class MyOutline
9
10
 
10
- def initialize(source, debug: false, allsorted: true, autoupdate: true)
11
+ def initialize(source, debug: false, allsorted: true,
12
+ autoupdate: true, topic_url: '$topic')
11
13
 
12
- @debug, @source = debug, source
14
+ @debug, @source, @topic_url = debug, source, topic_url
13
15
 
14
16
  raw_s, _ = RXFHelper.read(source)
15
17
 
@@ -46,6 +48,21 @@ class MyOutline
46
48
 
47
49
  end
48
50
 
51
+ def to_html()
52
+
53
+ doc = Nokogiri::XML(self.to_px.to_xml)
54
+ xsl = Nokogiri::XSLT(xslt())
55
+
56
+ doc = Rexle.new(xsl.transform(doc).to_s)
57
+
58
+ doc.root.css('.atopic').each do |e|
59
+ e.attributes[:href] = @topic_url.sub(/\$topic/, e.text)
60
+ end
61
+
62
+ doc.xml(pretty: true)
63
+
64
+ end
65
+
49
66
  def to_px()
50
67
  @pxi.to_px
51
68
  end
@@ -69,5 +86,54 @@ class MyOutline
69
86
  a.join
70
87
 
71
88
  end
89
+
90
+ private
91
+
92
+ def xslt()
93
+ <<EOF
94
+ <?xml version="1.0" encoding="UTF-8"?>
95
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
96
+ <xsl:output method="xml" indent="yes" />
97
+
98
+ <xsl:template match='entries'>
99
+ <ul>
100
+ <xsl:apply-templates select='summary'/>
101
+ <xsl:apply-templates select='records'/>
102
+ </ul>
103
+ </xsl:template>
104
+
105
+ <xsl:template match='entries/summary'>
106
+ </xsl:template>
107
+
108
+ <xsl:template match='records/entry'>
109
+ <li><h1><xsl:value-of select="summary/title"/></h1><xsl:text>
110
+ </xsl:text>
111
+
112
+ <xsl:apply-templates select='records'/>
113
+
114
+ <xsl:text>
115
+ </xsl:text>
116
+ </li>
117
+ </xsl:template>
118
+
119
+
120
+ <xsl:template match='records/entry/records/entry'>
121
+ <ul id="{summary/title}">
122
+ <li><xsl:text>
123
+ </xsl:text><a href="{summary/title}" class='atopic'><xsl:value-of select="summary/title"/></a><xsl:text>
124
+ </xsl:text>
125
+
126
+ <xsl:apply-templates select='records'/>
127
+
128
+ <xsl:text>
129
+ </xsl:text>
130
+ </li>
131
+ </ul>
132
+ </xsl:template>
133
+
134
+
135
+ </xsl:stylesheet>
136
+ EOF
137
+ end
72
138
 
73
139
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myoutline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  DFhc5TDtqEkJYiaiznQFl34HUKeCAdeAHkmD8jP3fUC8O7zcLXq69EAXGMXw4efB
31
31
  3Co=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-03-18 00:00:00.000000000 Z
33
+ date: 2018-03-21 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: pxindex
@@ -52,6 +52,26 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.1.6
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.8'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 1.8.2
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '1.8'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.8.2
55
75
  description:
56
76
  email: james@jamesrobertson.eu
57
77
  executables: []
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- �W�@B�oH順�@t�<L�S�ery������07����\=�f9 �?�%�7�S�N�s�;)������^I�c��4��\�����4�B��7+Y AZR����{f�L��.T�l#ƥ�����R�3Ӗd�xN�p�"�F�%T��*]H�F���4�U?��^Џ�#�jeހ[��}6w-$�;z!�j�$�|�:~���FE���p��s����}�}٥޻`pq>,̊Y23g��N ��ݚuaEđ�$�]-
2
- ��
1
+ 3�nZĘ/�� -@�0}���5;��TjL
2
+ ��