Skip to content

Commit

Permalink
Docs update.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivopetkov committed Feb 11, 2019
1 parent 5228fbb commit d200b0f
Show file tree
Hide file tree
Showing 30 changed files with 236 additions and 129 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"require-dev": {
"phpunit/phpunit": "6.*",
"ivopetkov/docs-generator": "0.1.*"
"ivopetkov/docs-generator": "0.2.*"
},
"autoload": {
"files": ["autoload.php"]
Expand Down
9 changes: 7 additions & 2 deletions docs-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@

require __DIR__ . '/vendor/autoload.php';

$docsGenerator = new IvoPetkov\DocsGenerator(__DIR__, ['/src']);
$docsGenerator->generateMarkdown(__DIR__ . '/docs/markdown');
$docsGenerator = new IvoPetkov\DocsGenerator(__DIR__);
$docsGenerator->addSourceDir('/src');
$options = [
'showProtected' => false,
'showPrivate' => false
];
$docsGenerator->generateMarkdown(__DIR__ . '/docs/markdown', $options);
10 changes: 5 additions & 5 deletions docs/markdown/ivopetkov.html5domdocument.__construct.method.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ public __construct ( [ string $version [, string $encoding ]] )

## Parameters

      `$version`
##### version

            The version number of the document as part of the XML declaration.
      The version number of the document as part of the XML declaration.

      `$encoding`
##### encoding

            The encoding of the document as part of the XML declaration.
      The encoding of the document as part of the XML declaration.

## Details

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
77 changes: 60 additions & 17 deletions docs/markdown/ivopetkov.html5domdocument.class.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,64 @@
# IvoPetkov\HTML5DOMDocument

extends [DOMDocument](http://php.net/manual/en/class.domdocument.php)

Represents a live (can be manipulated) representation of a HTML5 document.

```php
IvoPetkov\HTML5DOMDocument extends DOMDocument {

/* Constants */
const int ALLOW_DUPLICATE_IDS
const int FIX_DUPLICATE_METATAGS
const int FIX_MULTIPLE_BODIES
const int FIX_MULTIPLE_HEADS
const int FIX_MULTIPLE_TITLES
const int OPTIMIZE_HEAD

/* Methods */
public __construct ( [ string $version [, string $encoding ]] )
public DOMElement createInsertTarget ( string $name )
public void insertHTML ( string $source [, string $target = 'beforeBodyEnd' ] )
public void insertHTMLMulti ( array $sources )
public bool loadHTML ( string $source [, int $options = 0 ] )
public void loadHTMLFile ( string $filename [, int $options = 0 ] )
public void modify ( [ int $modifications = 0 ] )
public DOMElement|null querySelector ( string $selector )
public DOMNodeList querySelectorAll ( string $selector )
public string saveHTML ( [ DOMNode $node ] )
public int saveHTMLFile ( string $filename )

}
```

## Extends

##### [DOMDocument](http://php.net/manual/en/class.domdocument.php)

## Constants

##### const int ALLOW_DUPLICATE_IDS

      An option passed to loadHTML() and loadHTMLFile() to disable duplicate element IDs exception.

##### const int FIX_DUPLICATE_METATAGS

      A modification (passed to modify()) that removes all but the last metatags with matching name or property attributes.

##### const int FIX_MULTIPLE_BODIES

      A modification (passed to modify()) that merges multiple body elements.

##### const int FIX_MULTIPLE_HEADS

      A modification (passed to modify()) that merges multiple head elements.

##### const int FIX_MULTIPLE_TITLES

      A modification (passed to modify()) that removes all but the last title elements.

##### const int OPTIMIZE_HEAD

      A modification (passed to modify()) that moves charset metatag and title elements first.

## Methods

##### public [__construct](ivopetkov.html5domdocument.__construct.method.md) ( [ string $version [, string $encoding ]] )
Expand All @@ -14,8 +69,6 @@ Represents a live (can be manipulated) representation of a HTML5 document.

      Creates an element that will be replaced by the new body in insertHTML.

      Returns: A new DOMElement that must be set in the place where the new body will be inserted.

##### public void [insertHTML](ivopetkov.html5domdocument.inserthtml.method.md) ( string $source [, string $target = 'beforeBodyEnd' ] )

      Inserts a HTML document into the current document. The elements from the head and the body will be moved to their proper locations.
Expand All @@ -28,8 +81,6 @@ Represents a live (can be manipulated) representation of a HTML5 document.

      Load HTML from a string.

      Returns: TRUE on success or FALSE on failure.

##### public void [loadHTMLFile](ivopetkov.html5domdocument.loadhtmlfile.method.md) ( string $filename [, int $options = 0 ] )

      Load HTML from a file.
Expand All @@ -42,27 +93,19 @@ Represents a live (can be manipulated) representation of a HTML5 document.

      Returns the first document element matching the selector.

      Returns: The result DOMElement or null if not found.

##### public [DOMNodeList](http://php.net/manual/en/class.domnodelist.php) [querySelectorAll](ivopetkov.html5domdocument.queryselectorall.method.md) ( string $selector )

      Returns a list of document elements matching the selector.

      Returns: Returns a list of DOMElements matching the criteria.

##### public string [saveHTML](ivopetkov.html5domdocument.savehtml.method.md) ( [ [DOMNode](http://php.net/manual/en/class.domnode.php) $node ] )

      Dumps the internal document into a string using HTML formatting.

      Returns: The document (or node) HTML code as string.

##### public int [saveHTMLFile](ivopetkov.html5domdocument.savehtmlfile.method.md) ( string $filename )

      Dumps the internal document into a file using HTML formatting.

      Returns: the number of bytes written or FALSE if an error occurred.

### Inherited from [DOMDocument](http://php.net/manual/en/class.domdocument.php):
### Inherited from [DOMDocument](http://php.net/manual/en/class.domdocument.php)

##### public void [adoptNode](http://php.net/manual/en/domdocument.adoptnode.php) ( [DOMNode](http://php.net/manual/en/class.domnode.php) $source )

Expand Down Expand Up @@ -120,7 +163,7 @@ Represents a live (can be manipulated) representation of a HTML5 document.

##### public void [xinclude](http://php.net/manual/en/domdocument.xinclude.php) ( [ $options ] )

### Inherited from [DOMNode](http://php.net/manual/en/class.domnode.php):
### Inherited from [DOMNode](http://php.net/manual/en/class.domnode.php)

##### public void [C14N](http://php.net/manual/en/domnode.c14n.php) ( [ $exclusive [, $with_comments [, array $xpath [, array $ns_prefixes ]]]] )

Expand Down Expand Up @@ -168,7 +211,7 @@ Represents a live (can be manipulated) representation of a HTML5 document.

## Details

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public DOMElement createInsertTarget ( string $name )

## Parameters

      `$name`
##### name

            The name of the insert target.
      The name of the insert target.

## Returns

Expand All @@ -20,7 +20,7 @@ public DOMElement createInsertTarget ( string $name )

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
10 changes: 5 additions & 5 deletions docs/markdown/ivopetkov.html5domdocument.inserthtml.method.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ public void insertHTML ( string $source [, string $target = 'beforeBodyEnd' ] )

## Parameters

      `$source`
##### source

            The HTML code to be inserted.
      The HTML code to be inserted.

      `$target`
##### target

            Body target position. Available values: afterBodyBegin, beforeBodyEnd or insertTarget name.
      Body target position. Available values: afterBodyBegin, beforeBodyEnd or insertTarget name.

## Details

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ public void insertHTMLMulti ( array $sources )

## Parameters

      `$sources`
##### sources

            An array containing the source of the document to be inserted in the following format: [ ['source'=>'', 'target'=>''], ['source'=>'', 'target'=>''], ... ]
      An array containing the source of the document to be inserted in the following format: [ ['source'=>'', 'target'=>''], ['source'=>'', 'target'=>''], ... ]

## Details

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
10 changes: 5 additions & 5 deletions docs/markdown/ivopetkov.html5domdocument.loadhtml.method.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ public bool loadHTML ( string $source [, int $options = 0 ] )

## Parameters

      `$source`
##### source

            The HTML code.
      The HTML code.

      `$options`
##### options

            Additional Libxml parameters.
      Additional Libxml parameters.

## Returns

Expand All @@ -24,7 +24,7 @@ public bool loadHTML ( string $source [, int $options = 0 ] )

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
10 changes: 5 additions & 5 deletions docs/markdown/ivopetkov.html5domdocument.loadhtmlfile.method.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ public void loadHTMLFile ( string $filename [, int $options = 0 ] )

## Parameters

      `$filename`
##### filename

            The path to the HTML file.
      The path to the HTML file.

      `$options`
##### options

            Additional Libxml parameters.
      Additional Libxml parameters.

## Details

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
6 changes: 3 additions & 3 deletions docs/markdown/ivopetkov.html5domdocument.modify.method.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public void modify ( [ int $modifications = 0 ] )

## Parameters

      `$modifications`
##### modifications

            The modifications to apply. Available values:
      The modifications to apply. Available values:
- HTML5DOMDocument::FIX_MULTIPLE_TITLES - removes all but the last title elements.
- HTML5DOMDocument::FIX_DUPLICATE_METATAGS - removes all but the last metatags with matching name or property attributes.
- HTML5DOMDocument::FIX_MULTIPLE_HEADS - merges multiple head elements.
Expand All @@ -21,7 +21,7 @@ public void modify ( [ int $modifications = 0 ] )

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public DOMElement|null querySelector ( string $selector )

## Parameters

      `$selector`
##### selector

            A CSS query selector. Available values: *, tagname, tagname#id, #id, tagname.classname, .classname, tagname.classname.classname2, .classname.classname2, tagname[attribute-selector], [attribute-selector], "div, p", div p, div > p, div + p and p ~ ul.
      A CSS query selector. Available values: *, tagname, tagname#id, #id, tagname.classname, .classname, tagname.classname.classname2, .classname.classname2, tagname[attribute-selector], [attribute-selector], "div, p", div p, div > p, div + p and p ~ ul.

## Returns

Expand All @@ -20,7 +20,7 @@ public DOMElement|null querySelector ( string $selector )

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public DOMNodeList querySelectorAll ( string $selector )

## Parameters

      `$selector`
##### selector

            A CSS query selector. Available values: *, tagname, tagname#id, #id, tagname.classname, .classname, tagname.classname.classname2, .classname.classname2, tagname[attribute-selector], [attribute-selector], "div, p", div p, div > p, div + p and p ~ ul.
      A CSS query selector. Available values: *, tagname, tagname#id, #id, tagname.classname, .classname, tagname.classname.classname2, .classname.classname2, tagname[attribute-selector], [attribute-selector], "div, p", div p, div > p, div + p and p ~ ul.

## Returns

Expand All @@ -20,7 +20,7 @@ public DOMNodeList querySelectorAll ( string $selector )

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
6 changes: 3 additions & 3 deletions docs/markdown/ivopetkov.html5domdocument.savehtml.method.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public string saveHTML ( [ DOMNode $node ] )

## Parameters

      `$node`
##### node

            Optional parameter to output a subset of the document.
      Optional parameter to output a subset of the document.

## Returns

Expand All @@ -20,7 +20,7 @@ public string saveHTML ( [ DOMNode $node ] )

Class: [IvoPetkov\HTML5DOMDocument](ivopetkov.html5domdocument.class.md)

File: /src/HTML5DOMDocument.php
Location: ~/src/HTML5DOMDocument.php

---

Expand Down
Loading

0 comments on commit d200b0f

Please sign in to comment.