diff options
author | Sean Allred <code@seanallred.com> | 2015-02-14 18:31:38 -0600 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2015-02-14 18:31:38 -0600 |
commit | ca121c0c65e0e689af2ee859fdd8ebea8bc44bc5 (patch) | |
tree | 426f0ce4865a23853a51b285d26c67d1474d1f3a /sx-tag.el | |
parent | 2e9fb5633907afdd6218e36a6be5412e87dcee2c (diff) | |
parent | 3b0008b6fc32548905510cf86ab5651e529b84ee (diff) |
Merge pull request #261 from vermiculus/meta-tags
Meta tags
Diffstat (limited to 'sx-tag.el')
-rw-r--r-- | sx-tag.el | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -142,19 +142,35 @@ tags." ;;; Printing -(defun sx-tag--format (tag) - "Format and return TAG for display." +(defun sx-tag--format (tag &optional meta) + "Format and return TAG for display. +If META is non-nil, the tag is for the meta site." (with-temp-buffer - (sx-tag--insert tag) + (sx-tag--insert tag meta) (buffer-string))) -(defun sx-tag--insert (tag) - "Insert TAG button." +(defun sx-tag--insert (tag &optional meta) + "Insert TAG button. +If META is non-nil, the tag is for the meta site." (insert-text-button (concat "[" tag "]") 'sx-button-copy tag 'sx-tag tag + 'sx-tag-meta meta :type 'sx-button-tag)) +(defun sx-tag--format-tags (tags &optional site) + "Format and concatenate a sequence of TAGS. +Returns a string of all tags in TAGS, separated by a space. + +SITE is the site to which the tags refer, it is only used to +decide whether they are main or meta tags. SITE can also be t or +nil, which respectively indicate meta and main." + (let ((is-meta + (if (stringp site) (string-match (rx string-start "meta.") site) + site))) + (mapconcat (lambda (tag) (sx-tag--format tag is-meta)) + tags " "))) + (provide 'sx-tag) ;;; sx-tag.el ends here |