Commit Graph

67 Commits (75f762014bbb2bef19b443e2f6617692efdbda87)

Author SHA1 Message Date
Giuseppe Bilotta 7411d1a6ce tag plugin: encode categories using numeric values
This ensures that RSS/Atom feeds produced are valid XML.
2011-12-24 19:43:16 -04:00
Joey Hess ed360d045a Fix escaping of html entities in tag names.
Example case was a tag with & in its name, which resulted in a malformed
rss feed.
2011-07-29 12:54:30 +02:00
Joey Hess bad5072c02 tag: Avoid autocreating multiple tag pages that vary only in capitalization. The first capitalization seen of a tag will be used for the tag page.
Arguably, the real bug is in the interface to add_autofile, but since
that does take a filename, not a page name, it cannot really do case
handling on its own. The only other users of add_autofile in ikiwiki proper
is autoindex, and it always uses one case. Other third party plugins might
also need to add similar workarounds though.
2011-04-30 16:30:07 -04:00
Simon McVittie 40f85e5c91 tag: default to tag_autocreate_commit=1 as intended 2011-01-07 20:11:38 +00:00
Simon McVittie 2a60cda172 tag: optionally write autocreated tags to the transient underlay
For the moment, have the tag test keep the old behaviour.
2011-01-07 20:09:52 +00:00
Giuseppe Bilotta 5365a72e42 unescape tag names
Since tag names are now retrieved from the file names, we must revert
the escaping process that santizes the file names. Solve by adding a
`pagetitle()` call at the end of the tagname()
(cherry picked from commit 0ee0612b1ab11d76eb3790c8db7a2ba992c54f6b)
2011-01-05 12:06:36 -04:00
Joey Hess 1b1b3927ee fix patch to not strip a leading "." unless it's part of a path
For correctness only, since a tag named ".foo" is very unlikely.
2011-01-04 15:59:28 -04:00
Joey Hess fc6c0e8b5b fix patch to not expose config setting as a regexp 2011-01-04 15:59:00 -04:00
Giuseppe Bilotta a17469e388 tag name sanitation
The use of typed links for tags and some of the consequent changes
introduced some unwanted functionality variations in the tag system. Two
problems in particular could be observed, when compared to the use of
tags in older versions of IkiWiki:

* tags in feeds (both rss and atom) would use the file path as their
  name (e.g. you would have <category term="tags/sometag" /> in an atom
  item for a page tagged sometag with a tagbase of tags), whereas they
  appeared pure before
* tags containing a slash character would appear without the slash
  character but be used with the slash character in other circumstances
  (effect visible by tagging a page with a name such as "with/slash")

Both of these issues are fixed by introducing a tagname() function that
takes a tag link and effectively reverses (as well as possible) the
effects of taglink().

A possible alternative route would have been the reintroduction of the
global %tags hash, but the new approach as the (arguable) benefit of
introducing a small layer of sanitation for tag names.
2011-01-04 15:58:42 -04:00
Joey Hess ecdfd1b864 rcs_commit and rcs_commit_staged api changes
Using named parameters for these is overdue. Passing the session in a
parameter instead of passing username and IP separately will later allow
storing other session info, like username or part of the email.

Note that these functions are not part of the exported API,
and the prototype change will catch (most) skew, so I am not changing
API versions. Any third-party plugins that call them will need updated
though.
2010-06-23 19:04:36 -04:00
Joey Hess d048e9c64a turn on tag_autocreate by default if tagbase is set 2010-04-21 20:39:20 -04:00
Joey Hess 20052f8882 Merge branch 'master' into autotag
Conflicts:
	IkiWiki/Plugin/tag.pm
2010-04-21 20:19:06 -04:00
Joey Hess 129cd00bdb remove broken ./tag support
The commit that added the (working) support for using /tag to override
tagbase also tried to make ./tag work. Problem is, tags are links,
and ./foo is not a valid link (though I think there's a wishlist about it).

So, using ./tag really resulted in tag creation links that led to a
"bad page name" error. And even if the tag were created in the right place,
the link didn't go to it.
2010-04-21 20:15:11 -04:00
Joey Hess 752ccf8b48 fixes 2010-04-21 20:08:23 -04:00
Joey Hess 0e2b5ebe31 clarify 2010-04-21 19:49:11 -04:00
Joey Hess 789e68a8b1 Merge branch 'master' into autotag
Conflicts:
	IkiWiki/Plugin/tag.pm
2010-04-21 19:47:38 -04:00
Joey Hess 77779dc4a0 pass pagespec parameters along from match_tagged 2010-04-21 19:46:27 -04:00
Joey Hess 8cde2365e4 add separate template variable for tag page and sanitize displayed tag name 2010-04-21 19:13:03 -04:00
Joey Hess fd6fb4c507 commit autocreated tag pages 2010-04-21 16:13:37 -04:00
Joey Hess 2fc342b048 fix autotag behavior for relative tags
A tag like ./foo is searched for relative to the tagging page.
However, if multiple pages use such a tag, the only one sure
to be in common is in the root, so autocreate it there to
avoid scattering redunadant autocreated tags around the tree.

(This is probably not ideal.)

Also renamed the tagpage and taglink functions for clarity.
2010-04-17 16:01:41 -04:00
Joey Hess b00d8771cc call gentag for taglinks too 2010-04-17 15:48:00 -04:00
Joey Hess 3651e6263c fix autofile call 2010-04-17 15:43:58 -04:00
Joey Hess adc196a8b5 tag_autocreate fixups
Fix style of prompt.
Optional to rebuild when it is changed. (Needed to get new all missing tags)
2010-04-17 15:41:45 -04:00
Joey Hess b7d50abc0f refactor autofiles
Made add_autofile take a generator function, and just register the
autofile, for later possible creation. The testing is moved into Render,
which allows cleaning up some stuff.
2010-04-17 13:35:15 -04:00
Joey Hess 54f600af14 Merge remote branch 'davrieb/autotag' into autotag
Conflicts:
	IkiWiki.pm
	IkiWiki/Plugin/tag.pm
2010-04-17 12:50:23 -04:00
Simon McVittie ef63441440 Remove tagged_is_strict option, and just behave as though it was enabled
Jon was worried about the backwards-compatibility break involved in making
tagged() not match non-tag links, but Joey seems less concerned about it.
2010-04-04 00:43:58 +01:00
Simon McVittie c1a42e76bc implement typed links; add tagged_is_strict config option 2010-04-04 00:43:48 +01:00
David Riebenbauer 981400177d Make sure deleted tag pages don't get recreated.
The reason to do this is basically a user interaction design decision.

It is achieved by adding an entry, associated to the creating plugin, to
%pagestate. To find out if files were deleted a new global hash %del_hash is
%introduced.
2010-04-03 22:20:48 +02:00
David Riebenbauer a358d74bef Check for existence off srcfile in add_autofile
add_autofile has to have checks, whether to create the file, anyway, so this
will make things more consistent.

Correcter check for the result of verify_src_file().

Cosmetic rename of a variable $addfile to $autofile.
2010-04-03 22:20:48 +02:00
David Riebenbauer 25741100b0 Export add_autofile() for use in Plugins. 2010-02-02 14:04:39 +01:00
David Riebenbauer a8d313aba1 Use add_autofile() in tag.pm
to make the automatically created tagpages render.
2010-02-02 14:04:29 +01:00
David Riebenbauer f35d35abe3 Automatically create tag pages,
if "tag_autocreate=1" is set in the configuration. The pages will be created in
tagbase, if and only if they do not exist in the srcdir yet. Tag pages will be create from
"autotag.tmpl".

At this stage a second refresh is needed for the tag pages to be rendered.

Add autotag.tmpl template.
2010-02-02 14:04:28 +01:00
Joey Hess 2a7721febd Avoid %links accumulating duplicates. (For TOVA)
This is sorta an optimisation, and sorta a bug fix. In one
test case I have available, it can speed a page build up from 3
minutes to 3 seconds.

The root of the problem is that $links{$page} contains arrays of
links, rather than hashes of links. And when a link is found,
it is just pushed onto the array, without checking for dups.

Now, the array is emptied before scanning a page, so there
should not be a lot of opportunity for lots of duplicate links
to pile up in it. But, in some cases, they can, and if there
are hundreds of duplicate links in the array, then scanning it
for matching links, as match_link and some other code does,
becomes much more expensive than it needs to be.

Perhaps the real right fix would be to change the data structure
to a hash. But, the list of links is never accessed like that,
you always want to iterate through it.

I also looked at deduping the list in saveindex, but that does
a lot of unnecessary work, and doesn't completly solve the problem.

So, finally, I decided to add an add_link function that handles deduping,
and make ikiwiki-transition remove the old dup links.
2009-05-06 00:27:24 -04:00
Joey Hess f813b10fef rename tag() to tagged(); add docs 2009-02-19 18:54:25 -05:00
Joey Hess e611d4cdc1 add tag() pagespec
patch from jon
2009-02-19 18:49:30 -05:00
Joey Hess 678d467a40 finalise version 3.00 of the plugin api 2008-12-23 16:34:19 -05:00
Joey Hess bb93fccf06 Coding style change: Remove explcit vim folding markers. 2008-12-17 15:22:16 -05:00
Joey Hess 53752bcb5d remove redundant link munge
This is not needed now that tagpage returns a page name starting with a
slash.

(Also fixes a minor bug that the edit links started with double slashes due
to the hack.)
2008-11-10 21:47:29 -05:00
Joey Hess f8a09ba105 tag: Normalize tagbase so leading/trailing slashes in it don't break things. 2008-11-10 19:48:58 -05:00
Joey Hess a2839de936 tag: When tagpage is set, force the links created by tagging to point at the toplevel tagpage, and not closer subpages.
The html links already went there, but internally the links were not
recorded as absolute, which could cause confusing backlinks etc.

For example, with tagbase=tags, if blog/tags/bar existed and blog/foo was
tagged bar, it would link to /tags/bar. But, the link would be recorded
simply as a link to tags/bar, and so later blog/tags/bar would appear to
have the backlink.
2008-10-20 18:17:03 -04:00
Joey Hess 9ec9d6901d Export pagetitle, titlepage, linkpage. 2008-09-27 14:27:42 -04:00
Joey Hess bce2a34c19 tag: Make edit link for new tags ensure that the tags are created inside tagbase, when it's set. 2008-09-25 20:25:07 -04:00
Joey Hess 3905645342 add plugin safe/rebuild info (part 3 of 3) 2008-08-03 19:36:11 -04:00
Joey Hess 42ac4ec009 remove default values in getsetup
They were a bit confusing, since they did not actually set the default, and
example values are sufficient.
2008-07-26 21:07:15 -04:00
Joey Hess 84c905ec20 finish adding getsetup hooks to plugins 2008-07-26 00:38:13 -04:00
Simon McVittie 09a5cdbb34 Don't prepend tagbase to tags if they start with "./" or "/".
That syntax made little sense previously, and this allows sites to put
"most" of their tags under $tagbase.
2008-07-21 22:02:55 +01:00
joey 2f705d78c9 patch from madduck to fix thinko 2007-09-24 16:41:29 +00:00
joey c1474d795c make taglink support the same method for specifying link text as a regular
wikilink
2007-09-22 17:07:51 +00:00
joey d1999f0357 * Add taglink preprocessor directive, supporting visible tag links.
Closes: #443344
2007-09-20 18:59:27 +00:00
joey 09b0a3b73f * Add rel=tag attribute to tag links, supporting that microformat, as well
as allowing them to be styled specially. Thanks, NicolasLimare.
2007-08-05 20:48:13 +00:00