renard / o-blog

Standalone orgmode blog exporter. DEPECATED, NOT MAINTAINED
http://renard.github.com/o-blog-v2
260 stars 58 forks source link

Static Glyphicons #71

Closed drewc closed 11 years ago

drewc commented 11 years ago

So, I like o-blog quite a bit, and have decided to use it for http://alpha.common-lisp.net/ ... but I did not want to use the .less and the .js, so changed the template(s) to something like :

<lisp>
          (drewc.org:replace-<i>-icons
           (replace-regexp-in-string (rx "<ul>")
            "<ul class=\"nav\">"
            (ob:post-content-html (ob:get-snippet "Navigation"))))
</lisp>

And here is the code. It is not-so-great, but works fine :)

(defun drewc.org:replace-<i>-icons (string)
  (let* ((re-icon (rx
                   "\<i\>"
                   (submatch
                    (and "icon-"
                         (one-or-more (or alphabetic (any "  -")))))
                   "\</i\>"))
         (match (string-match re-icon string))
         (all (drewc.org:match-strings-all string))
         (class (second (and match all )))
         (future (and match (substring string (+ 1 match))))
         (next (when future (string-match re-icon future)))
         (string-to-replace (if next
                                (substring string 0 (+ match (length (first all))))
                              string))

         (next-string (if next
                          (substring string (length string-to-replace))
                        "")))
    (if class
        (concatenate
         'string
         (replace-regexp-in-string
          re-icon
          (concatenate 'string "<i class=\"" class "\"></i>")
          string-to-replace)
         (if next (drewc.org:replace-<i>-icons next-string) "")
         )
      string-to-replace)))

Let me know if that can be included or what has to be done to make it so.

-- drewc

renard commented 11 years ago

This has ben setup in dd76aa1 which is a new o-blog exporter.

Anyway this could be easily setup for o-blog-v1.

Let me know if you need help for that.