struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts-site git commit: Adds possibility to fetch remote content
Date Mon, 31 Jul 2017 14:11:05 GMT
Repository: struts-site
Updated Branches:
  refs/heads/master c758d1138 -> ad23e37fa


Adds possibility to fetch remote content


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/ad23e37f
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/ad23e37f
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/ad23e37f

Branch: refs/heads/master
Commit: ad23e37fa5e1000bfb0d674eb06e1956ddb00426
Parents: c758d11
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Mon Jul 31 16:10:57 2017 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Mon Jul 31 16:10:57 2017 +0200

----------------------------------------------------------------------
 Gemfile                                      |  1 +
 Gemfile.lock                                 |  2 ++
 source/_plugins/remote_file_content.rb       | 36 +++++++++++++++++++++
 source/core-developers/struts-default-xml.md | 38 +++++++----------------
 4 files changed, 51 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/ad23e37f/Gemfile
----------------------------------------------------------------------
diff --git a/Gemfile b/Gemfile
index c99d6dd..0bd62a9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,3 +1,4 @@
 source "https://rubygems.org"
 
 gem "jekyll"
+gem "json"

http://git-wip-us.apache.org/repos/asf/struts-site/blob/ad23e37f/Gemfile.lock
----------------------------------------------------------------------
diff --git a/Gemfile.lock b/Gemfile.lock
index 3a255aa..7893558 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -16,6 +16,7 @@ GEM
       sass (~> 3.4)
     jekyll-watch (1.3.1)
       listen (~> 3.0)
+    json (2.1.0)
     kramdown (1.10.0)
     liquid (3.0.6)
     listen (3.0.6)
@@ -34,6 +35,7 @@ PLATFORMS
 
 DEPENDENCIES
   jekyll
+  json
 
 BUNDLED WITH
    1.11.2

http://git-wip-us.apache.org/repos/asf/struts-site/blob/ad23e37f/source/_plugins/remote_file_content.rb
----------------------------------------------------------------------
diff --git a/source/_plugins/remote_file_content.rb b/source/_plugins/remote_file_content.rb
new file mode 100644
index 0000000..686665d
--- /dev/null
+++ b/source/_plugins/remote_file_content.rb
@@ -0,0 +1,36 @@
+require 'net/http'
+require 'uri'
+
+module Jekyll
+
+  class RemoteFileContent < Liquid::Tag
+
+    def initialize(tag_name, markup, tokens)
+      url = markup
+
+      puts 'Fetching content of url: ' + url
+
+      if url =~ URI::regexp
+        @content = fetchContent(url)
+      else
+        raise 'Invalid URL passed to RemoteFileContent'
+      end
+
+      super
+    end
+
+    def render(context)
+      if @content
+        @content
+      else
+        raise 'Something went wrong in RemoteFileContent'
+      end
+    end
+
+    def fetchContent(url)
+      Net::HTTP.get(URI.parse(URI.encode(url.strip)))
+    end
+  end
+end
+
+Liquid::Template.register_tag('remote_file_content', Jekyll::RemoteFileContent)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-site/blob/ad23e37f/source/core-developers/struts-default-xml.md
----------------------------------------------------------------------
diff --git a/source/core-developers/struts-default-xml.md b/source/core-developers/struts-default-xml.md
index 9b65c14..22ab774 100644
--- a/source/core-developers/struts-default-xml.md
+++ b/source/core-developers/struts-default-xml.md
@@ -5,34 +5,20 @@ title: struts-default.xml
 
 # struts-default.xml
 
-A base configuration file named 
+A base configuration file named `struts-default.xml` is included in the `struts2-core.jar`
file. This file is 
+automatically included into `struts.xml` file to provide the standard configuration settings
without having 
+to copy them.
 
-~~~~~~~
-struts-default.xml
-~~~~~~~
- is included in the 
+> To exclude the `struts-default.xml` or to provide your own version, see the `struts.configuration.files`
+> setting in [struts.properties](struts-properties.html).
 
-~~~~~~~
-struts2.jar
-~~~~~~~
- file\. This file is automatically included into 
+The content of `struts-default.xml` is here:
 
-~~~~~~~
-struts.xml
-~~~~~~~
- file to provide the standard configuration settings without having to copy them\.
+{% highlight xml %}
+{% remote_file_content https://raw.githubusercontent.com/apache/struts/master/core/src/main/resources/struts-default.xml
%}
+{% endhighlight %}
 
+This file defines all of the default bundled results and interceptors and many interceptor
stacks which you can use 
+either as-is or as a basis for your own application-specific interceptor stacks. 
 
-
-| To exclude the struts\-default\.xml or to provide your own version, see the struts\.configuration\.files
setting in [struts.properties](struts-properties.html)\.
-
-| 
-
-The contents of struts\-default\.xml are here:
-
-
-~~~~~~~
-{snippet:id=all|lang=xml|url=struts2/core/src/main/resources/struts-default.xml}
-~~~~~~~
-
-This file defines all of the default bundled results and interceptors and many interceptor
stacks which you can use either as\-is or as a basis for your own application\-specific interceptor
stacks\. **Notice the name of the package is "struts\-default"**\.
\ No newline at end of file
+**Notice the name of the package is "struts-default"**


Mime
View raw message