forked from paulrobertlloyd/barebones
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_patterns.php
executable file
·99 lines (93 loc) · 2.54 KB
/
_patterns.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html><html lang="en-gb">
<head>
<title>Pattern Primer - Barebones</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="_css/styles.css" type="text/css"/>
<style>
.pattern {
margin-top:4em;
}
details.primer {
margin-top:2.5em;
background-color:#e9e9e9;
border-bottom:4px solid #e9e9e9;
position:relative;
}
details.primer summary {
font-size:1.5em;
line-height:1;
text-shadow:0 1px 0 #fff;
background-color:#e9e9e9;
border-radius:0.25em 0 0 0;
padding:0.25em;
overflow:hidden;
position:absolute;
right:0;
top:-1.5em;
}
details.primer summary::-webkit-details-marker {
display:none;
}
details.primer section {
padding:1.5%;
overflow:hidden;
}
details.primer p.caption {
margin-left:0;
margin-bottom:0;
}
@media screen and (min-width:40em) {
details.primer textarea {
width:58%;
float:left;
}
details.primer p.caption {
width:38%;
float:right;
}
}
</style>
</head>
<body>
<main role="main">
<div class="container">
<header>
<nav role="navigation" class="breadcrumb-nav">
<a href="../">Barebones</a> /
</nav><!--/.breadcrumb-nav-->
<h1>Pattern Primer</h1>
<p class="lede">Common snippets of markup</p>
</header>
<?php
$files = array();
$patterns_dir = "_patterns";
$handle = opendir($patterns_dir);
while (false !== ($file = readdir($handle))):
if(stristr($file,'.html')):
$files[] = $file;
endif;
endwhile;
sort($files);
foreach ($files as $file):
echo '<section class="pattern">';
include($patterns_dir.'/'.$file);
echo '<details class="primer">';
echo '<summary title="Show markup and usage">•••</summary>';
echo '<section>';
echo '<textarea rows="10" cols="30" class="input code">'.htmlspecialchars(file_get_contents($patterns_dir.'/'.$file)).'</textarea>';
echo '<p class="caption"><strong>Usage:</strong> '.htmlspecialchars(@file_get_contents($patterns_dir.'/'.str_replace('.html','.txt',$file))).'</p>';
echo '</section>';
echo '</details><!--/.primer-->';
echo '</section><!--/.pattern-->';
endforeach;
?>
</div><!--/container-->
</main><!--@main-->
<footer role="contentinfo">
<div class="container">
<p><small>Copyright © 2013 <a href="http://paulrobertlloyd.com">Paul Robert Lloyd</a>. Code covered by the <a rel="license" href="http://paulrobertlloyd.mit-license.org/">MIT license</a>.</small></p>
</div><!--/container-->
</footer><!--/@contentinfo-->
</body>
</html>