Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 24 06:52

    ddfreyne on bundler

    (compare)

  • May 24 06:52

    ddfreyne on main

    Bump nokogiri from 1.13.5 to 1.… Merge pull request #269 from na… (compare)

  • May 24 06:52
    ddfreyne closed #269
  • May 24 06:51
    ddfreyne commented #269
  • May 24 05:33
    netlify[bot] commented #269
  • May 24 05:33
    netlify[bot] commented #269
  • May 24 05:33
    dependabot[bot] labeled #269
  • May 24 05:33
    dependabot[bot] opened #269
  • May 24 05:33

    dependabot[bot] on bundler

    Bump nokogiri from 1.13.5 to 1.… (compare)

  • May 21 20:18

    dependabot[bot] on bundler

    (compare)

  • May 21 20:18

    ddfreyne on main

    Bump nokogiri from 1.13.4 to 1.… Merge pull request #268 from na… (compare)

  • May 21 20:18
    ddfreyne closed #268
  • May 19 03:41
    netlify[bot] commented #268
  • May 19 03:39
    netlify[bot] commented #268
  • May 19 03:39
    dependabot[bot] labeled #268
  • May 19 03:39
    dependabot[bot] opened #268
  • May 19 03:39

    dependabot[bot] on bundler

    Bump nokogiri from 1.13.4 to 1.… (compare)

  • May 08 09:33
    ddfreyne edited #1576
  • May 08 09:32
    ddfreyne opened #1576
  • May 08 09:30

    ddfreyne on fix-gh-1572-binary-content-cache-permissions

    Fix: Support non-writable binar… (compare)

Gregory Pakosz
@gpakosz
What do you think of this approach @ddfreyne ?
11 replies
lzap
@lzap:matrix.org
[m]
hey how do I specify multiple dependencies?
like: compile "/css/style.scss,/css/_xyz.scss"
am I assuming correctly that Rules is something like Makefile?
Christian Tietze
@DivineDominion
compile '/css/*.scss' do ... end could be what you're looking for @lzap:matrix.org but it probably depends on what comes next -- what do you want to do with this?
e.g. I'm skipping the _ prefixed files as partials and have the SCSS filter combine them
Gregory Pakosz
@gpakosz
@ddfreyne Hello Denis. I used to do this but somehow upgrading Nanoc seems to have broken it (I didn't bisect which change did yet)
  # 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
So it used to work but now that I think about it (because it doesn't work any more) I think what I'm doing is
Change the item identifier from /**//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
It seems like the thing to do is to remove items with the same identifier as promoted if they already exist. How can I do so elegantly?
Gregory Pakosz
@gpakosz

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

Denis Defreyne
@ddfreyne
I think that should still work… I don’t think there has been a version that changed this behavior
Calling 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) }
Gregory Pakosz
@gpakosz
Nope having a to_delete list that doesn't work 🙂
Because in delete_if it deletes both items that share the same identifier after "promotion"
Denis Defreyne
@ddfreyne
Oh right… that is not great
Gregory Pakosz
@gpakosz
@ddfreyne Hello! 👋 I have two questions for you
  • Is there an API that would let me save a textual item's raw content to a temp file? I'm asking because I need to store to disk before calling an external tool
  • How can we move forward with experimenting with :rewind for snapshots?
8 replies
Luc J. Bourhis
@luc-j-bourhis

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?

Denis Defreyne
@ddfreyne

@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
I think it’ll be difficult to let Nanoc automatically create the stylesheet, especially in a way that’s still easily customisable afterwards.
Luc J. Bourhis
@luc-j-bourhis
@ddfreyne Thanks! Yes, that’s what I had in mind. But thinking about it, I think it’s as easy to simply put the stylesheet into content, let nanoc copy it to output and import it in my own stylesheet.
Luc J. Bourhis
@luc-j-bourhis

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>
...
Luc J. Bourhis
@luc-j-bourhis
I have just opened an issue about that asciidoctor problem: #1568
2 replies
Denis Defreyne
@ddfreyne
By the way, I’ve opened up https://github.com/nanoc/nanoc/discussions so discussions can happen there as well. I think it might be a good alternative to Gitter and/or the mailing list.
Gregory Pakosz
@gpakosz
@ddfreyne About :rewind, do you think you can split the work or give directions so that I can try implementing it?
1 reply
Denis Defreyne
@ddfreyne
@axil_gitlab @axilleas Are you able to help me out with a GitLab issue? I know you tagged me on a GitLab MR (Nanoc related!), but I’ve lost access to GitLab.com and password reset also does not work — email never arrives. GitLab provides no support for free accounts :see_no_evil:
1 reply
Luc J. Bourhis
@luc-j-bourhis
I have a compile rule that applies a filter of mine, then sass to *.sass files. But then I want to have an article.sass importing a base.sass (using @import). The problem is then that article.sass will get the content of base.sass unmodified by my filter. Is there a way around that? The use case is that I used to have only one .sass, with metadata specifying Google Fonts to load, and my filter generated the right @import and defined some sass variable to make it DRY. But now I need to split my .sass to make it more modular.
5 replies
Christian Tietze
@DivineDominion
@ddfreyne "cache" sounds good to me; basically build artifacts that can be reused, so "build" would work for software, but weird for website
1 reply
Denis Defreyne
@ddfreyne
Fancy new search on http://nanoc.app !
Well, not on the homepage. But on the other pages: https://nanoc.app/doc/installation/
Gregory Pakosz
@gpakosz
It seems I'm hitting a new error
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'
5 replies
Gregory Pakosz
@gpakosz
@ddfreyne Hello. Can I change the environment in #preprocess. I know it sounds strange but I'm wondering if I can pick an environment defined in @config based on some introspection code
Gregory Pakosz
@gpakosz
Apparently manipulating ENV works
Christian Tietze
@DivineDominion
Does anyone have a GitHub Actions template for Nanoc?
to make collaboration easier, I want to publish from master via nanoc deploy to our server via rsync
Christian Tietze
@DivineDominion
wasn't that hard after all
I do wonder whether I should hide the user/account name from the deploy command, though, e.g. as a GH Secret. Thoughts? https://github.com/UrbanSketchers-de/urbansketchers.de/blob/main/nanoc.yaml
hmm maybe also change the secret to a deploy key
Tim
@thosgood:matrix.org
[m]
hi! I've been using nanoc for a while, and I love it, but I've had to use blogdown for some other things recently and there's one thing there that I like, but I can't get my Rules file for nanoc to implement the same functionality
rather than having posts for my blog being files like /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

Achilleas Pipinellis
@axil_gitlab
:wave: does anyone know how to run 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.
Christian Tietze
@DivineDominion
@axil_gitlab so you want to serve your real website from nanoc directly?
@thosgood:matrix.org the match is using Regex and you can throw this into https://regexr.com/ with a couple of paths to check the result
image.png
image.png
So maybe this will work:
/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)(\/index)?.md/
Christian Tietze
@DivineDominion
Achilleas Pipinellis
@axil_gitlab
@DivineDominion no, this is for local development. There's an an iframe in one of the pages and it only works with HTTPS, thus the need. I figured out how to do this using reverse proxy with NGINX, and mkcert providing the cert. There's probably an easier way with caddy, but I haven't tested.
Christian Tietze
@DivineDominion
Since I know how reverse proxying with nginx works, I also use that a lot for stuff like this :)