Giter Site home page Giter Site logo

uapv / uapvhelpplugin Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 204 KB

Plugin Symfony pour afficher automatiquement une aide au format Markdown sur les pages d'une application

Home Page: http://gpl.univ-avignon.fr

License: Other

JavaScript 37.66% PHP 62.34%

uapvhelpplugin's Introduction

uapvHelpPlugin

Features

uapvHelpPlugin displays a link to the documentation of your symfony actions when it exists. The Markdown syntax is used to help you write theses files in an easy-to-read and easy-to-write way. Theses files are also parsed with PHP to allow you to use any symfony helpers you want.

uapvHelpPlugin also use the symfony cache to prevent unneeded markown parsing. Don't forget to use 'symfony cc' whenever you modify the documentation files.

How to install ?

  1. Get the sources

    git clone git://github.com/UAPV/uapvHelpPlugin.git plugins/uapvHelpPlugin symfony plugin:publish-assets

  2. Enable the plugin by adding this line to the 'setup()' method in your 'config/ProjectConfiguration.class.php' file :

    $this->enablePlugins('uapvHelpPlugin');
    
  3. In your setting.yml :

    • Enable the uapvHelpPage module :

      enabled_modules: [default, uapvHelpPage]
      
    • Add 'AutoHelp' to the standard_helpers to avoid writing "use_helper('AutoHelp')" everywhere

      standard_helpers: [Partial, Cache, AutoHelp]
      
  4. Use this helper in your layout.php :

    <?php echo help_link () ?>
    

How to use ?

  1. Create a 'doc' directory in the application you want to document, for example 'apps/frontend/doc'

  2. Create a 'fr' directory to add a french documentation, for example 'apps/frontend/doc/fr'

  3. To document the index action, create the file 'app/frontend/modules/myModule/doc/fr/index.mkd'

Advanced use

Enabling a fall back documentation

If you want to display a documentation link on the page even if there is no specific help for the requested module/action, create the file 'apps/frontend/doc/fr/index.mkd'.

Adding links to other documentation pages in your markdown files

Use this helper function in your markdown files to add a link to the 'list' action of the 'pages' module :

Hey, have a look <?php echo link_to_help ('here for more details', 'pages/list'); ?>o

You can also link to the user documentation from your Symfony views :

<?php echo link_to_help ('Follow this link to learn more about this feature', 'pages/list') ?>

Specifying the default language

uapvHelpPlugin will use the 'Accept-Language' request header to find the correct documentation page to use for your visitors. However, if this page does not exist or if there is no 'Accept-Language' header, uapvHelpPlugin will use the 'default_culture' parameter defined in your 'i18n.yml' configuration. Make sure it is correct.

Linking to a specific documentation anchor

To add an anchor in your documentation follow the syntax described here :

Example :

Header 1            {#my_anchor_id}
========

Then use this link helper :

<?php echo link_to_help ('pages/list#my_anchor_id') ?>

Adding a header and footer on every page

Add a file named "_header.mkd" or "_footer.mkd" in your doc/[lang]/ directory. This file can use markdown syntax.

Redirecting a user to an external documentation

If some or all of your document are already stored somewhere else, you will need can add exceptions by editing your app.yml

all:
  help:
    external:
      ";account/*/edit;" : http://dosi.univ-avignon.fr/foobar
      ";admin/.*;" : https://github.com/UAPV/uapvHelpPlugin/blob/master/README.mkd
      ";.*;" : http://dosi.univ-avignon.fr

The 'app_help_external' parameter is an array of URL corresponding to patterns (compatibles with 'preg_match()'). This patterns will be compared with the current PATH_INFO url. If there is the match and if the user tries to open the help for the current page, he will be redirected to the url associated to the pattern.

Adding documentation assets

You may need to add images or link static files on your documentation. To do this, place all your files along with your markdown documentation and run :

symfony doc:publish-assets // __NOT IMPLEMENTED YET__

Then use the help_public_path() or help_image_tag() helper to display images in your documentation. For example, if you have 'image.png' in the same directory as your markdown documentation use a relative URL.

![my image](<?php echo help_public_path ('image.png') ?>)
// equivalent to
<?php echo help_image_tag('image.png') ?>

You can also use absolute URL, ex: /user/create_form.png

Creating a documentation index

??

Future improvements

  • documentation search form
  • documentation index
  • automatic cache invalidation

uapvhelpplugin's People

Contributors

arnaudd avatar

Stargazers

 avatar

Watchers

James Cloos avatar

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.