Development with Code Generation: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
No edit summary
Line 9: Line 9:
* Plugin writers for different output (Winforms, GTK, ASP.net)
* Plugin writers for different output (Winforms, GTK, ASP.net)
* See detailed documentation for developers: [[Developing the Forms generator]]
* See detailed documentation for developers: [[Developing the Forms generator]]
== YAML ==
== YAML ==
YAML is a text file format that is shorter and easier to write and read than XML, but you can get the same structure than XML. This is achieved by not having opening and closing tags, but by using identation to define the hierarchy of elements. It is more friedly to read than XML, since it is less technical (no markup!).
YAML is a text file format that is shorter and easier to write and read than XML, but you can get the same structure than XML. This is achieved by not having opening and closing tags, but by using identation to define the hierarchy of elements. It is more friedly to read than XML, since it is less technical (no markup!).
Line 20: Line 21:
*** yml2xml maps the YAML into XML
*** yml2xml maps the YAML into XML


The idea for generating forms from yaml files has been taken eg. from this page: http://www.symfony-project.org/book/1_0/14-Generators
===YAML Syntax Highlighting in Notepad++ Editor===
The Notepad++ Editor has built-in support for syntax highlighting of YAML files. However, it switches this feature on only if a YAML file has the file extension '.yml', but in openPETRA we use the file extension '.yaml' and so the syntax highlighting is not on by default for openPETRA YAML files.
See [[Setup of Development Environment for Windows#Optional_Software|this wiki page section]] for instructions to turn syntax highlighting for openPETRA YAML files on.


The idea for generating forms from yaml files has been taken eg. from this page: http://www.symfony-project.org/book/1_0/14-Generators


==openPETRA YAML syntax==
==openPETRA YAML syntax==
Line 34: Line 40:
* screen definition files (see [[Documentation_YAML_for_OpenPetra_Forms]])
* screen definition files (see [[Documentation_YAML_for_OpenPetra_Forms]])
  nant generateORMCachedTables
  nant generateORMCachedTables


= Documentation YML for OpenPetra Forms =
= Documentation YML for OpenPetra Forms =
see also [[Documentation GUI generation with YAML]] and [[Documentation YAML for OpenPetra Forms]] for details
see also [[Documentation GUI generation with YAML]] and [[Documentation YAML for OpenPetra Forms]] for details

Revision as of 14:41, 17 December 2010

Tools

  • In csharp/ICT/PetraTools
  • uses CSParser to parse existing C# files
  • write code:
    • can comment generated code
    • can insert regions with name ManualCode (need endregion ManualCode as well)
  • TODO: write into Templates
  • Plugin writers for different output (Winforms, GTK, ASP.net)
  • See detailed documentation for developers: Developing the Forms generator

YAML

YAML is a text file format that is shorter and easier to write and read than XML, but you can get the same structure than XML. This is achieved by not having opening and closing tags, but by using identation to define the hierarchy of elements. It is more friedly to read than XML, since it is less technical (no markup!).

  • Overview
  • Official specification
  • Parsers
    • see a parser for YAML: http://yaml-net-parser.sourceforge.net/default.html
    • For openPETRA we have developed our own converter from yaml to xml: project Ict.Tools.CodeGeneration, Yml2Xml.cs, Ict.Tools.CodeGeneration.Yml2Xml
      • Advantage: we can write short yaml code, but can use the comfort of the XML parser in .Net to walk through the hierarchy
      • yml2xml maps the YAML into XML

The idea for generating forms from yaml files has been taken eg. from this page: http://www.symfony-project.org/book/1_0/14-Generators

YAML Syntax Highlighting in Notepad++ Editor

The Notepad++ Editor has built-in support for syntax highlighting of YAML files. However, it switches this feature on only if a YAML file has the file extension '.yml', but in openPETRA we use the file extension '.yaml' and so the syntax highlighting is not on by default for openPETRA YAML files.

See this wiki page section for instructions to turn syntax highlighting for openPETRA YAML files on.


openPETRA YAML syntax

Specific syntax is used in openPETRA for

  • defining the hierarchy of Namespaces
(csharp\ICT\Petra\Definitions\NamespaceHierarchy.yml)
  • defining the navigation menu hierarchy
(csharp\ICT\Petra\Definitions\UINavigation.yml)
nant generateORMCachedTables


Documentation YML for OpenPetra Forms

see also Documentation GUI generation with YAML and Documentation YAML for OpenPetra Forms for details