Skip to content

Commit

Permalink
📖
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Jun 22, 2024
1 parent 08886c3 commit 22869ae
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
1 change: 1 addition & 0 deletions .phpdoc/template/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"social": [
{ "iconClass": "fab fa-github", "url": "https://github.com/chillerlan/php-qrcode"},
{ "iconClass": "fas fa-envelope-open-text", "url": "https://github.com/chillerlan/php-qrcode/discussions"},
]
}
%}
4 changes: 3 additions & 1 deletion docs/Built-In-Output/QRMarkupXML.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ Render the output:
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data); // -> XML, rendered as SVG

printf('<img alt="%s" src="%s" />', $alt, $out);
header('Content-type: application/xml');

echo $out;
```

The associated [XML schema](https://www.w3.org/XML/Schema) can be found over at GitHub: [`qrcode.schema.xsd`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/qrcode.schema.xsd)
Expand Down
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. php-qrcode documentation master file, created by sphinx-quickstart on Sun Jul 9 21:45:56 2023.
markdown-rst converter: https://pandoc.org/try/
=================
PHP-QRCode Manual
=================
============================
chillerlan PHP-QRCode Manual
============================

User manual for `chillerlan/php-qrcode <https://github.com/chillerlan/php-qrcode/>`__ [|version|]. Updated on |today|.

Expand Down
35 changes: 32 additions & 3 deletions docs/qroptions-doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
array_shift($lines);
array_pop($lines);

$see = [];
$see = [];
$link = [];

foreach($lines as $line){

Expand All @@ -50,7 +51,14 @@

// collect links for "see also"
if(str_starts_with($line, '@see')){
$see[] = $line;
$see[] = substr($line, 5); // cut off the "@see "

continue;
}

// collect links for "links"
if(str_starts_with($line, '@link')){
$link[] = substr($line, 6); // cut off the "@link "

continue;
}
Expand All @@ -63,7 +71,6 @@
$content[] = "\n**See also:**\n";

foreach($see as $line){
$line = substr($line, 5); // cut off the "@see "

// normal links
if(str_starts_with($line, 'http')){
Expand All @@ -88,6 +95,28 @@

}

// add "Links" section
if(!empty($link)){
$content[] = "\n**Links:**\n";

foreach($link as $line){

// skip non-url
if(!str_starts_with($line, 'http')){
continue;
}

$url = explode(' ', $line, 2);

$content[] = match(count($url)){
1 => sprintf('- [%s](%s)', explode('://', $url[0])[1], $url[0]),
2 => sprintf('- [%s](%s)', trim($url[1]), $url[0]),
};

}

}

$content[] = "\n";
}

Expand Down

0 comments on commit 22869ae

Please sign in to comment.