-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple preprocess directives #64
Comments
FWIW, the approach I use to structure the preprocess do
def hide_specials
# …
end
def assign_cachebuster_id
# …
end
def find_backlinks
# …
end
def delete_drafts
@items.delete_if { |i| i[:draft] && i[:draft] != 'soft' }
end
def add_created_at
# …
end
def add_weeknotes_meta
notes = @items.find_all('/notes/*')
notes.select { weeknote?(_1) }.each do |weeknotes|
match = weeknotes[:title].match(/\AWeeknotes (20\d{2}) W(\d{1,2})/)
year, week = Integer(match[1], 10), Integer(match[2], 10)
weeknotes[:year] = year
weeknotes[:week] = week
end
end
delete_drafts
hide_specials
assign_cachebuster_id
find_backlinks
add_created_at
add_weeknotes_meta
end These functions are all top-level ones that don’t take arguments, but I could imagine creating helper functions too. You’d be able to use In the mean time, I’ll move this to the nanoc/features repository, where feature requests are collected. |
Your approach is nice, but I prefer mine as it allows me to keep different top-level functions in different parts of I do not quite understand how Either way, thank you for considering this (obviously non-urgent) feature request. |
While it is possible to have several
route
andcompile
commands, only onepreprocess
command is permitted. That has become a problem for my project which has two distinct parts. Each has a separate section in theRules
file with its own set ofroute
andcompile
commands. However, I cannot achieve a clean separation of the preprocessing steps. The best I have managed isPossible fixes (in order of descending desirability):
preprocess
commands.compiler_dsl.rb
: it should say "another postprocess block overrides the previously SUPPLIED one".Finally, let me express great thanks for the wonderful tool! I have used nanoc for years, and was silent about it only because it has been doing everything I needed so well that I did not need to say anything :-)
The text was updated successfully, but these errors were encountered: