Skip to content
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

adding additional configurable options #44

Merged
merged 2 commits into from Mar 22, 2014
Merged

Conversation

@tychoish
Copy link
Contributor

tychoish commented Mar 2, 2014

  • default site author, override-able on a per-post basis
  • made the config separator in the post format configurable on a per-site basis
  • changed the file migrations to use rsync rather than cp.
  • make the build check in the local directory for a config file before falling back to the user-wide config file.
  • made "posts" directory configurable
  • made output extension configurable, including theoretical support for having extension-less paths (though this requires some corresponding web server configuration)
@tychoish

This comment has been minimized.

Copy link
Contributor Author

tychoish commented Mar 2, 2014

I believe that these changes are not backward breaking, but I don't have a good way of testing them, so am certainly willing to make changes.

Sorry to bundle so much up in one commit. I'm working on migrating a huge site and am trying to get coleslaw up to feature parity, so the hacking isn't very disciplined.

(setf (content-slug object) (slugify title)
format (make-keyword (string-upcase format))
text (render-content text format)
author (if author

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

I would prefer (or author (author *config*)) here. I'm also not sure whether I'd prefer the author slot to be on the POST or CONTENT class but I'm okay to leave it on POST for now.

@@ -51,10 +51,10 @@
(read-tags (str)
(mapcar #'make-tag (cl-ppcre:split "," str))))
(with-open-file (in file)
(unless (string= (read-line in) ";;;;;")
(unless (string= (read-line in) (separator *config*))

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

This is a nice idea. I'm not sure why I didn't think of it earlier. :)

(staging-dir :initarg :staging-dir :accessor staging-dir)
(postsdir :initarg :postsdir :accessor postsdir :initform "posts")
(separator :initarg :separator :accessor separator :initform ";;;;;")
(pageext :initarg :pageext :accessor pageext :initform ".html")

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

I'd prefer content-dir instead of postsdir and page-ext to pageext. It would also be nice if the alphabetical order was maintained.

This comment has been minimized.

Copy link
@tychoish

tychoish Mar 7, 2014

Author Contributor

I believe I chose the unhyphenated names so that I could use them in the templates, which seemed to produce some error at my attempt, but perhaps I was doing something wrong: is this consistent with your expectation of how the templating environment works

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

IIRC, you have to camel case the names for the lookup to occur correctly. So, e.g. postsDir or pageExt.

This comment has been minimized.

Copy link
@tychoish

tychoish Mar 7, 2014

Author Contributor

Are we ok with camel casing for this purpose? Just the accessors? Is there some way to add camel case aliases that I'm not aware of?

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

I'm sorry, I wasn't clear enough. In the template, you should refer to the names camel-cased. They should stay hyphenated on the lisp side.

@tychoish

This comment has been minimized.

Copy link
Contributor Author

tychoish commented Mar 7, 2014

I have one question: It might be a little while before I have time to make these changes, but I'll try to get to this soon.

@@ -46,8 +52,6 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."

(defun compile-blog (staging)
"Compile the blog to a STAGING directory as specified in .coleslawrc."
(when (probe-file staging)

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

Why is this change present?

This comment has been minimized.

Copy link
@tychoish

tychoish Mar 7, 2014

Author Contributor

the --delete flag to rsync should achieve the same result.

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

Ah, okay. Thanks. Depending on rsync is probably okay. Hard to imagine someone running a server without it installed.

This comment has been minimized.

Copy link
@tychoish

tychoish Mar 22, 2014

Author Contributor

indeed. rsync is also much faster for multi-file operations

@@ -16,10 +16,16 @@
(:documentation "The url to the object, without the domain."))

(defmethod page-url :around ((object t))
(let ((result (call-next-method)))
(let ((result (call-next-method))
(extension (if (string-equal (pageext *config*) "/")

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

I'm confused by this change and see no reason why we wouldn't just use the page-ext from the config. The extension clause in the let and the corresponding when can be removed and extension in the call to make-pathname just becomes (page-ext *config*). Is there any reason that is insufficient?

This comment has been minimized.

Copy link
@tychoish

tychoish Mar 22, 2014

Author Contributor

reverted. this change.

This comment has been minimized.

Copy link
@tychoish

tychoish Mar 22, 2014

Author Contributor

revision: reverted the when form, but left a revision to this statement.

This might be kind of hacky, but, if you specify a page-ext of /, then the template thinks that everything ends in a slash, and coleslaw just puts an .html extension. Then you can tell your web server to drop the extensions seamlessly, and everything works perfectly. The old behavior is preserved, and with one if form (and some web server config) ayou can get pretty urls with minimal change.

@@ -55,7 +59,7 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."
(app-path "themes/~a/js" (theme *config*))
(merge-pathnames "static" (repo *config*))))
(when (probe-file dir)
(run-program "cp -R ~a ." dir)))
(run-program "rsync --delete -raz ~a ." dir)))

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

Why is rsync preferable here? If we're going this route, we should note that we depend on rsync in the README.

((file-exists-p custom-path) custom-path)
((file-exists-p default-path) default-path))))

(defun load-config (config-key)

This comment has been minimized.

Copy link
@kingcons

kingcons Mar 7, 2014

Collaborator

I like this feature but discover-config-path should have a docstring. I would also prefer we use rel-path in the let clauses, e.g. (rel-path (user-homedir-pathname) ".coleslawrc") and a simple if conditional to check for the custom-path with the default as the else case.

@tychoish

This comment has been minimized.

Copy link
Contributor Author

tychoish commented Mar 22, 2014

@redline6561, I updated the pull request with your suggestion, modulo one point, which I continued to discuss in the comments. Hope this is useful, of course.

@kingcons

This comment has been minimized.

Copy link
Collaborator

kingcons commented Mar 22, 2014

This looks good. Thanks for your work and your patience shepherding these changes through. :)

kingcons added a commit that referenced this pull request Mar 22, 2014
adding additional configurable options
@kingcons kingcons merged commit 5a32bb1 into coleslaw-org:master Mar 22, 2014
@kingcons

This comment has been minimized.

Copy link
Collaborator

kingcons commented on 795ddf5 Mar 23, 2014

By the way, would be interested to know what site you revamped to use coleslaw if you don't mind sharing. Thanks again!

This comment has been minimized.

Copy link
Contributor Author

tychoish replied Mar 23, 2014

I actually haven't started porting the site over, but that's the next project ;) The good news is that everything that I really require is covered by these changes, and I really like the design and implementation of coleslaw. I'm thinking about working on a few other bits of things, the main one right now is a more natural workflow for rendering pages locally and then uploading the artifacts to a web-server, but would like to coordinate any additional work with you just so I make sure I'm not doing crazy things/etc.

My thought is to revamp tychoish.com (or a part thereof) to use coleslaw, but while I've used static site generators of one flavor or another for 5-6 years, the site is so damn big (1700 posts, 8.5 megs of posts) that build performance is typically a major impediment to getting this working for me, so we'll see once I migrate the content over... I've been thinking about looking into (optionally?) rendering the site in parallel, or figuring out some way to do incremental builds. Your thoughts and feedback on these sorts of things would be quite useful/instructive.

Cheers,
sam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.