view_inspect 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTY0NTA1MTUwYTE4ZTAzNDY0ODA2MmVmNWQ3Nzk1OTlkNzY0ZjI3NQ==
4
+ NDRmZTg4YmJjMGQ4ZTdkM2Q4ZjYxNjcxZWVjNDg1MzI4Yzc2YjRiNQ==
5
5
  data.tar.gz: !binary |-
6
- YTRhY2FlY2I5OTZkMzc1NGM5ODI1ZmUwZTFmZGE1ZGRjMDQ1MTA1YQ==
6
+ YmE4MTlmMDc1MWYwY2Q2OTE0YmIxMjgzODIxODI0NGI1YTNhZDIxMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmVhYjMyYjgxMGYxMTI2ZmE0ZWZiMWY2Njg4MDA0ZTUyYzU3Y2FhNmM5MWZl
10
- MDdlOTZlMDEyYmNlZWViZjM3Zjc1ZWUwZjQwYTZkMjFlN2EwYWE4Nzg1NDEy
11
- ZTlkMzUxYWQ4ZGNmOWVhYTA2ZTgyY2IxY2UyNGQ3Zjk5MzhkZDM=
9
+ ZTI5OWZlZDM5ODY2NzlkMzQwYWQ2NzVlMDBjNjE5MzRiZjRjYTk2ZDdlMGVm
10
+ MWIzOGM3MGYzNzE0NjUxZjkyYzc5MTYzZWYwYWVmMTQxYWZkZjQyN2ExMjJm
11
+ ZmZlMDVlNTA1ZDM4YWM1ZTRkZjE4ZjYzNWI3MWRiNDFjNGQyMmM=
12
12
  data.tar.gz: !binary |-
13
- ZjY2YjBhNjdlY2IzZWQ3MGRkNGViN2YxOTZhNjRhMWIyNzQ5MGIwZjNjY2Y5
14
- Y2Y2ZDJkZjkyNjk5MDcyYzc5YzllMDM5ZjE4MWM1ZTA5ODgwYWYxNWRjMjg2
15
- ZDc5ZWVkZWEyZGEyYzhkYzg2NjIxNGE5MDJmMTgxZmM4NTVhMjU=
13
+ ZmZhYzJmZDkyZWU2NjlhZGIwNDg3YjUzZTk4ZDFmNjI3MmEwNDllNTNmZjk1
14
+ MTBhMTMzN2ZmY2NmNzZhYmI4ZWI5ZGRiNWZlNmI0MTEyNjIyMTUzYWRlOTE5
15
+ MDZiMmEzNDFmYTM0Y2Q1NmY0MzJlNTQxNjA0M2RlODk5NmNhNGM=
data/README.markdown CHANGED
@@ -1,7 +1,7 @@
1
1
  View Inspect
2
2
  ============
3
3
 
4
- View Inspect tells you which server-side or client-side template is responsible for rendering a DOM element. Instead of using grep to filter through a large codebase, the source location can be found right away in its data-attribute when you open up web inspector. Works with Rails 3 and 4. See below for templates supported and their required libraries.
4
+ View Inspect shows you the exact file and line number of the server-side or client-side template that's responsible for rendering a DOM element. Instead of using grep to filter through a large codebase, the source location can be found right away in its data-attribute when you open up web inspector. Works with Rails 3 and 4. See below for templates supported and their required libraries.
5
5
 
6
6
  Demo
7
7
  ----
@@ -38,7 +38,7 @@ By default, this is only enabled for development to avoid exposing source code f
38
38
  How it Works
39
39
  ----
40
40
 
41
- Except for Haml and Slim where the compiler/parser is monkeypatched to include file:line information to each node, the rest of the templates are augment by preprocessing them with an HTML parser. Basically, we first stub out all template specific expressions (i.e. `<% %>` for erb) from a template file. Then, we use the Nokogiri HTML Parser to parse the resulting valid HTML fragment, and add file:line information to its child nodes. Once this is done, we bring back our original template expressions and remove the stubs. A little bit hacky but it works.
41
+ Except for Haml and Slim where the compiler/parser is monkeypatched, view templates are augmented with source location metadata by preprocessing them with an HTML parser. Basically, we first stub out all template specific expressions (i.e. `<% %>` for erb) from a template file. Then, we use the Nokogiri HTML Parser to parse the resulting valid HTML fragment, and add file:line information to its child nodes. Once this is done, we bring back our original template expressions and remove the stubs. A little bit hacky but it works.
42
42
 
43
43
 
44
44
  Server-Side Templates
@@ -55,11 +55,13 @@ For client-side templates to work, they have to live in separate files as oppose
55
55
 
56
56
  HTML Syntax Errors
57
57
  ----
58
- ViewInspect depends on Nokogiri to preprocess a template and add file:line information to each node. If there's any invalid HTML in your file, Nokogiri would delete it, and sometimes your HTML would look different in the browser because of this. To prevent that from happening, a Warning message would be shown to the user detailing where the HTML syntax errors are located so that the user can remove it. This is the default behavior.
58
+ ViewInspect depends on Nokogiri to preprocess a template and add file:line information to each node. If there's any invalid HTML in your file, Nokogiri would delete it, and sometimes your HTML would look different in the browser because of this.
59
59
 
60
- An alternative solution is to avoid adding file:line information to DOM elements whenever Nokogiri encounters HTML syntax errors. Instead, it'll just show the original HTML template. If you prefer this behavior, you can set it by adding this line to config/environments/development.rb
60
+ If such errors exist, view_inspect would simply return the original file template without the source location metadata to avoid malformed html.
61
61
 
62
- ViewInspect.show_html_syntax_error = false
62
+ An alternative solution is to show a warning message to the user detailing where the HTML syntax errors are located so that the user can remove it. To enable this, you can set it by adding this line to config/environments/development.rb
63
+
64
+ ViewInspect.show_html_syntax_error = true
63
65
 
64
66
  Copyright
65
67
  ----
@@ -1,3 +1,3 @@
1
1
  module ViewInspect
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
data/lib/view_inspect.rb CHANGED
@@ -9,7 +9,7 @@ module ViewInspect
9
9
  ServerSideTemplate.handle
10
10
  ClientSideTemplate.handle
11
11
 
12
- @show_html_syntax_error = true
12
+ @show_html_syntax_error = false
13
13
  end
14
14
 
15
15
  def self.allow_view_source_location?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_inspect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reginald Tan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-15 00:00:00.000000000 Z
11
+ date: 2014-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri