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