Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions action.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

use dokuwiki\Cache\Cache;
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\Event;
use dokuwiki\Extension\EventHandler;
use dokuwiki\StyleUtils;

/**

*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');

class action_plugin_epub extends DokuWiki_Action_Plugin {
private $helper;
Expand Down Expand Up @@ -101,7 +103,7 @@ function prevent_cache(&$event) {
if(!$this->helper) {
$this->helper = $this->loadHelper('epub', true);
}
if (!$this->helper->is_inCache($INFO['id'])) return; //cache set in syntax.php
if (isset($INFO['id']) && !$this->helper->is_inCache($INFO['id'])) return; //cache set in syntax.php
$event->preventDefault();
}

Expand Down
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base epub
author Myron Turner
email turnermm02@shaw.ca
date 2022-10-05
date 2023-01-31
name epub
desc Ebook creator
url http://www.dokuwiki.org/plugin:epub
Expand Down
10 changes: 5 additions & 5 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,18 @@ function _media ($src, $title=NULL, $align=NULL, $width=NULL,
$mpfile = str_replace('Audio/',"",$src);
$display_name = $title;
$title = $mpfile;
$out .= $this->_formatLink( array('class'=>'media mediafile mf_mp3','title'=>$title,'name'=>$title, 'display'=>$display_name) ) ."\n</div><p>";
$out .= $this->_formatLink( array('class'=>'media mediafile mf_mp3','title'=>$title,'name'=>$title, 'display'=>$display_name, 'url'=>'') ) ."\n</div><p>";
}
}
else if(strpos($mtype[1],'video') !== false) {
if($this->video_link) $out .= '</p><div style="text-align:center">' ;//$out .= '<div style="text-align:center">' ;
$out .= $this->set_video($src,$mtype,$title) ;
if($this->video_link) {
list($title,$rest) = explode('(', $title);
list($title,$rest) = array_pad(explode('(', $title), 2, '');
$mpfile = str_replace('Video/',"",$src);
$display_name = $title;
$title = $mpfile;
$out .= $this->_formatLink( array('class'=>'media mediafile mf_mp4','title'=>$title,'name'=>$title, 'display'=>$display_name) ) ."\n</div><p>";
$out .= $this->_formatLink( array('class'=>'media mediafile mf_mp4','title'=>$title,'name'=>$title, 'display'=>$display_name, 'url'=>'') ) ."\n</div><p>";
}
}
else {
Expand Down Expand Up @@ -180,7 +180,7 @@ function is_image($link,&$type) {

$mime_type = mimetype($link['title']);
if(!$mime_type[1] ) {
list($url,$rest) = explode('?', $link['url']);
list($url,$rest) = array_pad(explode('?', $link['url']), 2,'');
$mime_type = mimetype($url);
if(!$mime_type[1]) {
$mime_type = mimetype($rest);
Expand Down Expand Up @@ -333,7 +333,7 @@ function smiley($smiley) {
function local_name($link,&$orig="", &$frag ="") {
$base_name= basename($link['url']);
$title = $link['title']? ltrim($link['title'],':'): "";
list($starturl,$frag) = explode('#',$link['url']);
list($starturl,$frag) = array_pad(explode('#',$link['url']), 2, '');
if ($title) {
$name = $title;
}
Expand Down
19 changes: 8 additions & 11 deletions scripts/css2.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/

if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../').'/');
if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching)
if(!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT',1); // we gzip ourself here
if(!defined('EPUB_DIR')) define('EPUB_DIR',realpath(dirname(__FILE__).'/../').'/');
if(!defined('DOKU_TPL')) define('DOKU_TPL', DOKU_BASE.'lib/tpl/'.$conf['template'].'/');
if(!defined('DOKU_TPLINC')) define('DOKU_TPLINC', DOKU_INC.'lib/tpl/'.$conf['template'].'/');
require_once(DOKU_INC.'inc/init.php');

use dokuwiki\Cache\Cache;
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\Event;
use dokuwiki\Extension\EventHandler;
use dokuwiki\StyleUtils;


// ---------------------- functions ------------------------------
Expand Down Expand Up @@ -69,9 +66,9 @@ function epub_css_out($path){
}

// load user styles
if(isset($config_cascade['userstyle'][$mediatype])){
$files[$config_cascade['userstyle'][$mediatype]] = DOKU_BASE;
}
#if(isset($config_cascade['userstyle'][$mediatype])){
# $files[$config_cascade['userstyle'][$mediatype]] = DOKU_BASE;
#}

// load files
$css = "";
Expand Down
6 changes: 5 additions & 1 deletion scripts/epub_utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function epub_opf_header($user_title) {
}
}

$cover_png = "";
if(!$user_title) {
$cover_png='<item id="cover-image" href="Images/cover.png" media-type="image/png"/>'. "\n";
}
Expand Down Expand Up @@ -616,7 +617,10 @@ function epub_save_namespace($ns="") {
function epub_checkfor_ns($name, &$pages, &$titles) {
$name = rtrim($name);

$n = strrpos($name,'*',-1);
$n = false;
if (strlen($n) > 0){
$n = strrpos($name,'*',-1);
}
if(!$n) return;
array_shift($pages); // remove namespace id: namespace:*

Expand Down
11 changes: 7 additions & 4 deletions syntax.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
use dokuwiki\Cache\Cache;
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\Event;
use dokuwiki\Extension\EventHandler;
use dokuwiki\StyleUtils;



class syntax_plugin_epub extends DokuWiki_Syntax_Plugin {
Expand Down Expand Up @@ -83,7 +86,7 @@ function render($mode, Doku_Renderer $renderer, $data) {

for($i=0;$i<count($files);$i++) {
$file = trim($files[$i],'][');
list($file,$rest) = explode('|',$file);
list($file,$rest) = array_pad(explode('|',$file), 2, '');
$file=trim($file);
$file=trim($file,'/');
if(!$file) continue;
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
master_22-Oct_05-09_43
issue-#37-fix_23-Jan_31-15_36