meta_YAML plugin

meta_yaml plugin by Ikuo Obataya
Sets and displays DokuWiki meta data, and modifies metaheaders

Last updated on 2009-06-28. Provides Syntax, Action.
Compatible with DokuWiki 2009-02-14b, PHP5.2.3 or later.

Similar to description, meta, metaheaders.

Tagged with !experimental, meta.

    Download and Installation

    Download and install the plugin using the Plugin Manager using the following URL. Refer to Plugins on how to install plugins manually.

    web page: http://www.symplus.com/legacy/wiki/en/meta_yaml_plugin

    :!: This plugin requires PHP 5.2.3 or later
    :!: This plugin is still experimental. Use this in your test-environment at first.

    Introduction

    This plugin sets and shows DokuWiki meta data by using YAML text. It can also modify the meta headers such as 'description' or 'keywords' of a specific page. This plugin may be attractive for DokuWiki administrators, template designers and plugin developers.

    There was a similar plugin, 'meta plugin'. But the functionality was limited and it didn't support array data. Since array data is essential for meta data, this plugin applies a YAML format for a syntax of meta data.

    What it can do

    • Set named meta data as a single value or an array by using YAML.
    • Execute some command (list, print_r) to show meta data in the page.
    • Append to or replace meta-header (description, keywords, robots etc.) by meta data defined the page.

    Why YAML ?

    YAML - Official site

    • Readable by human being as well as machine easily. (line/white-space delimitters)
    • Able to describe a named value, sequential array and key-value data sets.
    • Very simple syntax.
    • Great codes are available from Symfony framework developed by Fabien Potencier.

    :!: What should be concerned about YAML

    • YAML class from Symfony framework needs PHP 5.2.3 or later

    Examples

    You can describe any kind of meta data with YAML between <meta_yaml> and </meta_yaml>.

    You can display YAML-formatted meta data of the page by using 'list' or 'print_r' command.

    Set meta data

    <meta_yaml>
    # Hashed data (block)
    Sites:
      Site1: http://www.google.com/
      Site2: http://www.yahoo.com/
    
    # Hashed data (inline)
    Sites: { Site1: http://www.google.com/, Site2: http://www.yahoo.com/ }
    
    # Collection (block)
    SiteNames:
      - Google
      - Yahoo
    
    # Collection (inline)
    SiteNames: [Google,Yahoo]
    
    # Show those data in the page as print_r format
    command:
      - { print_r:Sites }
      - { print_r:SiteNames }
    </meta_yaml>
    

    After save the page, you can see meta data that you set above.

    -----------------------
    Meta YAML plugin output
    -----------------------
    -------------
    print_r Sites
    -------------
    Array
    (
        [Site1] => http://www.google.com/
        [Site2] => http://www.yahoo.com/
    )
    -----------------
    print_r SiteNames
    -----------------
    Array
    (
        [0] => Google
        [1] => Yahoo
    )
    ---------------
    

    Commands

    list

    The 'list' command shows specific/all meta data with YAML format.

    <meta_yaml>
    command:
      - { list:description }
      - { list:all }
    </meta_yaml>
    

    The array of meta data will be shown by YAML format. You can see that YAML format is human-friendly format.

    ----------------
    list description
    ----------------
    tableofcontents:
      - { hid: meta-yaml_plugin, title: 'meta-YAML plugin', type: ul, level: 1 }
      - { hid: introduction, title: Introduction, type: ul, level: 2 }
      - { hid: what_it_can_do, title: 'What it can do', type: ul, level: 1 }
      - { hid: why_yaml, title: 'Why YAML ?', type: ul, level: 2 }
    ...
    

    print_r

    The 'print_r' command is similar to the list command, it shows meta data with print_r format instead.

    <meta_yaml>
    command:
      - { print_r:description }
      - { print_r:all }
    </meta_yaml>
    

    The array of meta data will be shown by print_r format of PHP.

    -------------------
    print_r description
    -------------------
    Array
    (
        [tableofcontents] => Array
            (
                [0] => Array
                    (
                        [hid] => meta-yaml_plugin
                        [title] => meta-YAML plugin
                        [type] => ul
                        [level] => 1
                    )
    
                [1] => Array
                    (...
    

    Metaheaders

    You can replace or append some data to meta-header such as 'description', 'keywords', etc. Set key-value sets in a 'meta-headers' array.

    If you use '%abstract%' or '%keywords%', they are replaced by a first section or tags from Tag plugin.

    <meta_yaml>
    # Abstract for the page
    meta-headers:
      description: This is an instruction page for the meta_yaml plugin.
    </meta_yaml>
    
    <meta_yaml>
    # Using first section as an abstract of the page
    meta-headers:
      description: %abstract%
    
    # Tag plugin put the tags in 'keywords' meta-header. You can append some keywords to tags.
    meta-headers:
      keywords: %subject%,plugin,instruction
    </meta_yaml>
    

    TODO

    • Inheritable meta data for namespaces
    • Some plugins using this plugin
      • Self-declaration of language of page contents/user interface.
      • Template switcher by meta data of a specific namespace or page.
    • Some commands
      • Auto-increment command for page-view count
    • YAMLize all meta file from core?

    Discussion

    the download url is no longer available.

    seems to be now: http://wiki.symplus.com/en/meta_yaml_plugin

     
    plugin/meta_yaml.txt · Last modified: 2010/03/17 13:42 by 92.195.198.191
     
    Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
    Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
    WikiForumIRCBugsGitXRefTranslate