coleslaw-org / coleslaw

Flexible Lisp Blogware
BSD 2-Clause "Simplified" License
560 stars 82 forks source link

plugin gh-pages can't work well #69

Open ghost opened 9 years ago

ghost commented 9 years ago

SBCL show

Failed to find the TRUENAME of /home/xxxx/blog/.curr

I changed

(defmethod deploy :after (staging)
  (let ((blog (truename (rel-path (deploy-dir *config*) ".curr"))))
    (delete-file (rel-path blog "index.html"))
    (cl-fad:copy-file (rel-path blog "1.html") (rel-path blog "index.html"))
    (with-open-file (out (rel-path blog "CNAME")
                     :direction :output
                     :if-exists :supersede
                     :if-does-not-exist :create)
      (format out "~A~%" *cname*))))

to

(defmethod deploy :after (staging)
  (let ((blog (truename (rel-path (deploy-dir *config*) ""))))
    (delete-file (rel-path blog "index.html"))
    (cl-fad:copy-file (rel-path blog "1.html") (rel-path blog "index.html"))
    (with-open-file (out (rel-path blog "CNAME")
                     :direction :output
                     :if-exists :supersede
                     :if-does-not-exist :create)
      (format out "~A~%" *cname*))))

It can work well now, I don't learn common lisp much and don't understand why. Maybe I do something wrong.

Sorry for my poor English :-(

ghost commented 9 years ago

sorry....

I know, gh-pages should work with versioned.

kingcons commented 9 years ago

@eriFelaP Did you get this working? I'll be in #lisp on Freenode IRC tomorrow morning around 10am EST. I did originally write this plugin to work with the versioned plugin. If not working otherwise is a bug. I'll reopen this and get a fix out in the next few days. Thanks!

ghost commented 9 years ago

Yes,It can work well with versioned plugin. Thank you for your reply very much and sorry I did not reply in a timely manner.

But I find another program. I can't use chinese in title of post because

(defmethod initialize-instance :after ((object post) &key)
  (with-slots (url title author format text) object
    (setf url (compute-url object (slugify title))
          format (make-keyword (string-upcase format))
          text (render-text text format)
          author (or author (author *config*)))))

If the title is all chinese, then (slugify title) will be "".I find the function about Slugs

(defun slug-char-p (char)
  "Determine if CHAR is a valid slug (i.e. URL) character."
  (or (char<= #\0 char #\9)
      (char<= #\a char #\z)
      (char<= #\A char #\Z)
      (member char '(#\_ #\-))))

(defun slugify (string)
  "Return a version of STRING suitable for use as a URL."
  (remove-if-not #'slug-char-p (substitute #\- #\Space string)))

All chinese will be remove in title.

ghost commented 9 years ago

oh,you have know that.

https://github.com/redline6561/coleslaw/issues/36

I was too careless hasty. :-(

kingcons commented 9 years ago

No, thank you for mentioning it. I've been aware of this issue but I think you are the first user to hit it in a real installation.

It seems like next steps are to add a dependency on cl-unicode and start updating the slug handling. I'll try to work on this in the next week or so but I'm also starting a new job so I'll be busy. Sorry for the delay.

sternenseemann commented 9 years ago

@redline6561 If you give me some hints I could try to implement correct unicode handling in slugify.

PuercoPop commented 9 years ago

@lukasepple I can't speak for @redline6561 but IIUC it means making slugify IRI (See RFC 3987) aware. Stuff I am not clear about is should all IRI's be normalized? if so according to which algorithm. From section 6 of the RFC 3987 I got to RFC 3491 which suggests prohibiting characters in some tables and applying kc normalization.

Hope the info is of some use, although I'm not clear if that would be enough or correct though, I can live without the ñ :D

kingcons commented 9 years ago

Hey ya'll. Sorry I'm late to the thread. I'm happy for you to take point on this since I'm busy with other stuff, @lukasepple. As usual, @PuercoPop has some good suggestions. :)

We need to support genuine IRIs. International users shouldn't have to deal with an ASCII only slug system. I trust you all to do a better job testing this than me, quite frankly. :)

Two interesting links from a little digging:

ghost commented 9 years ago

Oh, I find versioned and gh-pages have some warning today.It can work but have some warning.

When I juist use versioned without gh-pages, SBCL show:

STYLE-WARNING:
   redefining COLESLAW:DEPLOY (#<SB-PCL:SYSTEM-CLASS T>) in DEFMETHOD

When I use gh-pages with versioned, SBCL show:

STYLE-WARNING:
   redefining COLESLAW:DEPLOY (#<SB-PCL:SYSTEM-CLASS T>) in DEFMETHOD
To load "puri":
  Load 1 ASDF system:
    puri
; Loading "puri"

; file: /home/qwfwq/quicklisp/dists/quicklisp/software/coleslaw-20141106-git/plugins/gh-pages.lisp
; in: DEFUN ENABLE
;     (ERROR "Not a valid CNAME: ~A" COLESLAW-GH-PAGES::CNAME)
; ==>
;   "Not a valid CNAME: ~A"
; 
; note: deleting unreachable code

My .coleslawrc is

(:author "Brit Butler"
 :deploy-dir "/home/qwfwq/blog/www/"
 :domain "http://localhost:8080"
 :feeds ("lisp")
 :plugins (
           ; (incremental)  ;; *Remove comment to enable incremental builds.
           (mathjax)
           (sitemap)
           (static-pages)
           (versioned)    ;; *Remove comment to enable symlinked, timestamped deploys.
           (gh-pages :cname t)
          )
 :routing ((:post           "posts/~a")
           (:tag-index      "tag/~a")
           (:month-index    "date/~a")
           (:numeric-index  "~d")
           (:feed           "~a.xml")
           (:tag-feed       "tag/~a.xml"))
 :sitenav ((:url "http://localhost:8080" :name "Home"))
 :staging-dir "/tmp/coleslaw/"
 :title "Qwfwq"
 :theme "readable")

;; * Prerequisites described in plugin docs.

I use the latest version git clone from github. And I can find the new post and cname in deploy-dir/.curr(Everything is right in .curr) but I can't find the new post in deploy-dir/post.

sternenseemann commented 9 years ago

I use the latest version git clone from github.

Did you install it with ql:quickload? If yes try git cloning it into ~/quicklisp/local-projects

ghost commented 9 years ago

@lukasepple I replace all files in quicklisp/dists/quicklisp/software/coleslaw-20141106-git with files git clone from github.

sternenseemann commented 9 years ago

I think it's better to clone it into a directory in ~/quicklisp/local-projects then always the fresh clone will be loaded. You're solution might work but this is the way quicklisp suggests it :)

Am 09.12.2014 um 07:04 schrieb PaleFire notifications@github.com:

@lukasepple I replace all files in quicklisp/dists/quicklisp/software/coleslaw-20141106-git with files git clone from github.

— Reply to this email directly or view it on GitHub.

ghost commented 9 years ago

@lukasepple Thanks for your suggestion :-)

sternenseemann commented 9 years ago

@eriFelaP Does it work now?

ghost commented 9 years ago

It still doesn't work. I rm quicklisp/dists/quicklisp/software/coleslaw and git clone coleslaw into ~/quicklisp/local-projects. @lukasepple

sternenseemann commented 9 years ago

ok, then it wasn't caused by an outdated version. Just keep it like that. Then there's some other problem :/=

douglarek commented 9 years ago

@eriFelaP I got gh-pages warnings too. Would you like to have a look ? @redline6561

Thanks