what does mean this?

Documentation is as important as the rest of the code, so if something is unclear, missing or just plain wrong, please tell it.
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

what does mean this?

Postby Hiro » Sun Oct 10, 2004 12:28 pm

can someone translate in english what does mean this?

Code: Select all

<?php
/*
NP_FootNote
はてなダイアリーなどで使用される脚注
を作成するプラグイン。
本文中に(())で囲まれたフレーズがあã
‚‹ã¨ã€è„šæ³¨ã¨ã—て表示します。
もとのデータ自体は変更せず、パースす
る際に変換しています。

変更履歴
0.3:æ³¨é‡ˆãŒãªã„è¨˜äº‹ã«ã‚‚ç„¡é§„ãªã‚³ãƒ¼ãƒ‰ã‚’è¿½åŠ ã—ã¦ã„ãŸãƒã‚°ä¿®æ­£ã€‚
0.2:æ‹¡å¼µé ˜åŸŸã«å…¥åŠ›ãŒãªã„å ´åˆç„¡é§„ãªã‚³ãƒ¼ãƒ‰ã‚’è¿½åŠ ã—ã¦ã„ãŸãƒã‚°ä¿®æ­£ã€‚
0.1+:本文と拡張文とで注解を分けるæ
Œ‡å®šã‚’ã‚ªãƒ—ã‚·ãƒ§ãƒ³ã«è¿½åŠ ã€‚
0.1:本文注の部分に入ったAタグのtitle
属性から不要な文字を削除するようにした。またこのé
ƒ¨åˆ†ã®è¡¨ç¤º/éžè¡¨ç¤ºã‚’åˆ‡ã‚Šæ›¿ãˆã‚‹ã‚ªãƒ—ã‚·ãƒ§ãƒ³ã‚’è¿½åŠ ã€‚
0.06:同じ行に(())があると一つの注として
まとめられるバグを修正。注内部での改è
¡Œã‚’サポート。
0.05ï¼šæ‹¡å¼µé ˜åŸŸã®ã¿ã«æ³¨ãŒã‚ã‚‹å ´åˆã«æ³¨ãŒè¡¨ç¤ºã•ã‚Œãªã„ãƒã‚°ã‚’ä¿®æ­£ã€‚
0.04ï¼šæ‹¡å¼µé ˜åŸŸã¸ã®æ³¨ã«å¯¾å¿œã€‚æ³¨ãŒã‚ã‚‹å ´åˆã«ã¯æ‹¡å¼µé ˜åŸŸã«æ³¨ã‚’è¡¨ç¤ºã™ã‚‹ã‚ˆã†ã«ã—ãŸã€‚
0.03:とりあえず版リリース。

*/
class NP_FootNote extends NucleusPlugin {

    function getName() {
        return 'Foot Note Plugin.'; 
    }
    function getAuthor()  { 
        return 'charlie + nakahara21'; 
    }
    function getURL() 
    {
        return 'http://xx.nakahara21.net/'; 
    }
    function getVersion() {
        return '0.3'; 
    }
    function getDescription() { 
        return 'はてな、Wikiで使用される脚注を生成するプ
ラグインです。本文中に((と))で囲まれたフãƒ
¬ãƒ¼ã‚ºãŒã‚ると、脚注として表示します。';
    }
   function supportsFeature($what) {
      switch($what){
         case 'SqlTablePrefix':
            return 1;
         default:
            return 0;
      }
   }


   function install() {
      $this->createOption('CreateTitle','本文注のリンク
にTitleå±žæ€§ã‚’ä»˜åŠ ã—ã¾ã™ã‹ï¼Ÿ','yesno','yes');
      $this->createOption('Split','本文と拡張文で注
解を分けますか?(アイテムページは常にまとめて最下部になります)','yesno','no');
   }

   function getEventList() {
      return array('PreItem','PreSkinParse');
   }

   function event_PreSkinParse($data) {
      $this->type = $data['type'];
   }

   function event_PreItem($data) {
      global $i, $id, $notelist;
      $this->currentItem = &$data["item"];
      $i =0;
      $notelist = array();
      $id = $this->currentItem->itemid;
      $this->currentItem->body = preg_replace_callback("/\(\((.*)\)\)/Us", array(&$this, 'footnote'), $this->currentItem->body);
      if($this->getOption('Split') == 'yes' && $this->type != 'item'){
         if($footnote = @join('',$notelist))
            $this->currentItem->body .= '<ul class="footnote">' . $footnote . '</ul>';
         $notelist = array();
      }
      if($this->currentItem->more){
         $this->currentItem->more = preg_replace_callback("/\(\((.*)\)\)/Us", array(&$this, 'footnote'), $this->currentItem->more);
         if($footnote = @join('',$notelist))
            $this->currentItem->more .= '<ul class="footnote">' . $footnote . '</ul>';
      }elseif($footnote = @join('',$notelist)){
         $this->currentItem->body .= '<ul class="footnote">' . $footnote . '</ul>';
      }
   }

   function footnote($matches){
      global $i, $id, $notelist;
      $i++;
      if($this->getOption('CreateTitle') == 'yes'){
         $fnote2 = htmlspecialchars(strip_tags($matches[1]));
         $fnote2 = preg_replace('/\r\n/s','',$fnote2);
         $fnote2 = ' title="'.$fnote2.'"';
      }else{
         $fnote2 = '';
      }
      $note = '<span class="footnote"><a href="#'.$id.'-'.$i.'"'.$fnote2.'>*'.$i.'</a><a name="'.$id.'-'.$i.'f"></a></span>';
      $notelist[] = '<a name="'.$id.'-'.$i.'"></a>'.'<li><a href="#'.$id.'-'.$i.'f">注'.$i.'</a>'.$matches[1].'</li>';
      return $note;
   
   }
}
?>
Last edited by Hiro on Sun Oct 10, 2004 3:32 pm, edited 1 time in total.
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Sun Oct 10, 2004 3:04 pm

The purpose of this plugin is to ¯ã¦ãªãƒ€ã‚¤ã‚¢ãƒªãƒ¼ã when you have to ªã©ã§ä½¿ç”¨ã•ã‚Œã‚ inside your items. You can do this by ‹è„šæ³¨ã‚’作成すã‚, and then ‹ãƒ—ラグインã€. It seems very nice!

:lol:
m.
PS: Maybe you can try it and see how it work? It seems the footer note plugin you suggested once. ;-)
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Sun Oct 10, 2004 3:31 pm

uhu, but.... if I don't know what these hyerogliphs mean, how will I know how to use that plugin? This is neither a matter of trial and error.

I'd hoped in the help of some japanese user peeking here, or someone who knows japanese. Its original coder doesn't answer (since two weeks almost).
User avatar
subirghosh
Posts: 408
Joined: Wed Aug 25, 2004 11:39 am
Location: Delhi, India
Contact:

Postby subirghosh » Sun Oct 10, 2004 3:38 pm

Hiro:

Ideal thing would be to copy-paste that bit in one of those online translators.

Subir
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Mon Oct 11, 2004 12:50 am

Subir, the fact is that these aren't katana keys, but asciis coresponding to their rendering from the office's interpreter.... and I cannot see what they are until I install the interpreter for japanese in office..... oh my!
nakahara21
Posts: 47
Joined: Wed Oct 08, 2003 1:12 am
Location: Japan
Contact:

Postby nakahara21 » Wed Sep 14, 2005 2:32 am

Code: Select all

<?php
 
class NP_FootNote extends NucleusPlugin {

    function getName() {
        return 'Foot Note Plugin.'; 
    }
    function getAuthor()  { 
        return 'charlie + nakahara21'; 
    }
    function getURL() 
    {
        return 'http://nakahara21.com/'; 
    }
    function getVersion() {
        return '0.3'; 
    }
    function getDescription() { 
        return 'Create footnoe. KEYWORD STRING((FOOTNOTE STRING)) on the item, replace to KEYWORD STRING + link to anchor and footnote with anchor';
    }
   function supportsFeature($what) {
      switch($what){
         case 'SqlTablePrefix':
            return 1;
         default:
            return 0;
      }
   }


   function install() {
      $this->createOption('CreateTitle','add title with link?','yesno','yes');
      $this->createOption('Split','divide footnote by  bodytext and more text? (on item page, footnote becomes always bringed downward together)','yesno','no');
   }

   function getEventList() {
      return array('PreItem','PreSkinParse');
   }

   function event_PreSkinParse($data) {
      $this->type = $data['type'];
   }

   function event_PreItem($data) {
      global $i, $id, $notelist;
      $this->currentItem = &$data["item"];
      $i =0;
      $notelist = array();
      $id = $this->currentItem->itemid;
      $this->currentItem->body = preg_replace_callback("/\(\((.*)\)\)/Us", array(&$this, 'footnote'), $this->currentItem->body);
      if($this->getOption('Split') == 'yes' && $this->type != 'item'){
         if($footnote = @join('',$notelist))
            $this->currentItem->body .= '<ul class="footnote">' . $footnote . '</ul>';
         $notelist = array();
      }
      if($this->currentItem->more){
         $this->currentItem->more = preg_replace_callback("/\(\((.*)\)\)/Us", array(&$this, 'footnote'), $this->currentItem->more);
         if($footnote = @join('',$notelist))
            $this->currentItem->more .= '<ul class="footnote">' . $footnote . '</ul>';
      }elseif($footnote = @join('',$notelist)){
         $this->currentItem->body .= '<ul class="footnote">' . $footnote . '</ul>';
      }
   }

   function footnote($matches){
      global $i, $id, $notelist;
      $i++;
      if($this->getOption('CreateTitle') == 'yes'){
         $fnote2 = htmlspecialchars(strip_tags($matches[1]));
         $fnote2 = preg_replace('/\r\n/s','',$fnote2);
         $fnote2 = ' title="'.$fnote2.'"';
      }else{
         $fnote2 = '';
      }
      $note = '<span class="footnote"><a href="#'.$id.'-'.$i.'"'.$fnote2.'>*'.$i.'</a><a name="'.$id.'-'.$i.'f"></a></span>';
      $notelist[] = '<a name="'.$id.'-'.$i.'"></a>'.'<li><a href="#'.$id.'-'.$i.'f">Note '.$i.'</a>'.$matches[1].'</li>';
      return $note;
   
   }
}
?>
=================
http://nakahara21.com/
=================
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Sat Sep 17, 2005 3:52 pm

TY Nakahara. Hope I don't have need to tweak my installed Nucleus to avoid to repeat the insertion of all the footonotes which I added manually so far :-(
even in order to see how it works (I'm even afraid to upgrade onto 2.5., for the same reasons; let's drop 3.0!)
verbaljam
Posts: 666
Joined: Wed Jul 31, 2002 4:58 pm
Location: Amsterdam, The Netherlands
Contact:

Postby verbaljam » Sat Oct 01, 2005 9:26 pm

I tested it and it works fine. You can check here if you want:
http://www.verbaljam.nl/index.php?blogid=10

Small suggetions for further improvement:
- Include the blogid in the footnote link. Otherwise, when using more than one blog, it could be overruled by a (different) base reference in the skin of a blog.
-I had to do a translation in Dutch in the code. It would be nice if there would be an option in the plugins admin where I can set the preceding word myself.
-It would be nice if there's a colon inserted automatically after 'Note #' followed by a space. Now I had to change that in the code myself.
Winnie
Posts: 172
Joined: Sun Mar 10, 2002 11:19 pm

Postby Winnie » Fri Nov 18, 2005 2:14 pm

Ok, I've added this to the wiki as NP_FootNote. This is the first time I've created anything in the wiki here, so please let me know if I messed up anything. :wink:
User avatar
roel
Nucleus Guru
Nucleus Guru
Posts: 4469
Joined: Tue Apr 16, 2002 12:41 am
Location: Rotterdam, The Netherlands
Contact:

Postby roel » Fri Nov 18, 2005 5:03 pm

Winnie wrote:Ok, I've added this to the wiki as NP_FootNote. This is the first time I've created anything in the wiki here, so please let me know if I messed up anything. :wink:


Nice job, Winnie! 8)
Is your question not solved yet?
User avatar
Leng
Nucleus Guru
Nucleus Guru
Posts: 2827
Joined: Sun Sep 19, 2004 2:34 am
Location: Australia
Contact:

Postby Leng » Sat Nov 19, 2005 2:30 am

Winnie wrote:Ok, I've added this to the wiki as NP_FootNote. This is the first time I've created anything in the wiki here, so please let me know if I messed up anything. :wink:


Many thanks for adding plugins that crop up on the forum that don't get added to the wiki! It helps to keep everything together.
Image
deborahlau.com | To-Do List
Questions? See the FAQ, read the docs, or browse our plugins!!
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Fri Sep 28, 2007 3:18 pm

It would be nice if there were an option to show the footnote under the text, within a hidden div, when clicking the relative caption.
TCC
Posts: 73
Joined: Tue Jun 22, 2010 1:04 am
Location: USA
Contact:

Postby TCC » Thu Feb 03, 2011 6:30 pm

Style footnotes With NP_Footnote:
To style the footnote reference number in the text into a superscript, you could insert <sup></sup> into the appropriate line in the plugin file, but it doesn't appear pretty on the page. Instead change the span name in the plugin and style it with CSS:
    Make a copy of NP_FootNote.php
    Open NP_FootNote.php and go to line 63, which looks like this:

    Code: Select all

    $note = '<span class="footnote"><a href="#'.$id.'-'.$i.'"'.$fnote2.'>*'.$i.'</a><a name="'.$id.'-'.$i.'f"></a></span>';

    Change line 63 to:

    Code: Select all

    $note = '<span class="superscript"><a href="#'.$id.'-'.$i.'"'.$fnote2.'>*'.$i.'</a><a name="'.$id.'-'.$i.'f"></a></span>';

    Add this to your CSS:

    Code: Select all

    .superscript {
      font-size: 9px;
      position: relative;
      top: -4px;
     }
To style the footnote itself, add the following to your style sheet:

Code: Select all

ul.footnote {
  Margin: 0;
  Padding: 0;
  Font-size: 12px;
 }

To separate the note numbering from the actual footnote at the bottom:
    Save and open NP_FootNote.php
    Open line 64:

    Code: Select all

    $notelist[] = '<a name="'.$id.'-'.$i.'"></a>'.'<li><a href="#'.$id.'-'.$i.'f">Note '.$i.'</a> .$matches[1].'</li>';

    Add two spaces between </a> and ' so that line becomes

    Code: Select all

    $notelist[] = '<a name="'.$id.'-'.$i.'"></a>'.'<li><a href="#'.$id.'-'.$i.'f">Note '.$i.'</a> &nbsp;'.$matches[1].'</li>';


Once these are done, the look of the superscript and footnote can be restyled by adjusting the CSS.
Note: A new version of NP_FootNote will overwrite any changes you made to the plugin.

Return to “Documentation”