Skip to content

Commit 22869ae

Browse files
committed
📖
1 parent 08886c3 commit 22869ae

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

.phpdoc/template/base.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
],
88
"social": [
99
{ "iconClass": "fab fa-github", "url": "https://github.com/chillerlan/php-qrcode"},
10+
{ "iconClass": "fas fa-envelope-open-text", "url": "https://github.com/chillerlan/php-qrcode/discussions"},
1011
]
1112
}
1213
%}

docs/Built-In-Output/QRMarkupXML.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ Render the output:
8080
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
8181
$out = (new QRCode($options))->render($data); // -> XML, rendered as SVG
8282

83-
printf('<img alt="%s" src="%s" />', $alt, $out);
83+
header('Content-type: application/xml');
84+
85+
echo $out;
8486
```
8587

8688
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)

docs/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.. php-qrcode documentation master file, created by sphinx-quickstart on Sun Jul 9 21:45:56 2023.
22
markdown-rst converter: https://pandoc.org/try/
33
4-
=================
5-
PHP-QRCode Manual
6-
=================
4+
============================
5+
chillerlan PHP-QRCode Manual
6+
============================
77

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

docs/qroptions-doc.php

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
array_shift($lines);
3636
array_pop($lines);
3737

38-
$see = [];
38+
$see = [];
39+
$link = [];
3940

4041
foreach($lines as $line){
4142

@@ -50,7 +51,14 @@
5051

5152
// collect links for "see also"
5253
if(str_starts_with($line, '@see')){
53-
$see[] = $line;
54+
$see[] = substr($line, 5); // cut off the "@see "
55+
56+
continue;
57+
}
58+
59+
// collect links for "links"
60+
if(str_starts_with($line, '@link')){
61+
$link[] = substr($line, 6); // cut off the "@link "
5462

5563
continue;
5664
}
@@ -63,7 +71,6 @@
6371
$content[] = "\n**See also:**\n";
6472

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

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

8996
}
9097

98+
// add "Links" section
99+
if(!empty($link)){
100+
$content[] = "\n**Links:**\n";
101+
102+
foreach($link as $line){
103+
104+
// skip non-url
105+
if(!str_starts_with($line, 'http')){
106+
continue;
107+
}
108+
109+
$url = explode(' ', $line, 2);
110+
111+
$content[] = match(count($url)){
112+
1 => sprintf('- [%s](%s)', explode('://', $url[0])[1], $url[0]),
113+
2 => sprintf('- [%s](%s)', trim($url[1]), $url[0]),
114+
};
115+
116+
}
117+
118+
}
119+
91120
$content[] = "\n";
92121
}
93122

0 commit comments

Comments
 (0)