Github user riknoll commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/474#discussion_r51338367
  
    --- Diff: www/docs/en/dev/plugin_ref/spec.md ---
    @@ -17,700 +17,489 @@ license: >
         specific language governing permissions and limitations
         under the License.
     
    -title: Plugin Specification
    +title: Plugin.xml
     ---
     
    -# Plugin Specification
    -
    -The `plugin.xml` file is an XML document in the `plugins` namespace:
    -`http://apache.org/cordova/ns/plugins/1.0`. It contains a top-level
    -`plugin` element that defines the plugin, and children that define the
    -structure of the plugin.
    -
    -A sample plugin element:
    +# Plugin.xml
     
    -    <?xml version="1.0" encoding="UTF-8"?>
    -    <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0";
    -        xmlns:android="http://schemas.android.com/apk/res/android";
    -        id="com.alunny.foo"
    -        version="1.0.2">
    +Plugin.xml file defines the structure and settings required for your 
plugin. It has several elements to provide details about your plugin.
     
    -## _plugin_ Element
    +## plugin
     
    -The `plugin` element is the plugin manifest's top-level element. It
    -features the following attributes:
    +  The `plugin` element is the plugin manifest's top-level element.
     
    -* `xmlns` (required):
    -  The plugin namespace, `http://apache.org/cordova/ns/plugins/1.0`. If
    -  the document contains XML from other namespaces, such as tags to be
    -  added to the `AndroidManifest.xml` file, those namespaces should
    -  also be included in the top-level element.
    +  Attributes(type) | Description
    +  ---------------- | ------------
    +  xmlns(string) | *Required* <br/> The plugin namespace, 
`http://apache.org/cordova/ns/plugins/1.0`. If the document contains XML from 
other namespaces, such as tags to be added to the `AndroidManifest.xml` file, 
those namespaces should also be included in the <plugin> element.
    +  id(string) | *Required* <br/> A reverse-domain style identifier for the 
plugin.
    +  version(string) | *Required* <br/> A version number for the plugin, that 
matches the following major-minor-patch style regular expression: 
`^\d+[.]\d+[.]\d+$`
     
    -* `id` (required):
    -  A reverse-domain style identifier for the plugin, such as
    -  `com.alunny.foo`
    +  Example:
    +  ```
    +  <?xml version="1.0" encoding="UTF-8"?>
    +  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0";
    +      xmlns:android="http://schemas.android.com/apk/res/android";
    +      id="com.alunny.foo"
    +      version="1.0.2">
    +  ```
     
    -* `version` (required):
    -  A version number for the plugin, that matches the following
    -  major-minor-patch style regular expression:
    +### engines and engine
     
    -        ^\d+[.]\d+[.]\d+$
    +  The child elements of the `<engines>` element specify versions of Apache 
Cordova-based frameworks that this plugin supports. Plugman aborts with a 
non-zero code for any plugin whose target project does not meet the engine's 
constraints. If no <engine> tags are specified, plugman attempts to install 
into the specified cordova project directory blindly.
     
    -## _engines_ and _engine_ Elements
    +  Attributes(type) | Description
    +  ---------------- | ------------
    +  name(string) | *Required* <br/> Name of the engine. Here are the default 
engines that are supported : <ul><li> `cordova` </li> <li> `cordova-plugman` 
</li> <li> `cordova-android` </li> <li> `cordova-ios` </li> <li> 
`cordova-blackberry10` </li> <li> `cordova-wp8` </li> <li> `cordova-windows` 
</li> <li> `android-sdk` // returns the highest Android api level installed 
</li> <li> `apple-xcode` // returns the xcode version </li> <li> `apple-ios` // 
returns the highest iOS version installed </li> <li> `apple-osx` // returns the 
OSX version </li> <li> `blackberry-ndk` // returns the native blackberry SDK 
version </li> You can also specify a custom framework apart from the default 
ones.
    +  version(string) | *Required* <br/> The version that your framework must 
have in order to install. It should match a major-minor-patch string conforming 
to the regular expression: `^\d+[.]\d+[.]\d+$`
    +  scriptSrc(string) | **For custom frameworks only** <br/> *Required* 
<br/>  The script file that tells plugman the version of the custom framework. 
Ideally, this file should be within the top level directory of your plugin 
directory.
    +  platform(string) | **For custom frameworks only** <br/> *Required* <br/> 
The platforms your framework supports. You may use the wildcard `*` to say 
supported for all platforms, specify multiple with a pipe character like 
`android|ios|blackberry10` or just a single platform like `android`.
     
    -The child elements of the `<engines>` element specify versions of
    -Apache Cordova-based frameworks that this plugin supports. An example:
    +  Examples:
    +  ```
    +  <engines>
    +    <engine name="cordova-android" version="=1.8.0" />
    +  </engines>
    +  ```
     
    -    <engines>
    -        <engine name="cordova" version="1.7.0" />
    -        <engine name="cordova" version="1.8.1" />
    -        <engine name="worklight" version="1.0.0" platform="android" 
scriptSrc="worklight_version"/>
    -    </engines>
    +  Engine elements may also specify fuzzy matches using '>', '>=' etc. to 
avoid repetition, and to reduce maintenance when the underlying platform is 
updated.
    +  ```
    +  <engines>
    +    <engine name="cordova-android" version=">=1.8.0" />
    +  </engines>  
    +  ```
     
    -Similar to the `<plugin>` element's `version` attribute, the specified
    -version string should match a major-minor-patch string conforming to
    -the regular expression:
    +  The `<engine>` tags also has default support for all of the main 
platforms Cordova exists on. Specifying the cordova engine tag means that all 
versions of Cordova on any platform must satisfy the engine version attribute. 
You may also list specific platforms and their versions in order to override 
the catch-all cordova engine:
    +  ```
    +  <engines>
    +    <engine name="cordova" version=">=1.7.0" />
    +    <engine name="cordova-android" version=">=1.8.0" />
    +    <engine name="cordova-ios" version=">=1.7.1" />
    +  </engines>
    +  ```
     
    -        ^\d+[.]\d+[.]\d+$
    +  Custom frameworks example:
    +  ```
    +  <engines>
    +    <engine name="my_custom_framework" version="1.0.0" platform="android" 
scriptSrc="path_to_my_custom_framework_version"/>
    +    <engine name="another_framework" version=">0.2.0" 
platform="ios|android" scriptSrc="path_to_another_framework_version"/>
    +    <engine name="even_more_framework" version=">=2.2.0" platform="*" 
scriptSrc="path_to_even_more_framework_version"/>
    +  </engines>
    +  ```
     
    -Engine elements may also specify fuzzy matches to avoid repetition,
    -and to reduce maintenance when the underlying platform is updated.
    -Tools should support a minimum of `>`, `>=`, `<` and `<=`, for
    -example:
    +### name
     
    -    <engines>
    -        <engine name="cordova" version=">=1.7.0" />
    -        <engine name="cordova" version="<1.8.1" />
    -    </engines>
    +  The `name` element is used to specify the name of the plugin. This 
element does not (yet) handle localization.
     
    -The `<engine>` tags also has default support for all of the main platforms 
Cordova exists on. 
    -Specifying the `cordova` engine tag means that all versions of Cordova on 
any platform must
    -satisfy the engine version attribute. You may also list specific platforms 
and their versions
    -in order to override the catch-all `cordova` engine:
    +  Example:
    +  ```
    +  <name>Foo</name>
    +  ```
     
    -    <engines>
    -        <engine name="cordova" version=">=1.7.0" />
    -        <engine name="cordova-android" version=">=1.8.0" />
    -        <engine name="cordova-ios" version=">=1.7.1" />
    -    </engines>
    +### description
     
    -Here's a list of the default engines that the `<engine>` tag supports:
    +  The `description` element is used to specify the description of the 
plugin. This element does not (yet) handle localization.
     
    -* `cordova`
    -* `cordova-plugman`
    -* `cordova-amazon-fireos`
    -* `cordova-android`
    -* `cordova-ios`
    -* `cordova-blackberry10`
    -* `cordova-wp8`
    -* `cordova-windows8`
    -* `android-sdk` // returns the highest Android api level installed
    -* `apple-xcode` // returns the xcode version 
    -* `apple-ios` // returns the highest iOS version installed
    -* `apple-osx` // returns the OSX version
    -* `blackberry-ndk` // returns the native blackberry SDK version
    -        
    -Specifying custom Apache Cordova-based frameworks should be listed under 
the engine tag like so:
    +  Example:
    +  ```
    +  <description>Foo plugin description</description>
    +  ```
     
    -    <engines>
    -        <engine name="my_custom_framework" version="1.0.0" 
platform="android" scriptSrc="path_to_my_custom_framework_version"/>
    -        <engine name="another_framework" version=">0.2.0" 
platform="ios|android" scriptSrc="path_to_another_framework_version"/>
    -        <engine name="even_more_framework" version=">=2.2.0" platform="*" 
scriptSrc="path_to_even_more_framework_version"/>
    -    </engines>
    +### author
     
    -A custom Apache Cordova-based framework requires that an engine element 
includes the following attributes: 
    -`name`, `version`, `scriptSrc`, and `platform`. 
    +  The content of the `author` element contains the name of the plugin 
author.
     
    -* `name` (required): A human-readable name for your custom framework. 
    +  Example:
    +  ```
    +  <author>Foo plugin author</author>
    +  ```
     
    -* `version` (required): The version that your framework must have in order 
to install.
    +### keywords
     
    -* `scriptSrc` (required): The script file that tells plugman what version 
of the custom framework is. 
    -Ideally, this file should be within the top level directory of your plugin 
directory.
    +  The content of the `keywords` element contains comma separated keywords 
to describe the plugin.
     
    -* `platform` (required): Which platforms that your framework supports. You 
may use the wildcard `*`
    -to say supported for all platforms, specify multiple with a pipe character 
like `android|ios|blackberry10` 
    -or just a single platform like `android`.
    +  Example:
    +  ```
    +  <license>foo,bar</license>
    +  ```
     
    -plugman aborts with a non-zero code for any plugin whose target
    -project does not meet the engine's constraints.
    +### license
     
    -If no `<engine>` tags are specified, plugman attempts to install into
    -the specified cordova project directory blindly.
    +  This element is used to specify the license of the plugin.
     
    -## _name_ Element
    +  Example:
    +  ```
    +  <license>Apache 2.0 License</license>
    +  ```
    +
    +### asset
     
    -A human-readable name for the plugin, whose text content contains the
    -name of the plugin. For example:
    +  This element is used to list the files or directories to be copied into 
a Cordova app's www directory. Any `<asset>` elements that are nested within 
`<platform>` elements specify platform-specific web assets.
     
    -    <name>Foo</name>
    +  Attributes(type) | Description
    +  ---------------- | ------------
    +  src(string) | *Required* <br/>  Where the file or directory is located 
in the plugin package, relative to the plugin.xml document. If a file does not 
exist at the specified src location, plugman stops and reverses the 
installation process, issues a notification about the conflict, and exits with 
a non-zero code.
    +  target(string) | *Required* <br/> Where the file or directory should be 
located in the Cordova app, relative to the www directory. If a file already 
exists at the target location, plugman stops and reverses the installation 
process, issues a notification about the conflict, and exits with a non-zero 
code.
     
    -This element does not (yet) handle localization.
    +  Examples: 
    +  ```
    +  <!-- a single file, to be copied in the root directory -->
    +  <asset src="www/foo.js" target="foo.js" />
    +  <!-- a directory, also to be copied in the root directory -->
    +  <asset src="www/foo" target="foo" />
    +  ```
     
    -## _description_ Element
    +  Assets can be targeted to subdirectories as well. This will create the 
js/experimental directory within the www directory, unless already present, and 
copy the new-foo.js file and renames it to foo.js.
    +  ```
    +  <asset src="www/new-foo.js" target="js/experimental/foo.js" />
    +  ```
     
    -A human-readable description for the plugin. The text content of the 
element contains
    -the description of the plugin. An example:
    +### js-module
     
    -    <description>Foo plugin description</description>
    +  Most plugins include one or more JavaScript files.  Each `<js-module>` 
tag corresponds to a JavaScript file, and prevents the plugin's users from 
having to add a `<script>` tag for each file. Do not wrap the file with 
cordova.define, as it is added automatically. The module is wrapped in a 
closure, with module, exports, and require in scope, as is normal for AMD 
modules. Nesting `<js-module>` elements within `<platform>` declares 
platform-specific JavaScript module bindings.
     
    -This element does not (yet) handle localization.
    +  Attributes(type) | Description
    +  ---------------- | ------------
    +  src(string) | References a file in the plugin directory relative to the 
plugin.xml file. If src does not resolve to an existing file, plugman stops and 
reverses the installation, issues a notification of the problem, and exits with 
a non-zero code.
    +  name(string) | Provides the last part of the module name. It can 
generally be whatever you like, and it only matters if you want to use 
cordova.require to import other parts of your plugins in your JavaScript code. 
The module name for a `<js-module>` is your plugin's id followed by the value 
of name.
     
    -## _author_ Element
    +  Example:
     
    -Plugin author name. The text content of the element contains
    -the name of the plugin author. An example:
    +  When installing a plugin with the example below, socket.js is copied to 
`www/plugins/my.plugin.id/socket.js`, and added as an entry to 
`www/cordova_plugins.js`. At load time, code in cordova.js uses XHR to read 
each file and inject a `<script>` tag into HTML.
    --- End diff --
    
    my-plugin-id


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to