tstaerk / mediasyntax Goto Github PK
View Code? Open in Web Editor NEWMediasyntax is a plugin for Dokuwiki that enables Mediawiki syntax.
Home Page: http://www.staerk.de/thorsten/Mediasyntax
License: GNU General Public License v2.0
Mediasyntax is a plugin for Dokuwiki that enables Mediawiki syntax.
Home Page: http://www.staerk.de/thorsten/Mediasyntax
License: GNU General Public License v2.0
====== Mediasyntax Plugin for DokuWiki ====== All documentation for the Mediasyntax Plugin is available online at: * https://www.dokuwiki.org/plugin:mediasyntax Do NOT try to install this plugin via un-tarring it. Use plugin manager as described in the above link. ---- (c) 2005-2007 by Esther Brunner <[email protected]> (c) 2008 by Gina Häußge, Michael Klier <[email protected]> (c) 2006 by Allen Ormond <aormond atgmaildotcom> (was goto plugin, now redirect component) (c) 2010-2023 by Thorsten Stärk <[email protected]> See COPYING for license info. Change history: 2023-07-29: 2 hours: adapted to PHP 8 forbidding array and string offset access syntax with curly braces 2015-07-26: 1 hour: added tool to update mediasyntax on www.staerk.de 2015-07-25: 1 hour: allow [[File: instead of [[Image: 2015-06-27: 1 hour: enable linking to PDF 2013-08-04: 1 hour: do not show "you will be redirected"... inside an <ol> 2013-08-04: 1 hour: keep "__". It is not a markup for <u> 2013-08-03: 1 hour: keep the stars. "**" does not mean "bold" 2013-08-02: 2 hours: do not stop rendering on "//" 2012-09-20: 4 hours: converter: allow for rowspan 2012-09-19: 1 hour: converter: do not have empty columns right of your table 2012-07-25: 1 hour: issue #9: converter: treat ordered lists right 2012-07-24: 1 hour: issue #9: converter: treat headings right 2012-07-23: 2 hours: also convert tables with no headers 2012-07-23: 1 hour: converter: do not hang on lists 2012-07-20: 1 hour: converter: replace ** with ''' 2012-03-19: 2 hours: fix hplus and hminus in toolbar, convert italic from dokuwiki to mediawiki 2012-03-18: 4 hours: add teletyper tag tt 2012-03-18: 2 hours: fix toolbar regarding hminus and ol 2012-03-18: 1 hour: testcase for converting dokuwiki style tables to mediawiki 2012-03-17: 1 hour: allow converting dokuwiki style tables to mediawiki 2011-07-17: 1 hour: Issue 6: bring date from http://www.dokuwiki.org/plugin:mediasyntax and plugin.info.txt in sync 2011-07-03: 4 hours: allowed bold text in codeblocks, but not in preblocks 2011-04-02: 4 hours: Issue 3: allow pictures (aka images) 2011-01-23: 1 hour: Issue 2: allowed internal links to be italic 2010-12-10: 2 hours: allowed {{included pages}} as in mediawiki style 2010-11-21: 1 hour: listblock starting with two ** works now, see https://github.com/tstaerk/mediasyntax/issues#issue/1 2010-10-30: 2 hours: made toolbar work 2010-10-28: 1 hour: allow a codeblock directly under a listitem 2010-10-26: 1 hour: allow a listitem directly under a codeblock 2010-10-19: 1 hour: cleanup code, remove misleading configuration setting 2010-10-17: 2 hour: italic font and plugin info text, removing getInfo() 2010-10-16: 3 hours: un-teach dokuwiki that // makes text italic 2010-10-13: 2 hours: convert tool to convert existing files from dokuwiki syntax to mediawiki syntax 2010-08-21: 1 hour: redirect made faster 2010-08-20: 1 hour: preblock and codeblock should start on the same column 2010-08-07: 8 hours: allowed a SpecialPattern (e.g. GB) in the mid of a line, directly followed by a blank, without triggering a preformatted area. Had to reasearch the calls object structure of the parser for this. 2010-07-22: 5 hours: preformatted text should work with SUSE and Ubuntu. Solution is simple: AddEntryPattern requires a parameter $mode. Set it to 'base'. 2010-05-05: 8 hours: preformatted text directly under normal text works, and two subsequent lines of preformatted text start on the same column 2010-04-18: 3 hours: bold text works 2010-04-17: 2 hours: adapting goto plugin by Allen Ormond to become the redirect component 2010-04-16: 1 hour: testcase for external link 2010-04-15: 3 hours: external links work 2010-04-11: 1 hour: <pre> tag must not be interrupted by a line starting with a character that is not a space 2010-04-10: 3 hours: possibility to use the <pre> tag 2010-04-08: 1 hour: version updated 2010-04-03: 1 hour: testcase & two adjacent preformatted lines fix 2010-04-02: 4 hours: single blank at beginning of line makes preformatted text 2010-03-29: 2 hours: created mediasyntax from creole plugin
In linux servers the /tmp dir exist but in windows it doesn't.
Can we get the documentation somewhere else
italic dokuwiki markup is not converted using the dokuwiki2mediawiki.php tool.
Example:
hand over templates: RAID //n// → Pools are being created
error message :
Parse error: syntax error, unexpected 'new' (T_NEW) in *****\lib\plugins\mediasyntax\syntax\listblock.php on line 59
workaround :
replace & new
in line 59 and line 60 with /*&*/ new
reference : PHP 7 and Wordpress: How to FIX unexpected 'new' (T_NEW) error ⋆ CodeCave Blog
still some warnings
Warning: Declaration of syntax_plugin_mediasyntax_bold::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in *****\lib\plugins\mediasyntax\syntax\bold.php on line 47
Warning: Declaration of syntax_plugin_mediasyntax_bold::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in *****\lib\plugins\mediasyntax\syntax\bold.php on line 47
Warning: Declaration of syntax_plugin_mediasyntax_codeblock::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in *****\lib\plugins\mediasyntax\syntax\codeblock.php on line 100
Warning: Declaration of syntax_plugin_mediasyntax_codeblock::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in *****\lib\plugins\mediasyntax\syntax\codeblock.php on line 100
Warning: Declaration of syntax_plugin_mediasyntax_header::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in *****\lib\plugins\mediasyntax\syntax\header.php on line 72
Warning: Declaration of syntax_plugin_mediasyntax_header::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in *****\lib\plugins\mediasyntax\syntax\header.php on line 72
Warning: Declaration of syntax_plugin_mediasyntax_include::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in *****\lib\plugins\mediasyntax\syntax\include.php on line 51
Warning: Declaration of syntax_plugin_mediasyntax_include::render($format, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in *****\lib\plugins\mediasyntax\syntax\include.php on line 51
Warning: Declaration of syntax_plugin_mediasyntax_italic::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in *****\lib\plugins\mediasyntax\syntax\italic.php on line 48
Warning: Declaration of syntax_plugin_mediasyntax_italic::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in *****\lib\plugins\mediasyntax\syntax\italic.php on line 48
Warning: Declaration of syntax_plugin_mediasyntax_link::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in *****\lib\plugins\mediasyntax\syntax\link.php on line 56
Warning: Declaration of syntax_plugin_mediasyntax_link::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in *****\lib\plugins\mediasyntax\syntax\link.php on line 56
MediaWiki style Include feature not working. Worked fine before.
e.g.
{{navbar_footer}}
should include [[navbar_footer]]
The URL on my site is https://www.devopscloud.io/lib/exe/fetch.php?media=navbar_footer
get error: "Not Found"
instead of including the file navbar_footer.txt as it should and did previously.
This feature allows me to use many Wikipedia templates such as https://en.wikipedia.org/w/index.php?title=Template:C%2B%2B_programming_language&action=edit
With a little modification these Wikipedia templates are transcluded by your MediaSyntax plugin making for simple reusable navbars and headers and footers. This is what is no longer working after your latest fixes.
Otherwise, everything is working great now such as the #redirect [[file]] feature. Formatting and TOC looks goods.
Again, 🙏 thank you for your hard work and awesome plugin allowing DokuWiki to be a much simpler drop-in replacement for overly complex MediaWiki.
This results in wrong formatting
== foobar ==
** foo
No matter how many spaces are between the title and the bullet point part
Hi,
I am using the mediasyntax-plugin of dokuwiki.
It is a very usefull plugin for me.
There is an error in this mediasyntax-plugin.
This results in the fault (on some web pages):
Warning: Use of undefined constant then - assumed 'then' (this will throw an Error in a future version of PHP) in D:\xampp\htdocs\dokuwiki\lib\plugins\mediasyntax\syntax\codeblock.php on line 56
Solution is changing this file as follows:
56c56
< if ($match[$i-1] == "\n" && $match[$i] == " ") then ;
---
> if ($match[$i-1] == "\n" && $match[$i] == " ") {;}
Can this be changed in the new version please?
Now I have to change it with each update.
Thank you,
Bart
Code blocks used to work but don't seem to work any longer. Test code:
this is a
pre line
blablabla
I just updated this plugin today and remembered a fix I had applied before.
With this plugin enabled I have always run into several instances of this warning message showing up at the beginning of each page in the wiki:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Doku_Renderer_metadata::section_edit' was given in //inc/parserutils.php on line 464
Based on this discussion:
dokufreaks/plugin-creole#4
it looks to be from deprecated code in syntax/header.php and the errors stop (and no impact to functionality appears on my install at least) if I simply remove that entire code block:
57,62c57,62
< $handler->_addCall('section_edit', array(
< $handler->status['section_edit_start'],
< $pos-1,
< $handler->status['section_edit_level'],
< $handler->status['section_edit_title']
< ), $pos);
---
> //$handler->_addCall('section_edit', array(
> // $handler->status['section_edit_start'],
> // $pos-1,
> // $handler->status['section_edit_level'],
> // $handler->status['section_edit_title']
> // ), $pos);
[1] 9450 exit 1 diff header.php.orig header.php
I'm interested in having the option for a particular page to render Dokuwiki syntax or Media wiki syntax. One proposal would be for Media wiki syntax to be enclosed in some tag such as anything after ~~MEDIAWIKI~~
or text between <mw>
..</mw>
tags. A configuration setting could enable this behavior.
When trying [[Image:image_name]] the image, as well as the link, are broken.
For instance:
[[Image:motherboard.png]]
generates
< a href="/dokuwiki/lib/exe/detail.php?...&media=image:motherboard.png" ... >
< img src="/dokuwiki/lib/exe/fetch.php?media=image:motherboard.png" ... >< /a >
However, by removing "image:" manually, it works.
It it the same problem described in "#3 (comment)"? Should I use the RewriteRules directive to fix this?
Thanks in advance!
Hi,
Unfortunately when installing this plugin in the latest dokuwiki Hogfather version, all pages ends with the following PHP error:
[05-Sep-2020 06:18:12 America/Chicago] PHP Fatal error: Uncaught Error: Class 'Doku_Handler_List' not found in /var/www/wiki/lib/plugins/mediasyntax/syntax/listblock.php:88
Stack trace:
#0 /var/www/wiki/inc/load.php(147): require()
#1 [internal function]: load_autoload('syntax_plugin_m...')
#2 [internal function]: spl_autoload_call('syntax_plugin_m...')
#3 /var/www/wiki/inc/Extension/PluginController.php(103): class_exists('syntax_plugin_m...', true)
#4 /var/www/wiki/inc/pluginutils.php(54): dokuwiki\Extension\PluginController->load('syntax', 'mediasyntax_lis...', false, false)
#5 /var/www/wiki/inc/parserutils.php(559): plugin_load('syntax', 'mediasyntax_lis...')
#6 /var/www/wiki/inc/parserutils.php(204): p_get_parsermodes()
#7 /var/www/wiki/inc/parserutils.php(181): p_get_instructions('Welcome to the ...')
#8 /var/www/wiki/inc/parserutils.php(501): p_cached_instructions('/home1/ogeefion...', false, 'start')
#9 /var/www/wiki/inc/parserutils.php(282): p_render_metadata('start', Array)
#10 /home1/ogeefio in /var/www/wiki/lib/plugins/mediasyntax/syntax/listblock.php on line 88
Indeed the Doku_Handler_List
class doesn't exist anymore in the Dokuwiki code base.
As discussed on http://www.staerk.de/thorsten/Mediasyntax
Hi, I was wondering how to insert a link to an xls file and noticed in the code that this apparently only works for pdfs (sorry if I got this wrong, but it doesn't look like that).
So I made this tiny change to media.php to insert image links only for image extensions, and regular A links to everything else.
--- media.php.orig 2016-02-29 16:22:38.630324609 +0000
+++ media.php 2016-02-29 16:28:04.376905032 +0000
@@ -59,15 +59,17 @@
$extension=preg_replace("/.*\./","",$filename); // e.g. png
$pipe=preg_replace("/.*\|/","",$start); // e.g. 50px
+ $img_exts = array("png", "jpg", "jpeg", "gif");
+
if($mode == 'xhtml')
{
- if ($extension == "pdf")
+ if (in_array(strtolower($extension), $img_exts))
{
- $renderer->doc.= '<a href="'.DOKU_BASE.'lib/exe/fetch.php?media='.$filename.'">File:'.$filename.'</a>';
+ $renderer->doc.= '<img src="'.DOKU_BASE.'lib/exe/fetch.php?media='.$filename.'" width='.$pipe.' />';
}
else
{
- $renderer->doc.= '<img src="'.DOKU_BASE.'lib/exe/fetch.php?media='.$filename.'" width='.$pipe.' />';
+ $renderer->doc.= '<a href="'.DOKU_BASE.'lib/exe/fetch.php?media='.$filename.'">File:'.$filename.'</a>';
}
}
return false;
^ HOST ^ HOST_ACTIVE ^ HOST_STATUS ^ FAILOVER_STATUS ^ FAILOVER_GROUP ^ FAILOVER_CONFIG_GROUP ^ FAILOVER_ACTUAL_GROUP ^ NAMESERVER_CONFIG_ROLE ^ NAMESERVER_ACTUAL_ROLE ^ INDEXSERVER_CONFIG_ROLE ^ INDEXSERVER_ACTUAL_ROLE ^ STORAGE_PARTITION ^ REMOVE_STATUS ^
|"2222"|"YES"|"OK"|""|"default"|"default"|"default"|"MASTER 2"|"SLAVE"|"WORKER"|"SLAVE"|2|""|
|"3333"|"YES"|"OK"|""|"default"|"default"|"default"|"SLAVE"|"SLAVE"|"WORKER"|"SLAVE"|3|""|
|"1111"|"YES"|"OK"|""|"default"|"default"|"default"|"MASTER 1"|"MASTER"|"WORKER"|"MASTER"|1|""|
We're using MediaWiki at work and therefore it's obvious I'm used to that syntax. At home I have a dokuwiki installed on a NAS for my private stuff and using mediasyntax.
Unfortunately the usage of the colon (:) as continuation sign as shown in https://www.mediawiki.org/wiki/Help:Formatting at 'Mixture of different types of list' does not work as expected, it just shows the colon.
Would be great to get that 'fixed'/'implemented'...
Thanks Patrik
Syntax such as
<span style="color:#C90D00">'''''Needs clarification'''''</span>
does not convert.
Probably more of a feature request than a bug.
This code does not work as intended:
These are two slashes: //
Hi.
I'm new to DokuWiki. I have this error after instaling MediaWiki Syntax Plugin:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Doku_Renderer_xhtml::section_edit' was given in /public_html/wiki/inc/parserutils.php on line 555
It is "a must have " plugin for me :-( I cannot use MediaWiki instead of Dokuwki+MediaWiki Syntax because MediaWiki isn't supported by JFusion.
It must have something to so with this line in syntax/header.php (57)
$handler->_addCall('section_edit', array( ...
There's no function "section_edit" in inc/parser/[xhtml.php, metadata.php]
The following error is shown:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Doku_Renderer_metadata::section_edit' was given in ..../dokuwiki/inc/parserutils.php on line 525
Warning: Cannot modify header information - headers already sent by (output started at .../dokuwiki/inc/parserutils.php:525) in ..../dokuwiki/inc/actions.php on line 180
In latest version of mediasyntax plugin using Release 2010-11-07 "Anteater" of Dokuwiki, wiki links rendered within an italic block do not parse as they do within an emboldened block. I have not tried this plugin before this release so cannot comment if it is a new issue in Anteater.
For example:
'''This is a bold [[link]]''' Renders the link.
''This is an italic [[link]]'' Does not render the link, simply shows "[[link]]" as written.
Thanks for any feedback.
I retest the fixed code, but seems like it still can't convert correctly for just table conversion, and will hang on normal conversion.
example 1:
| Name 1 | Address 1 |
| Name 2 | Address 2 |
output : |
---|
Name 1 |
- |
'''Name 2''' |
- |
} |
example 2 : (will hang)
====== Title ======
[[DEMO Link]]
| Name | Address |
output :
====== Title ======
at terminal : (stop at here)
0====== Title ======
1 - [[DEMO Link]]
When I use the Admin Extension Manager (e.g. https://www.devopscloud.io/doku.php?id=start&do=admin&page=extension&tab=plugins) the MediaSyntax plugin always shows: "Update: New version 2023-07-29 is available." Even after I do the update, it still continues to list an update as available. It did this back in 2015 as well.
All of the other plugins I use clear the "update flag" within the Extension Manager UI, so to speak, after doing an update.
Obviously, this is a very low priority item.
Thanks again.
This plugin seems to make use of one or more form related action events that will be removed in the next DokuWiki release. Please have a look at https://www.patreon.com/posts/better-forms-58551930 for details.
My apologies if this has already been addressed in your code. If you have any questions on how to implement the needed changes please let me know.
Hi Andi,
I finally got a chance to install your fixes, and now get a new error:
“dokuwiki\Exception\FatalException: Array and string offset access syntax with curly braces is no longer supported
An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the mediasyntax plugin.
More info has been written to the DokuWiki error log.”
Here is my DokuWiki error log once I install the latest plugin:
2023-06-29 12:27:30
E_COMPILE_ERROR: Array and string offset access syntax with curly braces is no longer supported
/home/USERNAME/devopscloud.io/lib/plugins/mediasyntax/helper.php(376)
#0 [internal function]: dokuwiki\ErrorHandler::fatalShutdown()
https://www.devopscloud.io/doku.php?id=dokuwiki
Discussion originally referenced here: https://forum.dokuwiki.org/d/21100-mediasyntax-on-jackrum-php82-attempt-to-assign-property-toplevel-id-on-null
Thanks.
Again, thanks for your help on this.
[[Image:kevin:image.png]] works correctly but I can't get a PDF upload link to work at all. If using [[Image:kevin:file.pdf]] I just get a generic image icon. Also tried File: and Media: without success.
Using current git source
Hi Thorsten and Andy. Andy, I was your first or second monthly GitHub Sponsor several years ago and DokuWiki is my favorite software since 2005!
My ISP is forcing me to update from PHP 7.4.15 to 8.1 or 8.2 which causes my most important DokuWiki plugins to fail (mediasyntax by Thorsten Staerk and WikipediaSnippet Plugin by Anika Henke) which then crashes DokuWiki. dokuwiki/dokuwiki#3971
Andy, In the past 2 years ago when I requested to pay you to update the code of the incompatible https://www.dokuwiki.org/plugin:mediasyntax Mediawiki syntax plugin to work with a newer version of DokuWiki, you kindly did it for free and privately sent me the code files.
I again would like to offer to pay you consulting fees by increasing my GitHub sponsorship or PayPaling you whatever amount you require to fix the 2 abandoned plugins mediasyntax and WikipediaSnippet.
Would it be possible for you to GitHub fork the 2 abandoned plugins (https://github.com/tstaerk/mediasyntax/issues and selfthinker/dokuwiki_plugin_wikipediasnippet#23 and update them publicly to work with PHP 8.2.0 and Release 2023-04-04a “Jack Jackrum”? That way others can benefit from the updates.
Thanks again for your greatly useful amazing DokuWiki!
Cloud Monk Losang Jinpa
https://github.com/AzureCloudMonk
Running on 2010.11.07 "Anteater" release of DokuWiki and latest January release of mediasyntax plugin, when mediasyntax plugin is enabled, no images will appear; when disabled they appear again as normal given standard dokuwiki media format eg:
{{:quine:perih_dabble.png|}}
Thanks for any insight!
Dokuwiki to Mediawiki conversion:
example:
|Name| after conversion still get back |Name|
I want to use [[File: to insert an image. So far only [[Image: is possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.