summaryrefslogtreecommitdiff
path: root/doc/todo/using_meta_titles_for_parentlinks.html
blob: 2252c81a47abf07d6e2e4b493d9e9355b4a0a30b (plain)
  1. It is possible to set a Page-Title in the meta-plugin, but that one isn't
  2. reused in parentlinks. This patch may fix it.
  3. **This patch may introduce some bugs, i need to investigate**
  4. <ul>
  5. <li> I give pagetitle the full path to a page.
  6. <li> I redefine the 'pagetitle'-sub to deal with it.
  7. <li> to maintain compatibility for IkiWikis without the meta-plugin, i added a 'basename' to the Original-pagetitle.
  8. </ul>
  9. <pre>
  10. diff -c /usr/share/perl5/IkiWiki/Render.pm.distrib /usr/share/perl5/IkiWiki/Render.pm
  11. *** /usr/share/perl5/IkiWiki/Render.pm.distrib Wed Aug 6 07:34:55 2008
  12. --- /usr/share/perl5/IkiWiki/Render.pm Tue Aug 26 23:29:32 2008
  13. ***************
  14. *** 102,108 ****
  15. $template->param(
  16. title => $page eq 'index'
  17. ? $config{wikiname}
  18. ! : pagetitle(basename($page)),
  19. wikiname => $config{wikiname},
  20. content => $content,
  21. backlinks => $backlinks,
  22. --- 102,108 ----
  23. $template->param(
  24. title => $page eq 'index'
  25. ? $config{wikiname}
  26. ! : pagetitle($page),
  27. wikiname => $config{wikiname},
  28. content => $content,
  29. backlinks => $backlinks,
  30. diff -c /usr/share/perl5/IkiWiki/Plugin/parentlinks.pm.distrib /usr/share/perl5/IkiWiki/Plugin/parentlinks.pm
  31. *** /usr/share/perl5/IkiWiki/Plugin/parentlinks.pm.distrib Wed Aug 6 07:34:55 2008
  32. --- /usr/share/perl5/IkiWiki/Plugin/parentlinks.pm Tue Aug 26 23:19:43 2008
  33. ***************
  34. *** 44,50 ****
  35. "height_$height" => 1,
  36. };
  37. $path.="/".$dir;
  38. ! $title=IkiWiki::pagetitle($dir);
  39. $i++;
  40. }
  41. return @ret;
  42. --- 44,50 ----
  43. "height_$height" => 1,
  44. };
  45. $path.="/".$dir;
  46. ! $title=IkiWiki::pagetitle($path);
  47. $i++;
  48. }
  49. return @ret;
  50. diff -c /usr/share/perl5/IkiWiki.pm.distrib /usr/share/perl5/IkiWiki.pm
  51. *** /usr/share/perl5/IkiWiki.pm.distrib Wed Aug 6 07:48:34 2008
  52. --- /usr/share/perl5/IkiWiki.pm Tue Aug 26 23:47:30 2008
  53. ***************
  54. *** 792,797 ****
  55. --- 792,799 ----
  56. my $page=shift;
  57. my $unescaped=shift;
  58. + $page=basename($page);
  59. +
  60. if ($unescaped) {
  61. $page=~s/(__(\d+)__|_)/$1 eq '_' ? ' ' : chr($2)/eg;
  62. }
  63. diff -c /usr/share/perl5/IkiWiki/Plugin/meta.pm.distrib /usr/share/perl5/IkiWiki/Plugin/meta.pm
  64. *** /usr/share/perl5/IkiWiki/Plugin/meta.pm.distrib Wed Aug 6 07:34:55 2008
  65. --- /usr/share/perl5/IkiWiki/Plugin/meta.pm Tue Aug 26 23:30:58 2008
  66. ***************
  67. *** 3,8 ****
  68. --- 3,9 ----
  69. package IkiWiki::Plugin::meta;
  70. use warnings;
  71. + no warnings 'redefine';
  72. use strict;
  73. use IkiWiki 2.00;
  74. ***************
  75. *** 289,294 ****
  76. --- 290,319 ----
  77. }
  78. } #}}}
  79. + sub IkiWiki::pagetitle ($;$) { #{{{
  80. + my $page=shift;
  81. + my $unescaped=shift;
  82. +
  83. + if ($page =~ m#/#) {
  84. + $page =~ s#^/##;
  85. + $page =~ s#/index$##;
  86. + if ($pagestate{"$page/index"}{meta}{title}) {
  87. + $page = $pagestate{"$page/index"}{meta}{title};
  88. + } else {
  89. + $page = IkiWiki::basename($page);
  90. + }
  91. + }
  92. +
  93. + if ($unescaped) {
  94. + $page=~s/(__(\d+)__|_)/$1 eq '_' ? ' ' : chr($2)/eg;
  95. + }
  96. + else {
  97. + $page=~s/(__(\d+)__|_)/$1 eq '_' ? ' ' : "&#$2;"/eg;
  98. + }
  99. +
  100. + return $page;
  101. + } #}}}
  102. +
  103. package IkiWiki::PageSpec;
  104. sub match_title ($$;@) { #{{{
  105. </pre>