summaryrefslogtreecommitdiff
path: root/doc/todo/using_meta_titles_for_parentlinks.html
blob: dad1314be8d4cdb3b3c6e00b33783ba429ddcf74 (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,323 ----
  76. }
  77. } #}}}
  78. + sub IkiWiki::pagetitle ($;$) { #{{{
  79. + my $page=shift;
  80. + my $unescaped=shift;
  81. +
  82. + print "debug1: $page\n";
  83. +
  84. + if ($page =~ m#/#) {
  85. + $page =~ s#^/##;
  86. + $page =~ s#/index$##;
  87. + if ($pagestate{"$page/index"}{meta}{title}) {
  88. + $page = $pagestate{"$page/index"}{meta}{title};
  89. + } else {
  90. + $page = IkiWiki::basename($page);
  91. + }
  92. + }
  93. +
  94. + if ($unescaped) {
  95. + $page=~s/(__(\d+)__|_)/$1 eq '_' ? ' ' : chr($2)/eg;
  96. + }
  97. + else {
  98. + $page=~s/(__(\d+)__|_)/$1 eq '_' ? ' ' : "&#$2;"/eg;
  99. + }
  100. +
  101. + print "debug2: $page\n";
  102. +
  103. + return $page;
  104. + } #}}}
  105. +
  106. package IkiWiki::PageSpec;
  107. sub match_title ($$;@) { #{{{
  108. </pre>