Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 23 11:59
    axilleas edited #1445
  • Aug 17 11:50
    ddfreyne commented #1451
  • Aug 17 11:42

    ddfreyne on master

    Document “all” configuration fo… (compare)

  • Aug 17 11:38

    ddfreyne on master

    Upgrade gems Upgrade Nanoc (compare)

  • Aug 17 11:37

    ddfreyne on 4.11.9

    (compare)

  • Aug 17 11:36

    ddfreyne on nanoc-core-v4.11.9

    (compare)

  • Aug 17 11:25

    ddfreyne on master

    Set version to 4.11.9 (compare)

  • Aug 17 11:16

    ddfreyne on master

    Revert "Refactor: Add complete … (compare)

  • Aug 17 10:56

    ddfreyne on master

    Refactor: Move re-exports into … Refactor: Add complete contract… (compare)

  • Aug 17 10:45

    ddfreyne on master

    Refactor: Move OutdatednessStor… (compare)

  • Aug 17 10:39

    ddfreyne on master

    Refactor: Move DependencyTracke… (compare)

  • Aug 17 10:33

    ddfreyne on master

    Add spec for ActionSequenceStore Refactor: Move PrefixedDataSour… (compare)

  • Aug 17 10:18

    ddfreyne on master

    Verify that all Core files have… (compare)

  • Aug 17 10:13

    ddfreyne on master

    Refactor: Fix name of in_mem_da… Refactor: Split pattern_spec.rb… Refactor: Move CompiledContentS… (compare)

  • Aug 17 09:54

    ddfreyne on master

    Fix broken refactoring Constan… (compare)

  • Aug 17 09:51

    ddfreyne on master

    Refactor: Move DependencyStore … (compare)

  • Aug 17 08:43

    ddfreyne on master

    Refactor: Move CompiledContentS… (compare)

  • Aug 17 08:39

    ddfreyne on master

    Refactor: Move some errors to c… (compare)

  • Aug 17 08:15
    ddfreyne commented #1451
  • Aug 17 08:14
    ddfreyne edited #1449
Denis Defreyne
@ddfreyne
That’s how you get the attributes of an item
giodestone
@giodestone
that's fixed it, thanks :D and I'm glad I found a bug
thanks for your help! @ddfreyne
If you don't mind me asking, how does game.title and game[:title] differ? is it something to do with hash tables? (Still new to ruby)
Denis Defreyne
@ddfreyne
game.title would call the method title on the game object. There is no such method, so you get an exception. (But there are lots of other methods that do exist)
game is not a hashtable (or a hash as Ruby calls it, or a dictionary/map). It’s its own type that is defined by Nanoc
The game object implements the [] method
game[:title] is sort of a shorthand for calling the [] method with the :title argument on game… so, kind of like game.[](:title) in a way. (Weird to think of it that way)
giodestone
@giodestone
so its not like C++ where you can access variables by doing game.somevariable? which is the same syntax as accessing game.somemethod()?
Denis Defreyne
@ddfreyne
Correct
class Moo
  def [](key)
    puts "you requested #{key}"
    123
  end

  def []=(key, value)
    puts "setting #{key} to #{value}"
  end
end

moo = Moo.new

moo['bloop']
# outputs: you requested bloop
# returns: 123

moo['beep'] = 'bap'
# outputs: setting beep to bap
You can build your own array-like or hashmap-like classes like this :arrow_up:
I created a bug ticket btw: nanoc/nanoc#1446
Will fix it soon
giodestone
@giodestone
oh alright, so it sounds like def [](key) is a bit like having an std::unordered_map object inside of the class Moo in C++ (if i recall the name of the data structure correctly)
yay :D if you need access to the whole website to help you in diagnosing i can (finally) upload it to github and give you access (as its definately not ready to see the world yet)
Denis Defreyne
@ddfreyne
I have the steps to reproduce and can fix it!
giodestone
@giodestone
ok :)
Denis Defreyne
@ddfreyne
Time for me to get some rest… I’m not an evening person and it’s getting late!
giodestone
@giodestone
alright, cheers for the help, have a nice night!
Gregory Pakosz
@gpakosz
@ddfreyne I'm trying to use rspec with pry on nanoc specs
@ddfreyne do you know how I can make everything stop while I inspect things? right now it just messes the terminal :(
Denis Defreyne
@ddfreyne
Hmmm… that should work out of the box, but I have not tried it out myself yet
Daniel Aleksandersen
@da2x
Does anyone have a good working solution for finding related items? The approach I’ve seen used looks up items using the same tags. This approach didn’t really produce good results for me. I was hoping to find something using linking relations, or maybe LSI instead? I thought about porting https://github.com/alfanick/jekyll-related-posts/blob/55768e828c747de31ef77e88475060d1878f8e37/lib/jekyll-related-posts.rb to Nanoc but initial testing suggests it will be reaaally slow.
Gregory Pakosz
@gpakosz
@ddfreyne hello I have a question for you: I'm still toying with source maps. Let's say sass filter. Imagine my render() function always compute both the output .css file and the output .map file. Yet for "API" purposes and to fit the concept of reps I have 2 filters: sass and sass_sourcemap. Now I want to cache and make either of the two filters take back what's cached by the other one. What should the key be? pair of item's identifier and checksum? If not, what else?
Denis Defreyne
@ddfreyne
@da2x I don’t have a suggestion, but my approach would be an external script that reads stuff from content/ and outputs its data somewhere in content/ as well, so that Nanoc can pick it up and do something with it
There are some LSI tools out there but I have not used the Ruby ones
@gpakosz Hmm, I assume you mean caching in memory, i.e. inside the same nanoc process, yeah? You could cache by item identifier (checksum is not needed)
But you’d still have to call item.compiled_content, as mention before, to make sure the dependnecies are working as intended
Denis Defreyne
@ddfreyne
@giodestone The bug you discovered (nanoc/nanoc#1446) is fixed in master, but there’ll be a proper Nanoc release with the fix soon!
Gregory Pakosz
@gpakosz
@ddfreyne yep it's in memory, but compiled_content here is what the filter produces, not something to depend on
Denis Defreyne
@ddfreyne
@gpakosz Ah right — I think you can cache based on the input content (coming in to the filter) as the key
Nanoc 4.11.8 is out!
Daniel Aleksandersen
@da2x
With the fs datastore, why can’t I store attributes in both file.yaml and in the metadata section of the file.md?
giodestone
@giodestone
yay :D
Denis Defreyne
@ddfreyne
@da2x I think it hasn't come up before as something that'd be useful
@da2x it’s either-or at the moment. Do you have a use case for having attributes in two locations?
Daniel Aleksandersen
@da2x
@ddfreyne I made a related item thingy that produced content/item.yaml file containing the recommendations. (I store all the manual metadata in the main file.) Thought that was a nice way to do it. Ended up pulling in the data and merging it in the pre-processor instead.
Daniel Aleksandersen
@da2x
I started working from the Jekyll related post plugin, but it was incredibly slow going. It uses the ClassifierReborn gem and that thing is reeeaaaly slow. Made a small thing in R with the LSA and LSAfun libraries and it processes 500 ~1500-word documents in seconds rather than six hours. Outputs a list of related items to a CSV file, and I then process that file in the Nanoc pre-processor and set them attributes for items (e.g. related_items: [a.md, b.md]) and pull them in my layout like so: @items.find_all(@item[:related_items]).
@ddfreyne so what I did before was the above but output related_items: [a.md, b.md] in c.yaml instead of doing it in the pre-processor. It’s a corner case for sure, but I also expected it to just work. The .yaml file took precedence over the in-file meta data which was just silently dropped.
Denis Defreyne
@ddfreyne
@da2x Ahh, that is a good use case
@da2x You could try to use https://github.com/bobthecow/forematter — it’s not super-maintained, but I think it might fit your use case
Gregory Pakosz
@gpakosz
too bad Justin (@bobthecow) seems to use Nanoc less these days
Gregory Pakosz
@gpakosz
@ddfreyne I wonder if I'm the one who introduced #1451. Or at least my refactor revealed it. It's a bit hard to read the history since files moved around in the repo though
@ddfreyne In any case I'm sorry!
Denis Defreyne
@ddfreyne
@gpakosz No worries. That was hard to spot even for me!
Daniel Aleksandersen
@da2x
Hold off on updating the logger gem this morning.
ruby/logger#38
Danny Aziz
@DannyAziz
Hey everyone, I'm trying to place a meta image tag into my layouts. The url for the image changes depending on some variables and I'm having some trouble URL encoding the string. Has anyone dealt with this before?
Denis Defreyne
@ddfreyne

@DannyAziz

For URL-encoding, stick require "uri" somewhere in your lib/ dir, and then use URI.encode(my_string), e.g.

<img
  src="<%= URI.encode(@item[:logo]) %>"
  alt="The logo"
>
Let me know if that works
Daniel Aleksandersen
@da2x
Can I read the item rep name variable in rule blocks?