rack-xslview 0.1.2 → 0.1.3

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.
Files changed (4) hide show
  1. data/README.md +11 -9
  2. data/VERSION +1 -1
  3. data/lib/rack-xslview.rb +6 -1
  4. metadata +2 -2
data/README.md CHANGED
@@ -13,20 +13,22 @@ This is how I would like it to work, but its not there yet:
13
13
 
14
14
  <pre class="sh_ruby">
15
15
  # Create the xslt object
16
- xslt = ::XML::XSLT.new()
16
+ xslt = XML::XSLT.new()
17
17
 
18
18
  # Set the default XSL
19
- xslt.xsl = REXML::Document.new File.open('/path/to/output.xhtml10.xsl')
19
+ xslfile = REXML::Document.new File.open('/path/to/output.xhtml10.xsl').read
20
+ xslt.xsl = xslfile
20
21
 
21
- # Paths to exclude
22
- noxsl = [/^\/raw/, '/s/js/', '/s/css/']
22
+ omitxsl = ['/raw/', '/s/js/', '/s/css/', '/s/img/']
23
+ passenv = ['PATH_INFO', 'RACK_MOUNT_PATH', 'RACK_ENV']
23
24
 
24
- # NOTE: multiple stylesheets is still in planning
25
- xslhash = { "/path/alskjddf" => "test.xsl", /specific\.xml$/ => 'different.xsl' }
26
- xslhash.default("/path/to/output.xhtml10.xsl")
25
+ use Rack::XSLView,
26
+ :myxsl => xslt,
27
+ :noxsl => omitxsl,
28
+ :passenv => passenv,
29
+ :xslfile => xslfile,
30
+ :reload => ENV['RACK_ENV'] == 'development' ? true : false
27
31
 
28
- # Use the middleware
29
- use Rack::XSLView, :myxsl => default_xsl, :noxsl => noxsl, :xslhash => xslhash
30
32
  </pre>
31
33
 
32
34
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/rack-xslview.rb CHANGED
@@ -8,7 +8,7 @@ module Rack
8
8
  @options = {:myxsl => nil}.merge(options)
9
9
  if @options[:myxsl] == nil
10
10
  @xslt = XML::XSLT.new()
11
- @xslt.xsl = File.join(File.dirname(__FILE__), 'output.xhtml10.xsl')
11
+ @xslt.xsl = REXML::Document.new '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"><xsl:import href="http://github.com/docunext/1bb02b59/raw/master/standard.html.xsl"/><xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" indent="yes"/></xsl:stylesheet>'
12
12
  else
13
13
  @xslt = @options[:myxsl]
14
14
  end
@@ -18,6 +18,11 @@ module Rack
18
18
  if checknoxsl(env)
19
19
  @app.call(env)
20
20
  else
21
+ if @options[:reload] == true
22
+ puts @options[:filepath]
23
+ @xslt = XML::XSLT.new()
24
+ @xslt.xsl = REXML::Document.new @options[:xslfile]
25
+ end
21
26
  unless @options[:passenv] == nil
22
27
  @options[:passenv].each { |envkey|
23
28
  if (mp = env[envkey])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-xslview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Lash
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-20 00:00:00 -05:00
12
+ date: 2010-03-03 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency