Skip to content

Commit 2ac47ba

Browse files
committed
initial checkin
darcs-hash:20081003153952-7ad00-e6c62cb9d0bc4cb0d6274e944174b5ed1110dfad.gz
0 parents  commit 2ac47ba

File tree

7 files changed

+222
-0
lines changed

7 files changed

+222
-0
lines changed

conf/metadata.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$meta['web'] = array('string');
4+
$meta['dir'] = array('string');
5+

lang/en/lang.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$lang['unknown'] = 'unknown cross reference';
4+
$lang['view'] = 'view cross reference for %s';
5+

lang/en/settings.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$lang['dir'] = 'Specify the directory where the PHPXref files of your project are located here.';
4+
$lang['web'] = "Specify the root URL of your PHPXref documents here.";
5+

phpxref-0.7-javascriptfix.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--- phpxref.pl.orig 2008-10-03 17:19:27.000000000 +0200
2+
+++ phpxref.pl 2008-10-03 17:39:07.000000000 +0200
3+
@@ -1657,7 +1657,7 @@
4+
$newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'};
5+
$newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'};
6+
$newheader =~ s/__RELROOT__/..\//g;
7+
- $newheader.=javascript_header(1, '_variables', "index.$ext", "logVariable('$varname');");
8+
+ $newheader.=javascript_header(1, '_variables', $var_ids{$varname}.".$ext", "logVariable('$varname');");
9+
print $VARINDEX $newheader;
10+
print $VARINDEX &navtoggle_html('../');
11+
print $VARINDEX "[<a href=\"../index.$ext\">Top level directory</a>]<br>\n";
12+
@@ -1782,7 +1782,7 @@
13+
$newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'};
14+
$newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'};
15+
$newheader =~ s/__RELROOT__/..\//g;
16+
- $newheader.=javascript_header(1, '_functions', "index.$ext", "logFunction('$funcname');");
17+
+ $newheader.=javascript_header(1, '_functions', $func_ids{$funcname}.".$ext", "logFunction('$funcname');");
18+
print $FUNCINDEX $newheader;
19+
print $FUNCINDEX &navtoggle_html('../');
20+
print $FUNCINDEX "[<a href=\"../index.$ext\">Top level directory</a>]<br>\n";
21+
@@ -1925,7 +1925,7 @@
22+
$newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'};
23+
$newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'};
24+
$newheader =~ s/__RELROOT__/..\//g;
25+
- $newheader.=javascript_header(1, '_classes', "index.$ext", "logClass('$classname');");
26+
+ $newheader.=javascript_header(1, '_classes', $class_ids{$classname}.".$ext", "logClass('$classname');");
27+
print $CLASSINDEX $newheader;
28+
print $CLASSINDEX &navtoggle_html('../');
29+
print $CLASSINDEX "[<a href=\"../index.$ext\">Top level directory</a>]<br>\n";
30+
@@ -2025,7 +2025,7 @@
31+
$newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'};
32+
$newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'};
33+
$newheader =~ s/__RELROOT__/..\//g;
34+
- $newheader.=javascript_header(1, '_constants', "index.$ext", "logConstant('$constname');");
35+
+ $newheader.=javascript_header(1, '_constants', $constname.".$ext", "logConstant('$constname');");
36+
print $CONSTINDEX $newheader;
37+
print $CONSTINDEX &navtoggle_html('../');
38+
print $CONSTINDEX "[<a href=\"../index.$ext\">Top level directory</a>]<br>\n";
39+
@@ -2123,7 +2123,7 @@
40+
$newheader =~ s/__STYLEFILE__/..\/$config{stylefile}/g if $config{'stylefile'};
41+
$newheader =~ s/__PRINTSTYLEFILE__/..\/$config{printstylefile}/g if $config{'printstylefile'};
42+
$newheader =~ s/__RELROOT__/..\//g;
43+
- $newheader.=javascript_header(1, '_tables', "index.$ext");
44+
+ $newheader.=javascript_header(1, '_tables', "$tablenameid.$ext");
45+
print $TABLEINDEX $newheader;
46+
print $TABLEINDEX &navtoggle_html('../');
47+
print $TABLEINDEX &javascript_search(1);

style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
a.xref_plugin {
2+
padding-left: 18px;
3+
background: transparent url(xref.png) left top no-repeat;
4+
}
5+
6+
a.xref_plugin_err {
7+
color: __missing__ !important;
8+
text-decoration: none !important;
9+
border-bottom: dashed 1px __missing__ !important;
10+
}
11+

syntax.php

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
<?php
2+
/**
3+
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
4+
* @author Andreas Gohr <[email protected]>
5+
*/
6+
// must be run within Dokuwiki
7+
if(!defined('DOKU_INC')) die();
8+
9+
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
10+
require_once(DOKU_PLUGIN.'syntax.php');
11+
12+
class syntax_plugin_xref extends DokuWiki_Syntax_Plugin {
13+
14+
var $dir = '';
15+
var $web = '';
16+
17+
function syntax_plugin_xref(){
18+
$this->dir = rtrim($this->getConf('dir'),'/');
19+
$this->web = rtrim($this->getConf('web'),'/');
20+
}
21+
22+
/**
23+
* return some info
24+
*/
25+
function getInfo(){
26+
return array(
27+
'author' => 'Andreas Gohr',
28+
'email' => '[email protected]',
29+
'date' => '2008-10-03',
30+
'name' => 'PHPXref Plugin',
31+
'desc' => 'Makes linking to a PHPXref generated API doc easy.',
32+
'url' => 'http://dokuwiki.org/plugin:xref',
33+
);
34+
}
35+
36+
/**
37+
* What kind of syntax are we?
38+
*/
39+
function getType(){
40+
return 'substition';
41+
}
42+
43+
/**
44+
* What about paragraphs?
45+
*/
46+
function getPType(){
47+
return 'normal';
48+
}
49+
50+
/**
51+
* Where to sort in?
52+
*/
53+
function getSort(){
54+
return 150;
55+
}
56+
57+
58+
/**
59+
* Connect pattern to lexer
60+
*/
61+
function connectTo($mode) {
62+
$this->Lexer->addSpecialPattern('\[\[xref>.+?\]\]',$mode,'plugin_xref');
63+
}
64+
65+
66+
/**
67+
* Handle the match
68+
*/
69+
function handle($match, $state, $pos, &$handler){
70+
$match = trim(substr($match,7,-2));
71+
72+
list($link,$name) = explode('|',$match,2);
73+
if(!$name) $name = $link;
74+
75+
$first = 0;
76+
if($link[0] == '$') $first = 4;
77+
$found = $this->_find($link,$first);
78+
79+
return array($link,$found,$name);
80+
}
81+
82+
/**
83+
* Create output
84+
*/
85+
function render($format, &$R, $data) {
86+
global $conf;
87+
if($format != 'xhtml') return false;
88+
89+
//prepare for formating
90+
$link['target'] = $conf['target']['extern'];
91+
$link['style'] = '';
92+
$link['pre'] = '';
93+
$link['suf'] = '';
94+
$link['more'] = '';
95+
$link['class'] = 'xref_plugin';
96+
$link['name'] = hsc($data[2]);
97+
98+
if(!$data[1]){
99+
$link['url'] = $this->web;
100+
$link['title'] = $this->getLang('unknown');
101+
$link['class'] .= ' xref_plugin_err';
102+
}else{
103+
$link['url'] = $this->web.'/'.$data[1];
104+
$link['title'] = sprintf($this->getLang('view'),hsc($data[0]));
105+
}
106+
107+
$R->doc .= $R->_formatLink($link);
108+
return true;
109+
}
110+
111+
/**
112+
* Try to find the given name in the xref directory
113+
*
114+
* @param int $first - defines which type should be searched first for the name
115+
*/
116+
function _find($name,$first=0){
117+
$paths = array(
118+
0 => '_functions',
119+
1 => '_classes',
120+
2 => '_constants',
121+
3 => '_tables',
122+
4 => '_variables'
123+
);
124+
125+
$clean = preg_replace('/[^\w\-_]+/','',$name);
126+
$small = strtolower($clean);
127+
128+
$path = $paths[$first];
129+
unset($paths[$first]);
130+
do{
131+
$check = $path.'/'.$clean.'.html';
132+
if(@file_exists($this->dir.'/'.$check)) return $check;
133+
$check = $path.'/'.$small.'.html';
134+
if(@file_exists($this->dir.'/'.$check)) return $check;
135+
$path = array_shift($paths);
136+
}while($path);
137+
138+
// still here? might be a file reference
139+
$clean = preg_replace('/\.\.+/','.',$name);
140+
if(@file_exists($this->dir.'/'.$clean.'.html')){
141+
return $clean.'.html';
142+
}
143+
144+
return '';
145+
}
146+
147+
}
148+
149+
//Setup VIM: ex: et ts=4 enc=utf-8 :

xref.png

481 Bytes
Loading

0 commit comments

Comments
 (0)