GithubHelp home page GithubHelp logo

turnermm / codedoc Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 1.0 15 KB

Dokuwiki plugin for documenting and displaying extended blocks of code

Home Page: https://www.dokuwiki.org/plugin:codedoc

JavaScript 4.11% CSS 5.74% PHP 90.14%

codedoc's People

Contributors

splitbrain avatar turnermm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

azurecloudmonk

codedoc's Issues

PHP 8 Compatibility

As of EOL of PHP 7.4 many hosters disable these older versions of PHP.

This plugin seems still not to be compatible to higher versions.

Error: Call to undefined function create_function()
/var/www/virtual/punk1t/punk-t.de/wiki/lib/plugins/codedoc/syntax/specials.php(67)
#0 /var/www/virtual/punk1t/punk-t.de/wiki/inc/parser/renderer.php(117): syntax_plugin_codedoc_specials->render('xhtml', Object(renderer_plugin_xbr), Array)
#1 /var/www/virtual/punk1t/punk-t.de/wiki/inc/parserutils.php(682): Doku_Renderer->plugin('codedoc_special...', Array, 5, '~~codedoc:Ein K...')
#2 /var/www/virtual/punk1t/punk-t.de/wiki/inc/parserutils.php(149): p_render('xhtml', Array, NULL)
#3 /var/www/virtual/punk1t/punk-t.de/wiki/inc/parserutils.php(89): p_cached_output('/var/www/virtua...', 'xhtml', 'playground:star...')
#4 /var/www/virtual/punk1t/punk-t.de/wiki/inc/Ui/PageView.php(68): p_wiki_xhtml('playground:star...', 0, true, '')
#5 /var/www/virtual/punk1t/punk-t.de/wiki/inc/Action/Show.php(37): dokuwiki\Ui\PageView->show()
#6 /var/www/virtual/punk1t/punk-t.de/wiki/inc/template.php(100): dokuwiki\Action\Show->tplContent()
#7 [internal function]: tpl_content_core('show')
#8 /var/www/virtual/punk1t/punk-t.de/wiki/inc/Extension/Event.php(133): call_user_func_array('tpl_content_cor...', Array)
#9 /var/www/virtual/punk1t/punk-t.de/wiki/inc/Extension/Event.php(199): dokuwiki\Extension\Event->trigger('tpl_content_cor...', true)
#10 /var/www/virtual/punk1t/punk-t.de/wiki/inc/template.php(85): dokuwiki\Extension\Event::createAndTrigger('TPL_ACT_RENDER', 'show', 'tpl_content_cor...')
#11 /var/www/virtual/punk1t/punk-t.de/wiki/lib/tpl/dokuwiki/main.php(59): tpl_content()
#12 /var/www/virtual/punk1t/punk-t.de/wiki/inc/actions.php(27): include('/var/www/virtua...')
#13 /var/www/virtual/punk1t/punk-t.de/wiki/doku.php(126): act_dispatch()

No file download

<codeblock file> does not actually offer a file to download as <file> does. Not sure if this is a bug or just a missing implementation.

Feature request: optionally disable DW substitution in a whole code block

I'm often prefering the codedoc plugin over the builtin DW <code> syntax because <codedoc code> supports highlighting of specific parts of the sample text. This is very helpful e.g. if you want to highlight a specific part of a command, or a specific piece of text of the output from a command.

However, usage can be a bit tricky because parts of the text can be unexpectedly changed by DW's substitution, which is often not even obvious.

For example, a long command line parameter like --version is displayed correctly in a <code> block, but shows up as -version (with a single dash) in a <codedoc code> block. You can only avoid this if you explicitly use a codedoc-specific syntax (~~codedoc:clean: ... ~~) to escape every single of such potential substitutions, and you can easily overlook places like -- being substituted by -.

Also, if the output text from a command contains an email address enclosed in angle brackets, you individually have to escape each of the angle brackets < and > to see the real output of the command.

Even though I find codedoc very useful, I've often stumbled across things like this and it takes quite some time to review the generated web page to see if the DW substitution hasn't unexpectedly changed something.

I've also set up a sample page that tries to explain this in more detail:
https://wiki.burnicki.net/miscellaneous_tips:00_dokuwiki:a_codedoc_plugin_test_page

So unless I'm missing something that already does this, it would be a great feature (IMO) to be able to disable DW substitution in specific code blocks, using syntax like

<codedoc code:raw>
</codedoc>

or similar. I have to admit that I'm not very familiar with the way DW and the plugins work in detail, if it comes to syntax parsing. So I can't tell if it's easily possible to implement this, but it would be great if all substitutions except the codedoc-specific things like

~~codedoc:<em>~~ ... </em>~~

could be disabled.

Different highlighting than in DokuWiki core Geshi

For some reason highlighted code generated from codedoc tags looks different than highlighted code generated from DokuWiki's core code tags. E.g. the following example causes different results also the source code is the same:

<codedoc code:C>
void main () {
    printf ("Hello World!");
    exit 0;
}
</codedoc>

<code C>
void main () {
    printf ("Hello World!");
    exit 0;
}
</code>

This is strange as the codedoc plugin just calls p_xhtml_cached_geshi(). I noticed that the " around the Hello World! strings are different. It seems to be an encoding problem but I could not find the source of the problem yet.

Error: Call to undefined function create_function() on Igor with PHP 8.0

Pages using codedoc fail to load and an error is generated in the logs:

2022-08-09 17:15:34Error: Call to undefined function create_function() /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/lib/plugins/codedoc/syntax/specials.php(67)
    #0 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/parser/renderer.php(117): syntax_plugin_codedoc_specials->render()
    #1 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/parserutils.php(682): Doku_Renderer->plugin()
    #2 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/parserutils.php(149): p_render()
    #3 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/parserutils.php(89): p_cached_output()
    #4 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/Ui/PageView.php(68): p_wiki_xhtml()
    #5 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/Action/Show.php(37): dokuwiki\Ui\PageView->show()
    #6 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/template.php(100): dokuwiki\Action\Show->tplContent()
    #7 [internal function]: tpl_content_core()
    #8 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/Extension/Event.php(133): call_user_func_array()
    #9 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/Extension/Event.php(199): dokuwiki\Extension\Event->trigger()
    #10 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/template.php(85): dokuwiki\Extension\Event::createAndTrigger()
    #11 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/lib/tpl/dokuwiki/main.php(59): tpl_content()
    #12 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/inc/actions.php(27): include('...')
    #13 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/doku.php(126): act_dispatch()
    #14 /home/username/local_html/dokuwiki-2022-7-31/dokuwiki/index.php(76): require('...')
    #15 {main}

This is being run locally in Linux Mint using php8.0 -S localhost:8008 index.php.

When I run php7.4 -S localhost:8008 index.php there are no problems, so it seems maybe an issue related to PHP8.0?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.