jekyll-x3d 1.0.0 → 1.0.1
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 +4 -4
- data/LICENSE.txt +21 -0
- data/lib/jekyll-x3d/version.rb +5 -0
- data/lib/jekyll-x3d.rb +86 -0
- data/package.json +9 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6fe33ba50fdd92beaa80c68b657acec45e0b655085a0369a59fff0e5f7c1cc8
|
4
|
+
data.tar.gz: e6dde065888b7513531a4a0c0a1fcc056dc3333c82a3a386a78d03dcd9e73f6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3b5fe67c4cbcc968734221c7f3cd1720ba88794399aaefac4dd2464311b198d9d9aa874f3f0c7a65660b9d5f1261e9b7b45ace56e783a47c3a15501643e8d8b
|
7
|
+
data.tar.gz: 822e3166e7d82c4a2369e19ee4b2d4de82b98f529c57779c5499b9491bd9ffb2f8e4d590ffe557c9fc331c3efa61cddc532e959f3195704b5bc5f56f2a118bb6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Holger Seelig
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/lib/jekyll-x3d.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "jekyll-x3d/version"
|
5
|
+
require "jekyll"
|
6
|
+
|
7
|
+
# This "hook" is executed right before the site"s pages are rendered
|
8
|
+
Jekyll::Hooks.register :site, :pre_render do |site|
|
9
|
+
# puts "Adding X3D Markdown Lexer ..."
|
10
|
+
require "rouge"
|
11
|
+
|
12
|
+
# This class defines the X3D lexer which is used to highlight "x3d" code snippets during render-time
|
13
|
+
class X3D < Rouge::Lexers::XML
|
14
|
+
title "X3D"
|
15
|
+
desc "X3D XML Encoding"
|
16
|
+
|
17
|
+
tag "x3d"
|
18
|
+
aliases "x3d"
|
19
|
+
filenames "*.x3d"
|
20
|
+
|
21
|
+
mimetypes "model/x3d+xml"
|
22
|
+
|
23
|
+
def self.detect?(text)
|
24
|
+
return false if text.doctype?(/X3D/)
|
25
|
+
return true if text =~ /<X3D\b/
|
26
|
+
end
|
27
|
+
|
28
|
+
start do
|
29
|
+
@javascript = Rouge::Lexers::Javascript.new(options)
|
30
|
+
@glsl = Rouge::Lexers::Glsl.new(options)
|
31
|
+
end
|
32
|
+
|
33
|
+
state :root do
|
34
|
+
rule %r/[^<&]+/, Text
|
35
|
+
rule %r/&\S*?;/, Name::Entity
|
36
|
+
|
37
|
+
rule %r/(<!\[CDATA\[)((?:ecmascript|javascript|vrmlscript):|data:(?:text|application)\/javascript,)/ do
|
38
|
+
groups Comment::Preproc, Str::Delimiter
|
39
|
+
@javascript.reset!
|
40
|
+
push :ecmascript
|
41
|
+
end
|
42
|
+
|
43
|
+
rule %r/(<!\[CDATA\[)(data:x-shader\/(?:x-fragment|x-vertex),)/ do
|
44
|
+
groups Comment::Preproc, Str::Delimiter
|
45
|
+
@glsl.reset!
|
46
|
+
push :glsl
|
47
|
+
end
|
48
|
+
|
49
|
+
rule %r/<!\[CDATA\[.*?\]\]\>/, Comment::Preproc
|
50
|
+
rule %r/<!--/, Comment, :comment
|
51
|
+
rule %r/<\?.*?\?>/, Comment::Preproc
|
52
|
+
rule %r/<![^>]*>/, Comment::Preproc
|
53
|
+
|
54
|
+
# open tags
|
55
|
+
rule %r(<\s*[\p{L}:_][\p{Word}\p{Cf}:.·-]*)m, Name::Tag, :tag
|
56
|
+
|
57
|
+
# self-closing tags
|
58
|
+
rule %r(<\s*/\s*[\p{L}:_][\p{Word}\p{Cf}:.·-]*\s*>)m, Name::Tag
|
59
|
+
end
|
60
|
+
|
61
|
+
state :ecmascript do
|
62
|
+
rule %r/[^\]]+/ do
|
63
|
+
delegate @javascript
|
64
|
+
end
|
65
|
+
|
66
|
+
rule %r/\]\]\>/, Comment::Preproc, :pop!
|
67
|
+
|
68
|
+
rule %r/\]/ do
|
69
|
+
delegate @javascript
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
state :glsl do
|
74
|
+
rule %r/[^\]]+/ do
|
75
|
+
delegate @glsl
|
76
|
+
end
|
77
|
+
|
78
|
+
rule %r/\]\]\>/, Comment::Preproc, :pop!
|
79
|
+
|
80
|
+
rule %r/\]/ do
|
81
|
+
delegate @glsl
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
data/package.json
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-x3d
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Holger Seelig
|
@@ -18,7 +18,11 @@ executables: []
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
+
- LICENSE.txt
|
21
22
|
- README.md
|
23
|
+
- lib/jekyll-x3d.rb
|
24
|
+
- lib/jekyll-x3d/version.rb
|
25
|
+
- package.json
|
22
26
|
homepage: https://github.com/create3000/jekyll-x3d/blob/main/README.md
|
23
27
|
licenses:
|
24
28
|
- MIT
|