This is an automated email from the ASF dual-hosted git repository.
kpumuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/thrift-website.git
The following commit(s) were added to refs/heads/main by this push:
new 1d75b0d Update Jekyll toolchain and local snippet rendering
1d75b0d is described below
commit 1d75b0d1dbfc306af806fe398e4a3da19f04c233
Author: Dmytro Shteflyuk <[email protected]>
AuthorDate: Wed Apr 15 17:19:14 2026 -0400
Update Jekyll toolchain and local snippet rendering
---
README.md | 14 ++++++++++
_layouts/default.html | 2 +-
_plugins/remote_snippets.rb | 11 +++++---
static/css/codehilite.css | 62 ---------------------------------------------
static/css/rouge.css | 62 +++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 84 insertions(+), 67 deletions(-)
diff --git a/README.md b/README.md
index 48f7dac..eb3559a 100644
--- a/README.md
+++ b/README.md
@@ -79,6 +79,20 @@ can be quite useful if trying to get some CSS or HTML styled
Jekyll will print a local URL where the site can be viewed
(usually, [http://0.0.0.0:4000/](http://0.0.0.0:4000/)).
+### Testing with a Local Thrift Checkout
+
+Some pages on this site are rendered from files in the Apache Thrift
+repository via the `{% remote_snippet %}` tag. By default those snippets
+are fetched from the `master` branch of the Thrift repository while Jekyll
+builds the site.
+
+If you want to test local changes to those source files before pushing
+them, point the website build at your local Thrift checkout:
+
+```bash
+THRIFT_DIR=/path/to/thrift bundle exec jekyll serve -w
+```
+
## Publishing
### Automatic Staging
diff --git a/_layouts/default.html b/_layouts/default.html
index fb7307b..db624df 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -7,7 +7,7 @@
<link href="/static/images/favicon.ico" rel="shortcut icon" />
<link href="/static/css/style.css" rel="stylesheet" type="text/css" />
- <link href="/static/css/codehilite.css" rel="stylesheet" type="text/css" />
+ <link href="/static/css/rouge.css" rel="stylesheet" type="text/css" />
<link href="/static/css/bootstrap.css" media="screen, projection"
rel="stylesheet" type="text/css" />
<link href="/static/css/thrift.css" media="screen, projection"
rel="stylesheet" type="text/css" />
diff --git a/_plugins/remote_snippets.rb b/_plugins/remote_snippets.rb
index 7fe56bb..9f90f70 100644
--- a/_plugins/remote_snippets.rb
+++ b/_plugins/remote_snippets.rb
@@ -22,7 +22,7 @@ class RemoteSnippet < Liquid::Tag
def render(context)
title = context.registers[:site].config['title']
prefix = context.registers[:site].config['gitbox_url']
- url = "#{prefix};a=blob_plain;hb=HEAD;f=#{@path}"
+ url = ENV["THRIFT_DIR"] ? File.new("#{ENV["THRIFT_DIR"]}/#{@path}") :
"#{prefix};a=blob_plain;hb=HEAD;f=#{@path}"
pretty_url = "#{prefix};a=blob;hb=HEAD;f=#{@path}"
content = ""
if @range == "all"
@@ -42,13 +42,17 @@ class RemoteSnippet < Liquid::Tag
end
snippet_type = "snippet"
if @type == "direct"
- content = Kramdown::Document.new(content).to_html
+ content = context.registers[:site]
+ .find_converter_instance(Jekyll::Converters::Markdown)
+ .convert(content.to_s)
snippet_type = "page"
else
content = content.force_encoding("utf-8")
- formatter = Rouge::Formatters::HTMLLegacy.new
+ formatter = Rouge::Formatters::HTML.new
lexer = Rouge::Lexer.find_fancy(@type, content)
content = formatter.format(lexer.lex(content))
+
+ content = %Q(<figure class="highlight"><pre><code
class="language-#{@type.to_s.tr("+", "-")}"
data-lang="#{@type}">#{content}</code></pre></figure>)
end
#content = CGI::escapeHTML(content)
return """
@@ -61,4 +65,3 @@ class RemoteSnippet < Liquid::Tag
end
Liquid::Template.register_tag('remote_snippet', RemoteSnippet)
-
diff --git a/static/css/codehilite.css b/static/css/codehilite.css
deleted file mode 100644
index 999d018..0000000
--- a/static/css/codehilite.css
+++ /dev/null
@@ -1,62 +0,0 @@
-.codehilite .hll { background-color: #ffffcc }
-.codehilite { background: #f0f0f0; }
-.codehilite .c { color: #60a0b0; font-style: italic } /* Comment */
-.codehilite .err { border: 1px solid #FF0000 } /* Error */
-.codehilite .k { color: #007020; font-weight: bold } /* Keyword */
-.codehilite .o { color: #666666 } /* Operator */
-.codehilite .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */
-.codehilite .cp { color: #007020 } /* Comment.Preproc */
-.codehilite .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */
-.codehilite .cs { color: #60a0b0; background-color: #fff0f0 } /*
Comment.Special */
-.codehilite .gd { color: #A00000 } /* Generic.Deleted */
-.codehilite .ge { font-style: italic } /* Generic.Emph */
-.codehilite .gr { color: #FF0000 } /* Generic.Error */
-.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-.codehilite .gi { color: #00A000 } /* Generic.Inserted */
-.codehilite .go { color: #808080 } /* Generic.Output */
-.codehilite .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
-.codehilite .gs { font-weight: bold } /* Generic.Strong */
-.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-.codehilite .gt { color: #0040D0 } /* Generic.Traceback */
-.codehilite .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
-.codehilite .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
-.codehilite .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
-.codehilite .kp { color: #007020 } /* Keyword.Pseudo */
-.codehilite .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
-.codehilite .kt { color: #902000 } /* Keyword.Type */
-.codehilite .m { color: #40a070 } /* Literal.Number */
-.codehilite .s { color: #4070a0 } /* Literal.String */
-.codehilite .na { color: #4070a0 } /* Name.Attribute */
-.codehilite .nb { color: #007020 } /* Name.Builtin */
-.codehilite .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
-.codehilite .no { color: #60add5 } /* Name.Constant */
-.codehilite .nd { color: #555555; font-weight: bold } /* Name.Decorator */
-.codehilite .ni { color: #d55537; font-weight: bold } /* Name.Entity */
-.codehilite .ne { color: #007020 } /* Name.Exception */
-.codehilite .nf { color: #06287e } /* Name.Function */
-.codehilite .nl { color: #002070; font-weight: bold } /* Name.Label */
-.codehilite .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
-.codehilite .nt { color: #062873; font-weight: bold } /* Name.Tag */
-.codehilite .nv { color: #bb60d5 } /* Name.Variable */
-.codehilite .ow { color: #007020; font-weight: bold } /* Operator.Word */
-.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
-.codehilite .mf { color: #40a070 } /* Literal.Number.Float */
-.codehilite .mh { color: #40a070 } /* Literal.Number.Hex */
-.codehilite .mi { color: #40a070 } /* Literal.Number.Integer */
-.codehilite .mo { color: #40a070 } /* Literal.Number.Oct */
-.codehilite .sb { color: #4070a0 } /* Literal.String.Backtick */
-.codehilite .sc { color: #4070a0 } /* Literal.String.Char */
-.codehilite .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
-.codehilite .s2 { color: #4070a0 } /* Literal.String.Double */
-.codehilite .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape
*/
-.codehilite .sh { color: #4070a0 } /* Literal.String.Heredoc */
-.codehilite .si { color: #70a0d0; font-style: italic } /*
Literal.String.Interpol */
-.codehilite .sx { color: #c65d09 } /* Literal.String.Other */
-.codehilite .sr { color: #235388 } /* Literal.String.Regex */
-.codehilite .s1 { color: #4070a0 } /* Literal.String.Single */
-.codehilite .ss { color: #517918 } /* Literal.String.Symbol */
-.codehilite .bp { color: #007020 } /* Name.Builtin.Pseudo */
-.codehilite .vc { color: #bb60d5 } /* Name.Variable.Class */
-.codehilite .vg { color: #bb60d5 } /* Name.Variable.Global */
-.codehilite .vi { color: #bb60d5 } /* Name.Variable.Instance */
-.codehilite .il { color: #40a070 } /* Literal.Number.Integer.Long */
diff --git a/static/css/rouge.css b/static/css/rouge.css
new file mode 100644
index 0000000..18628e7
--- /dev/null
+++ b/static/css/rouge.css
@@ -0,0 +1,62 @@
+.highlight .hll { background-color: #ffffcc }
+.highlight { background: #f0f0f0; }
+.highlight .c { color: #60a0b0; font-style: italic } /* Comment */
+.highlight .err { border: 1px solid #FF0000 } /* Error */
+.highlight .k { color: #007020; font-weight: bold } /* Keyword */
+.highlight .o { color: #666666 } /* Operator */
+.highlight .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #007020 } /* Comment.Preproc */
+.highlight .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #60a0b0; background-color: #fff0f0 } /*
Comment.Special */
+.highlight .gd { color: #A00000 } /* Generic.Deleted */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #FF0000 } /* Generic.Error */
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
+.highlight .go { color: #808080 } /* Generic.Output */
+.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #0040D0 } /* Generic.Traceback */
+.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #007020 } /* Keyword.Pseudo */
+.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #902000 } /* Keyword.Type */
+.highlight .m { color: #40a070 } /* Literal.Number */
+.highlight .s { color: #4070a0 } /* Literal.String */
+.highlight .na { color: #4070a0 } /* Name.Attribute */
+.highlight .nb { color: #007020 } /* Name.Builtin */
+.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
+.highlight .no { color: #60add5 } /* Name.Constant */
+.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
+.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
+.highlight .ne { color: #007020 } /* Name.Exception */
+.highlight .nf { color: #06287e } /* Name.Function */
+.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
+.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
+.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #bb60d5 } /* Name.Variable */
+.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.highlight .mf { color: #40a070 } /* Literal.Number.Float */
+.highlight .mh { color: #40a070 } /* Literal.Number.Hex */
+.highlight .mi { color: #40a070 } /* Literal.Number.Integer */
+.highlight .mo { color: #40a070 } /* Literal.Number.Oct */
+.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
+.highlight .sc { color: #4070a0 } /* Literal.String.Char */
+.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
+.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape
*/
+.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
+.highlight .si { color: #70a0d0; font-style: italic } /*
Literal.String.Interpol */
+.highlight .sx { color: #c65d09 } /* Literal.String.Other */
+.highlight .sr { color: #235388 } /* Literal.String.Regex */
+.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
+.highlight .ss { color: #517918 } /* Literal.String.Symbol */
+.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
+.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
+.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
+.highlight .il { color: #40a070 } /* Literal.Number.Integer.Long */