ddfreyne on bundler
ddfreyne on main
Bump nokogiri from 1.13.5 to 1.… Merge pull request #269 from na… (compare)
dependabot[bot] on bundler
Bump nokogiri from 1.13.5 to 1.… (compare)
dependabot[bot] on bundler
ddfreyne on main
Bump nokogiri from 1.13.4 to 1.… Merge pull request #268 from na… (compare)
dependabot[bot] on bundler
Bump nokogiri from 1.13.4 to 1.… (compare)
ddfreyne on fix-gh-1572-binary-content-cache-permissions
Fix: Support non-writable binar… (compare)
# promote selected theme items
@items.find_all("/**/_themes/#{theme}/**/*.*").each do |item|
promoted = item.identifier.to_s.sub("/_themes/#{theme}/", '/')
item.identifier = promoted
end
@items.delete_if do |item|
item.identifier =~ "/**/_themes/**/*.*"
end
/**//foo/bar.baz
to /**/foo/bar.baz
. But sometimes I have /**/foo/bar.baz
that already exists as a placeholder. So now I hav 2
items with the same identifier
promoted
if they already exist. How can I do so elegantly?
Alright I did this
# promote selected theme items
@items.find_all("/**/_themes/#{theme}/**/*.*").each do |item|
promoted_identifier = item.identifier.to_s.sub("/_themes/#{theme}/", '/')
@items.delete_if { |item| item.identifier.to_s == promoted_identifier }
item.identifier = promoted_identifier
end
@items.delete_if do |item|
item.identifier =~ "/**/_themes/**/*.*"
end
I wasn't sure about calling #delete_if
from within #find_all
delete_if
in find_all
might not yield the correct results. You could build a list of items to delete:to_delete = []
@items.find_all(…) do
…
to_delete << item.identifier if item.identifier.to_s == promoted_identifier
end
@items.delete_if { |item| to_delete.include?(item.identifier) }
delete_if
it deletes both items that share the same identifier after "promotion"
:rewind
for snapshots?Many aspects of asciidoctor generated html depends on the asciidoctor stylesheet. Their documentation states one can get it programmatically with
require 'asciidoctor'
Asciidoctor::Stylesheets.instance.write_primary_stylesheet '.'
It should be easy to create a rule to do that but wouldn't it make sense to have nanoc do that automatically? So that one can @import the asciidoctor stylesheet from one's own stylesheet. Or am I completely off here?
@luc-j-bourhis I think you could create a file like assets/style/asciidoctor.css.erb
and in there, put
<%= Asciidoctor::Stylesheets.instance.primary_stylesheet_data %>
and then ensure that that .erb
file has a matching rule that says filter :erb
, e.g.
compile '/assets/style/*.erb' do
filter :erb
write ext: 'css'
end
Nanoc asciidoctor filter seems to ignore document title. If I start a document with
= My great title
== Introduction
then asciidoctor CLI will produce
...
<body class="article">
<div id="header">
<h1>My great title</h1>
</div>
<div id="content">
<div class="sect1">
<h2 id="_introduction">Introduction</h2>
...
whereas nanoc will produce
...
<body>
<div class="sect1">
<h2 id="_introduction">Introduction</h2>
...
Compiling site…
/usr/local/lib/ruby/3.1.0/set.rb:510: warning: Exception in finalizer #<Proc:0x00007fd57dfef3d0 /home/vagrant/.bundle/ruby/3.1.0/gems/ref-2.0.0/lib/ref/soft_reference.rb:28 (lambda)>
/home/vagrant/.bundle/ruby/3.1.0/gems/ref-2.0.0/lib/ref/soft_reference.rb:29:in `synchronize': can't be called from trap context (ThreadError)
from /home/vagrant/.bundle/ruby/3.1.0/gems/ref-2.0.0/lib/ref/soft_reference.rb:29:in `block in <class:SoftReference>'
from /usr/local/lib/ruby/3.1.0/set.rb:510:in `each'
from /home/vagrant/.bundle/ruby/3.1.0/gems/nanoc-core-4.12.3/lib/nanoc/core/outdatedness_status.rb:16:in `any?'
from /home/vagrant/.bundle/ruby/3.1.0/gems/nanoc-core-4.12.3/lib/nanoc/core/outdatedness_status.rb:16:in `useful_to_apply?'
from /home/vagrant/.bundle/ruby/3.1.0/gems/nanoc-core-4.12.3/lib/nanoc/core/outdatedness_checker.rb:82:in `block in apply_rules'
from /home/vagrant/.bundle/ruby/3.1.0/gems/nanoc-core-4.12.3/lib/nanoc/core/outdatedness_checker.rb:81:in `each'
from /home/vagrant/.bundle/ruby/3.1.0/gems/nanoc-core-4.12.3/lib/nanoc/core/outdatedness_checker.rb:81:in `inject'
from /home/vagrant/.bundle/ruby/3.1.0/gems/nanoc-core-4.12.3/lib/nanoc/core/outdatedness_checker.rb:81:in `apply_rules'
from /home/vagrant/.bundle/ruby/3.1.0/gems/nanoc-core-4.12.3/lib/nanoc/core/outdatedness_checker.rb:61:in `outdatedness_status_for'
from /home/vagrant/.bundle/ruby/3.1.0/gems/ddmemoize-1.0.0/lib/ddmemoize.rb:89:in `block in memoize'
master
via nanoc deploy
to our server via rsync
Rules
file for nanoc to implement the same functionality
/content/blog/YYYY-MM-DD-title.md
, it would be nice to have them of the form /content/blog/YYYY-MM-DD-title/index.md
, since then I could put e.g. any images that I want to include in the same folder
I know I just have to modify the compile '/blog/*.md' do
entry in my Rules
file, which is currently this:
compile '/blog/*.md' do
filter :pandoc, args: [
:katex
]
layout '/Post.*'
filter :add_toc
y,m,d,slug = /([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+).md/.match(item.identifier).captures
write "/blog/#{y}/#{m}/#{d}/#{slug}.html"
end
but the match(item.identifier)
line is throwing me off
nanoc view
and use an SSL cert? I found a comment in the webrick issue tracker on how to use HTTPS, but I don't know how to make this work with Nanoc https://github.com/ruby/webrick/issues/71#issuecomment-903286425.
/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)(\/index)?.md/
mkcert
providing the cert. There's probably an easier way with caddy, but I haven't tested.