Merge branch 'redesign'

This commit is contained in:
Mikaël Bouillot 2017-05-25 10:53:10 +02:00
commit a078f2ee3f
15 changed files with 1620 additions and 342 deletions

BIN
http/fonts/lxr.eot Normal file

Binary file not shown.

25
http/fonts/lxr.svg Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by Fontastic.me</metadata>
<defs>
<font id="lxr" horiz-adv-x="512">
<font-face font-family="lxr" units-per-em="512" ascent="480" descent="-32"/>
<missing-glyph horiz-adv-x="512" />
<glyph glyph-name="blob" unicode="&#98;" d="M277 256l0 117 118-117m-267 149c-24 0-43-19-43-42l0-342c0-23 20-42 43-42l256 0c23 0 43 19 43 42l0 256-128 128z"/>
<glyph glyph-name="tree" unicode="&#100;" d="M213 363l-128 0c-23 0-42-19-42-43l0-256c0-23 19-43 42-43l342 0c23 0 42 20 42 43l0 213c0 24-19 43-42 43l-171 0z"/>
<glyph glyph-name="back" unicode="&#104;" d="M213 256l0 85-149-149 149-149 0 87c107 0 182-34 235-109-21 107-85 214-235 235z"/>
<glyph glyph-name="search" unicode="&#109;" d="M203 384c76 0 138-62 138-139 0-34-12-66-33-90l6-6 17 0 106-106-32-32-106 106 0 17-6 6c-24-21-56-33-90-33-77 0-139 62-139 138 0 77 62 139 139 139m0-43c-54 0-96-42-96-96 0-53 42-96 96-96 53 0 96 43 96 96 0 54-43 96-96 96z"/>
<glyph glyph-name="rss" unicode="&#103;" d="M107 384l298 0c24 0 43-19 43-43l0-298c0-24-19-43-43-43l-298 0c-24 0-43 19-43 43l0 298c0 24 19 43 43 43m53-256c-18 0-32-14-32-32 0-18 14-32 32-32 18 0 32 14 32 32 0 18-14 32-32 32m-32 107l0-43c71 0 128-57 128-128l43 0c0 94-77 171-171 171m0 85l0-43c118 0 213-95 213-213l43 0c0 141-115 256-256 256z"/>
<glyph glyph-name="github" unicode="&#97;" d="M85 405l342 0c23 0 42-19 42-42l0-342c0-23-19-42-42-42l-110 0c-8 1-8 16-8 21l0 58c0 20-7 33-14 40 47 5 97 23 97 105 0 23-8 42-22 57 2 6 10 28-2 57 0 0-18 6-59-22-17 5-35 7-53 7-18 0-36-2-53-7-41 28-59 22-59 22-12-29-4-51-2-57-14-15-22-34-22-57 0-82 50-100 97-105-6-6-12-15-13-29-13-5-44-15-63 18 0 0-11 20-32 22 0 0-21 0-2-13 0 0 14-7 24-31 0 0 13-42 72-29l0-36c0-5 0-20-8-21l-110 0c-23 0-42 19-42 42l0 342c0 23 19 42 42 42z"/>
<glyph glyph-name="facebook" unicode="&#101;" d="M405 363l0-64-42 0c-12 0-22-10-22-22l0-42 64 0 0-64-64 0 0-150-64 0 0 150-42 0 0 64 42 0 0 53c0 41 34 75 75 75m75 42l-342 0c-23 0-42-19-42-42l0-342c0-23 19-42 42-42l342 0c23 0 42 19 42 42l0 342c0 23-19 42-42 42z"/>
<glyph glyph-name="googleplus" unicode="&#102;" d="M405 192l-42 0 0-43-22 0 0 43-42 0 0 21 42 0 0 43 22 0 0-43 42 0m-212-175c-59 0-86 34-86 65 0 9 3 34 32 51 16 10 39 17 66 19-4 5-7 12-7 21 0 3 0 7 1 10l-8 0c-42 0-67 33-67 65 0 37 27 77 87 77l90 0-22-23-2-1-15 0c9-9 20-23 20-46 0-30-16-45-34-58-3-3-9-9-9-15 0-7 5-11 9-14 2-2 6-5 10-8 17-11 41-28 41-61 0-37-28-82-106-82m234 367l-342 0c-23 0-42-19-42-42l0-342c0-23 19-42 42-42l342 0c23 0 42 19 42 42l0 342c0 23-19 42-42 42m-202-252c-2 1-4 1-6 1l-1 0c-5 0-24-1-39-6-13-5-30-16-30-36 0-23 23-48 63-48 33 0 53 21 53 43 0 16-10 25-40 46m14 106c0 22-14 64-44 64-14 0-29-9-29-35 0-26 14-63 42-63 2 0 31 0 31 34z"/>
<glyph glyph-name="twitter" unicode="&#105;" d="M378 249c-2-99-65-166-159-170-39-2-66 10-91 26 29-5 64 7 83 23-28 3-44 17-52 40 8-1 16-1 24 1-25 8-43 24-44 57 7-3 14-6 24-7-19 11-33 50-17 76 28-31 62-56 118-59-14 59 65 92 98 52 14 3 25 8 37 14-5-14-14-24-24-32 11 2 22 5 30 9-5-11-17-22-27-30m49 156l-342 0c-23 0-42-19-42-42l0-342c0-23 19-42 42-42l342 0c23 0 42 19 42 42l0 342c0 23-19 42-42 42z"/>
<glyph glyph-name="linkedin" unicode="&#106;" d="M405 43l-64 0 0 113c0 17-14 32-32 32-17 0-32-15-32-32l0-113-64 0 0 192 64 0 0-26c11 18 34 30 54 30 41 0 74-34 74-75m-266 107c-22 0-39 17-39 38 0 22 17 39 39 39 21 0 38-17 38-39 0-21-17-38-38-38m32-228l-64 0 0 192 64 0m256 170l-342 0c-23 0-42-19-42-42l0-342c0-23 19-42 42-42l342 0c23 0 42 19 42 42l0 342c0 23-19 42-42 42z"/>
<glyph glyph-name="cross" unicode="&#108;" d="M405 311l-30 30-119-119-119 119-30-30 119-119-119-119 30-30 119 119 119-119 30 30-119 119z"/>
<glyph glyph-name="filter" unicode="&#110;" d="M64 405l384 0 0-42-2 0-147-148 0-256-86 86 0 170-147 148-2 0z"/>
<glyph glyph-name="menu" unicode="&#111;" d="M64 320l384 0 0-43-384 0 0 43m0-107l384 0 0-42-384 0 0 42m0-106l384 0 0-43-384 0z"/>
<glyph glyph-name="up" unicode="&#112;" d="M277 21l-42 0 0 256-118-117-30 30 169 169 169-169-30-30-118 117z"/>
<glyph glyph-name="tag" unicode="&#99;" d="M117 299c-17 0-32 14-32 32 0 17 15 32 32 32 18 0 32-15 32-32 0-18-14-32-32-32m340-98l-192 192c-8 8-19 12-30 12l-150 0c-23 0-42-19-42-42l0-150c0-11 4-22 12-30l192-192c8-7 19-12 30-12 12 0 23 5 30 12l150 150c8 7 12 18 12 30 0 12-5 22-12 30z"/>
</font></defs></svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
http/fonts/lxr.ttf Normal file

Binary file not shown.

BIN
http/fonts/lxr.woff Normal file

Binary file not shown.

153
http/header.css Normal file
View file

@ -0,0 +1,153 @@
.wrapper {
margin-top: 200px;
min-height: calc(100vh - 200px);
}
.header {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 200px;
width: auto;
background: #6D7DD2;
background-image: url('/img/2penguins.svg');
background-repeat: no-repeat;
background-size: 300px;
background-position: bottom -82px right;
}
.header {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.header h1 {
font-family: 'Ubuntu Mono', monospace;
font-style: italic;
text-align: center;
font-size: 3.2em;
color: #fff;
margin-bottom: 0;
}
.header h1 a {
color: #fff;
}
.header h2 {
font-family: 'Ubuntu Mono', monospace;
text-align: center;
font-size: 1em;
font-weight: 400;
margin-top: -0.5em;
color: #fff;
color: #ffa264;
}
.header em {
font-style: normal;
font-size: 0.9em;
line-height: 1;
text-align: center;
float: right;
padding: 0.5em 1em;
position: absolute;
bottom: 0;
left: 0;
right: 0;
color: rgba(255,255,255,.7);
background-color: rgba(255,255,255,.1);
}
.header em a {
color: rgba(255,255,255,.9);
}
.header nav {
text-align: center;
position: absolute;
top: 0;
left: 0;
right: 0;
}
.header nav ul {
list-style: none;
}
.nav-links {
padding: 0.5em 1em;
margin: 0;
background-color: rgba(0,0,0,.5);
width: 100%;
font-size: 0.8em;
line-height: 1.7;
}
.nav-links li {
display: inline-block;
margin: 0 0.5em;
}
.nav-links a {
text-transform: uppercase;
color: #9da9ea;
}
.nav-links a:hover {
color: #fff;
}
.social-icons {
position: absolute;
top: 0.05rem;
right: 0.3rem;
padding: 0;
margin: 0;
display: inline-block;
line-height: 2.5rem; /* little hack for firefox vertical align */
}
.social-icons li {
display: inline-block;
font-size: 0;
}
.social-icons a::before {
font-size: 1.65rem;
color: #717fc5;
}
.social-icons a:focus::before,
.social-icons a:hover::before {
color: #fff;
}
/* responsive */
@media (max-width: 748px) {
.header .social-icons {
position: static;
}
.social-icons a::before {
font-size: 1.5rem;
color: #9da9ea;
}
}
@media (max-width: 520px) {
.header h1 {
font-size: 2.5em;
font-size: 8vw;
margin-top: 1.4em;
}
.header h2 {
font-size: 1em;
font-size: 3vw;
}
}
@media (max-width: 330px) {
.header h1 {
margin-top: 1.8em;
}
}

19
http/img/2penguins.svg Normal file
View file

@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 520.3 475.9" version="1">
<g opacity=".2">
<g transform="translate(-57.384 -224.84)">
<ellipse cx="383.4" cy="268" fill="#6d7dd2" stroke="#000" stroke-width="11.7" ry="178.3" rx="221.7" transform="matrix(.68562 0 0 1.13145 -15.245 128.498)" overflow="visible"/>
<path fill="#6d7dd2" fill-rule="evenodd" stroke="#000" stroke-width="10.3" d="M269 391.4c-16.3 36.7-31.3 51.2-54.3 70.2-7.2-29.2-10-42-6-77.8 14.7-4.2 31.2-11.5 60.3 7.6z"/>
<path fill-rule="evenodd" d="M394.2 380.3c8.6 14.6 52.2 58 54 117.6 1.3 30-50.3-66-57 1 4.2-34 0-69 3-119zm-293.5-1.8c-7 16.4-42 64.8-43.3 131.5-1 34 40.3-72.8 45.8 1.7-3.4-38 0-76.7-2.5-133.2z"/>
<path fill="#6d7dd2" stroke="#000" stroke-width="9.7" d="M225.8 628.5c4.8 19-19.5 27-47.7 31.7-36 6-59-9.8-45-41.5 13-30 36.6-53.7 57.3-33.4 21.4 21 14 15.7 36.3 43.2z" overflow="visible"/>
<path fill="#6d7dd2" stroke="#000" stroke-width="10.3" d="M254 639.5c-5.2 20.3 20.7 28.8 50.6 33.7 38.6 6.4 63.4-10.4 48.8-44-13.8-31.8-39-57-61-35.5-22.6 22.3-14.8 16.7-38.4 45.8z" overflow="visible"/>
<path d="M175 352.3c-5-1.7-7.6-6.2-8-13.6-.3-10.7 4-17.2 12-17.5 5-.2 9.5 3 11 7.6 1 3 1.5 8.4 1 11.5-1.5 10-7.8 14.8-16 12zm128.8 1.3c-5-1.7-7.6-6.2-8-13.6-.4-10.7 4-17.2 12-17.5 5-.2 9.5 3 11 7.6 1 3 1.5 9 1 12-1.6 10-8 15-16 12z"/>
</g>
<g transform="translate(-57.384 -224.84)">
<ellipse cx="383.4" cy="268" fill="#6d7dd2" stroke="#000" stroke-width="16" ry="178.3" rx="221.7" transform="matrix(-.42486 0 0 .70114 622.69 357.98)" overflow="visible"/>
<path fill="#6d7dd2" fill-rule="evenodd" stroke="#000" stroke-width="8.8" d="M446.6 521c10 22.6 19.3 31.7 33.6 43.4 4.5-18 6.2-26 3.8-48.2-9.2-2.6-19.4-7.2-37.4 4.7z"/>
<path fill-rule="evenodd" d="M369 514c-5.4 9-32.4 36-33.5 73-.8 18.7 31-40.5 35.4.8-3-21 0-42.5-2-73.8zm181.8-1c4.3 10 26 40 27 81.4.6 21-25-45-28.5 1 2-23.5 0-47.5 1.5-82.5z"/>
<path fill="#6d7dd2" stroke="#000" stroke-width="8.8" d="M473.4 667.8c-3 12 12 16.8 29.5 19.7 22 3.7 37-6 28-25.7-8-18.6-23-33.3-36-20.7-13 13-8.7 10-22.4 27zm-17.6 7c3.3 12.4-12.8 17.7-31.3 20.7-24 4-39.3-6.4-30.3-27.3 8.6-19.7 24.2-35.4 37.8-22 14 14 9.2 10.4 23.8 28.5z" overflow="visible"/>
<path d="M504.8 496.7c3-1 4.7-4 5-8.5.2-6.6-2.6-10.6-7.5-10.8-3 0-6 1.8-6.8 4.7-.7 2-1 6-.6 8 0 6.3 4 9 9 7.5zm-79.8.8c3-1 4.7-4 5-8.4.2-6-2.6-10-7.5-10-3 0-6 2-6.8 4.7-.7 1.8-1 5-.6 7 1 6.4 5 9.3 10 7.6z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1,64 +0,0 @@
/* Hierarchical dynamic menu with CSS
*
* Copyright Petr Stanicek [aka -pixy-] 2003-05-16
*
* Taken from http://www.pixy.cz/blogg/clanky/csshiermenu/
*/
#menu {
position:relative;
list-style-type:none;
margin:0 0 0 0; padding:0;
width:100%; height:1.4em;
font:100%/1 sans-serif;
}
.menuitem {
position:absolute; top:-14px;
margin:0; padding:0;
width:10em; height:1.4em;
overflow:hidden;
}
#mi01 { left:16em }
#mi02 { left:26em }
#mi03 { left:36em }
.menuitem ul {
display:block;
margin: 0; padding:0;
list-style-type:none;
}
.menuitem li { margin:0; padding:0 }
.submenu li { position:relative }
/* 2-class selector to have higher weight than ".menuitem ul" */
.submenu .subsubmenu {
position:absolute; top:0; left:10em;
width:10em;
display:none;
}
#menu a,span {
display:block;
margin:0; padding: 0.2em 0.5em;
text-align:center;
text-decoration:none;
color:white;
border-top:1px solid #565F68;
border-left:1px solid #565F68;
cursor:pointer;
}
#menu a:hover { background:black }
.menuitem span { background:#565F68 }
.menuitem ul span { background:#88AA88 }
.menuitem ul ul a { background:#AA8888 }
.menuitem ul ul ul a { background:violet }
.menuitem ul ul ul ul a { background:orange }
#menu a,span {
border-bottom:none;
font-weight:bold;
}
html {
overflow-y:scroll;
}

View file

@ -1,58 +0,0 @@
var color1 = '#565F68';
var color2 = '#88AA88';
function closeMenus()
{
var elems = document.getElementsByClassName("menuitem");
var i;
for (i = 0; i < elems.length; i++)
{
elems[i].style.overflow = 'hidden';
var mel = elems[i].getElementsByClassName("mel")[0];
mel.style.background = color1;
}
}
function closeSubMenus()
{
var elems = document.getElementsByClassName("subsubmenu");
var i;
for (i = 0; i < elems.length; i++)
{
elems[i].style.display = 'none';
}
elems = document.getElementsByClassName("mel2");
for (i = 0; i < elems.length; i++)
{
elems[i].style.background = color2;
}
}
function menuCloser (event)
{
if (!event.target.matches('.mel') && !event.target.matches('.mel2'))
{
closeMenus();
closeSubMenus();
}
}
function mf1 (elem)
{
closeMenus();
elem.style.overflow = 'visible';
var child = elem.getElementsByClassName("mel")[0];
child.style.background = 'black';
}
function mf2 (elem)
{
closeSubMenus();
var child = elem.getElementsByClassName("subsubmenu")[0];
child.style.display = 'block';
var child = elem.getElementsByClassName("mel2")[0];
child.style.background = 'black';
}
window.onclick = menuCloser;

205
http/script.js Normal file
View file

@ -0,0 +1,205 @@
function throttle(fn, threshhold) {
threshhold || (threshhold = 150)
var last, deferTimer
return function () {
var now = +new Date
if (last && now < last + threshhold) {
clearTimeout(deferTimer)
deferTimer = setTimeout(function () {
last = now
fn()
}, threshhold)
} else {
last = now
fn()
}
};
}
/* Fixed topbar and tag menu when header is hidden by scroll */
// Cross browser scrollTop position
var getScrollTop
if (typeof window.pageYOffset != 'undefined') {
getScrollTop = function () { return window.pageYOffset }
} else {
if (document.documentElement.clientHeight)
getScrollTop = function () { return document.documentElement.scrollTop }
else getScrollTop = function () { return document.body.scrollTop }
}
var bodyClassName = ''
function checkScroll () {
var isHiddenHeader = getScrollTop() >= 200 ? 'hidden-header' : ''
if (isHiddenHeader !== bodyClassName) {
document.body.className = bodyClassName = isHiddenHeader
}
}
// If header is present
if (document.querySelector('.header')) {
window.onscroll = throttle(checkScroll, 10)
checkScroll()
} else {
document.body.className = 'hidden-header'
}
/* Tags menu filter */
var versions = document.querySelector('.versions')
var div = document.createElement('div')
var button = document.createElement('button')
var a = document.createElement('a')
var span = document.createElement('span')
var input = document.createElement('input')
a.title = 'Close Menu'
a.className = 'close-menu icon-cross'
// a.innerText = 'Close Menu'
div.className = 'filter'
span.className = 'screenreader'
button.className = 'icon-filter'
input.placeholder = 'Filter tags'
span.innerText = 'Filter tags'
// As filtering happen on typing
// the filter button is just for decoration
button.tabIndex = -1
button.appendChild(span)
div.appendChild(input)
div.appendChild(button)
div.appendChild(a)
var sidebar = document.querySelector('.sidebar')
sidebar.insertBefore(div, sidebar.firstChild)
var nav = document.querySelector('.sidebar nav')
var results = document.createElement('div')
results.className = 'filter-results'
nav.appendChild(results)
var tags = {}
function getTags () {
var list = document.querySelectorAll('.versions a')
for (var i = 0, l = list.length; i < l; i++) {
tags[list[i].innerText] = list[i].href
}
}
getTags()
function displayFilter (filter) {
var filtered = document.createDocumentFragment()
var reg = new RegExp(filter, 'i')
for (var key in tags) {
if (tags.hasOwnProperty(key)) {
var ok = false
var h = key.replace(reg, function (_) {
if (_) ok = true
return '<strong>' + _ + '</strong>'
})
if (ok) {
var a = document.createElement('a')
a.href = tags[key]
a.innerHTML = h
filtered.appendChild(a)
}
}
}
results.innerHTML = ''
results.appendChild(filtered)
}
input.oninput = function () {
if (this.value === '') {
versions.classList.remove('hide')
results.innerHTML = ''
} else {
versions.classList.add('hide')
displayFilter(this.value)
}
}
/* Tags menu tree */
// Expand/Collapse tree
versions.onclick = function (e) {
if (e.target && e.target.nodeName == 'SPAN') {
e.target.classList.toggle('active')
}
}
function expandVersion (version) {
var version = document.querySelector('.versions .active')
if (version && version.parentNode) {
var targ = version.parentNode.previousElementSibling
while (targ && targ.tagName === 'SPAN') {
targ.classList.add('active')
targ = targ.parentNode.parentNode
targ = targ.previousElementSibling
}
}
}
// Auto expand menu to display current version
window.setTimeout(expandVersion, 1)
var tag = document.querySelector('.version em')
var openMenu = document.querySelector('.open-menu')
var wrapper = document.querySelector('.wrapper')
openMenu.onclick = tag.onclick = function (e) {
e.preventDefault()
wrapper.classList.toggle('show-menu')
}
sidebar.onclick = function (e) {
console.log(e.target.className)
if (e.target === this || e.target.classList.contains('close-menu')) {
wrapper.classList.remove('show-menu')
}
}
/* Linenumbers navigation */
// When using linenumbers's anchor
// it jump the line a the top of the page
// and it's hidden under the fixed topbar element.
// To prevent this let's make the jump at half the height
// of the screen
var height
var middle
// cross browser height calculation
function getHeight () {
height = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight
middle = height / 5
}
window.onresize = getHeight
getHeight()
// This will capture hash changes while on the page
function offsetAnchor() {
if (location.hash.length !== 0) {
var rect = document.querySelector(location.hash).getBoundingClientRect()
var elTop = rect.top + window.scrollY
window.scrollTo(window.scrollX, elTop - middle)
}
}
window.onhashchange = offsetAnchor
// This is here so that when you enter the page with a hash,
// it can provide the offset in that case too. Having a timeout
// seems necessary to allow the browser to jump to the anchor first.
window.setTimeout(offsetAnchor, 1)
// recalculate scroll when page is fully loaded
// in case of slow rendering very long pages.
window.onload = function () {
getHeight()
offsetAnchor()
}

File diff suppressed because it is too large Load diff

View file

@ -1,32 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>$title</title>
<link rel="stylesheet" href="/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/menu.css" type="text/css" media="screen" />
<script type="text/javascript" src="/menu.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<base href="$baseurl"/>
</head>
<body>
<div id="wrapper">
<div id="wrapper2">
<div id="header">
<div id="logo">
<h1>Elixir Cross Referencer</h1>
<h2><a href="http://free-electrons.com">Free Electrons: Embedded Linux Experts</a></h2>
<p>&nbsp;&bull;&nbsp;<a href="/linux/latest/source">Linux</a>&nbsp;&bull;&nbsp;<a href="/u-boot/latest/source">U-Boot</a>&nbsp;&bull;&nbsp;<a href="/busybox/latest/source">Busybox</a>&nbsp;&bull;&nbsp;</p>
<p>
&nbsp;&bull;&nbsp;<a href="$vvar/source">source navigation</a>&nbsp;&bull;&nbsp;<a href="$vvar/ident">identifier search</a>&nbsp;&bull;&nbsp;<a href="$vvar/search">freetext search</a>&nbsp;&bull;&nbsp;
</p>
</div>
</div>
<div id="topbar">
<p>Version: $vvar2 $versions
</div>
<h1>$banner</h1>

View file

@ -1,21 +0,0 @@
<p>
This page was automatically generated by Elixir 0.1.2 (<a href="https://github.com/free-electrons/elixir">source</a>)
&nbsp;&bull;&nbsp;
Please report bugs by <a href="mailto:mikael.bouillot@free-electrons.com">mail</a> or directly through the <a href="https://github.com/free-electrons/elixir/issues">issue tracker.</a>
</p>
<div id="menu2">
<ul>
<li><a href="http://free-electrons.com/">Home</a></li>
<li><a href="http://free-electrons.com/engineering/" title="Engineering">Engineering</a></li>
<li><a href="http://free-electrons.com/training/" title="Training">Training</a></li>
<li><a href="http://free-electrons.com/docs/" title="Docs">Docs</a></li>
<li><a href="http://free-electrons.com/community/" title="Community">Community</a></li>
<li><a href="http://free-electrons.com/company/" title="Company">Company</a></li>
<li><a href="http://free-electrons.com/blog/" title="Blog">Blog</a></li>
</ul>
</div>
</div>
</div>
</body>

View file

@ -36,10 +36,10 @@ import os
from re import search, sub
from collections import OrderedDict
ident = ''
status = 200
url = os.environ['SCRIPT_URL']
m = search ('^/([^/]*)/([^/]*)/([^/]*)(.*)$', url)
m = search ('^/([^/]*)/([^/]*)/([^/]*)(.*)$', os.environ['SCRIPT_URL'])
if m:
project = m.group (1)
version = m.group (2)
@ -60,7 +60,7 @@ if m:
mode = 'source'
if not search ('^[A-Za-z0-9_/.,+-]*$', path):
path = 'INVALID'
url2 = 'source'+path
url = 'source'+path
elif cmd == 'ident':
ident = arg[1:]
form = cgi.FieldStorage()
@ -72,10 +72,7 @@ if m:
mode = 'ident'
if not (ident and search ('^[A-Za-z0-9_-]*$', ident)):
ident = ''
url2 = 'ident/'+ident
elif cmd == 'search':
mode = 'search'
url2 = 'search'
url = 'ident/'+ident
else:
status = 404
@ -95,6 +92,11 @@ basedir = os.environ['LXR_PROJ_DIR']
os.environ['LXR_DATA_DIR'] = basedir + '/' + project + '/data';
os.environ['LXR_REPO_DIR'] = basedir + '/' + project + '/repo';
projects = []
for (dirpath, dirnames, filenames) in os.walk (basedir):
projects.extend (dirnames)
break
import sys
sys.path = [ sys.path[0] + '/..' ] + sys.path
import query
@ -116,14 +118,20 @@ def do_query (*args):
return a
if version == 'latest':
version2 = do_query ('latest')[0]
tag = do_query ('latest')[0]
else:
version2 = version
tag = version
head = open ('template-head').read()
head = sub ('\$baseurl', 'http://' + os.environ['HTTP_HOST'] + '/' + project + '/', head)
head = sub ('\$vvar2', version2, head)
head = sub ('\$vvar', version, head)
data = {
'baseurl': 'http://' + os.environ['HTTP_HOST'] + '/' + project + '/',
'tag': tag,
'version': version,
'url': url,
'project': project,
'projects': projects,
'ident': ident,
'breadcrumb': '<a class="project" href="'+version+'/source">/</a>'
}
lines = do_query ('versions')
va = OrderedDict()
@ -141,54 +149,63 @@ for l in lines:
va[m1][m2] = []
va[m1][m2].append (l)
v = '<ul id="menu">\n'
v = ''
b = 1
for v1k in va:
v1v = va[v1k]
v += ' <li class="menuitem" id="mi0'+str(b)+'" onclick="mf1(this);"><span class="mel" onclick="closeSubMenus();">'+v1k+'</span>\n'
v += '<li>\n'
v += '\t<span>'+v1k+'</span>\n'
v += '\t<ul>\n'
b += 1
v += ' <ul class="submenu">\n'
for v2k in v1v:
v2v = v1v[v2k]
v += ' <li onclick="mf2(this);"><span class="mel2">'+v2k+'</span>\n'
v += ' <ul class="subsubmenu">\n'
for v3 in v2v:
v += ' <li><a href="'+v3+'/'+url2+'">'+v3+'</a></li>\n'
v += ' </ul></li>\n'
v += ' </ul></li>\n'
v += '</ul>\n'
if v2k == v2v[0]:
if v2k == tag: v += '\t\t<li class="li-link active"><a href="'+v2k+'/'+url+'">'+v2k+'</a></li>\n'
else: v += '\t\t<li class="li-link"><a href="'+v2k+'/'+url+'">'+v2k+'</a></li>\n'
else:
v += '\t\t<li>\n'
v += '\t\t\t<span>'+v2k+'</span>\n'
v += '\t\t\t<ul>\n'
for v3 in v2v:
if v3 == tag: v += '\t\t\t\t<li class="li-link active"><a href="'+v3+'/'+url+'">'+v3+'</a></li>\n'
else: v += '\t\t\t\t<li class="li-link"><a href="'+v3+'/'+url+'">'+v3+'</a></li>\n'
v += '\t\t\t</ul></li>\n'
v += '\t</ul></li>\n'
head = sub ('\$versions', v, head)
data['versions'] = v
if mode == 'source':
banner = '<a href="'+version+'/source">'+project+'</a>'
p2 = ''
p3 = path.split ('/') [1:]
links = []
for p in p3:
p2 += '/'+p
banner += '/<a href="'+version+'/source'+p2+'">'+p+'</a>'
links.append ('<a href="'+version+'/source'+p2+'">'+p+'</a>')
head = sub ('\$banner', banner, head)
head = sub ('\$title', project+path+' - Elixir - Free Electrons', head)
print (head, end='')
if links:
data['breadcrumb'] += '/'.join (links)
data['ident'] = ident
data['title'] = project+path+' - Elixir - Free Electrons'
lines = ['null - -']
type = do_query ('type', version2, path)
type = do_query ('type', tag, path)
if len (type) == 1:
type = type[0]
if type == 'tree':
lines += do_query ('dir', version2, path)
lines += do_query ('dir', tag, path)
elif type == 'blob':
lines += do_query ('file', version2, path)
lines += do_query ('file', tag, path)
else:
print ('<br><b>This file does not exist.</b>')
print ('<div class="lxrerror"><h2>This file does not exist.</h2></div>')
status = 404
if type == 'tree':
if path != '':
lines[0] = 'back - -'
print ('<div class="lxrtree">')
print ('<table>\n')
for l in lines:
type, name, size = l.split (' ')
@ -196,83 +213,87 @@ if mode == 'source':
if type == 'null':
continue
elif type == 'tree':
icon = 'folder.gif'
size = ''
path2 = path+'/'+name
name = name
elif type == 'blob':
icon = 'text.gif'
size = size+' bytes'
path2 = path+'/'+name
elif type == 'back':
icon = 'back.gif'
size = ''
path2 = os.path.dirname (path[:-1])
if path2 == '/': path2 = ''
name = 'Parent directory'
print (' <tr>')
print (' <td><a href="'+version+'/source'+path2+'"><img src="/icons/'+icon+'" width="20" height="22" border="0" alt="'+icon+'"/></a></td>')
print (' <td><a href="'+version+'/source'+path2+'">'+name+'</a></td>')
print (' <td>'+size+'</td>')
print (' <tr>\n')
print (' <td><a class="tree-icon icon-'+type+'" href="'+version+'/source'+path2+'">'+name+'</a></td>\n')
print (' <td><a tabindex="-1" class="size" href="'+version+'/source'+path2+'">'+size+'</a></td>\n')
print (' </tr>\n')
print ('</table>', end='')
print ('</div>')
elif type == 'blob':
del (lines[0])
print ('<div id="lxrcode">')
print ('<table><tr><td><pre>')
import pygments
import pygments.lexers
import pygments.formatters
links = []
code = StringIO()
width1 = len (str (len (lines)))
num = 1
width2 = len (str (num))
space = ' ' * (width1 - width2)
for l in lines:
print (' '+space+'<a name="L'+str(num)+'" href="'+version+'/source'+path+'#L'+str(num)+'">'+str(num)+'</a> ')
num += 1
width2 = len (str (num))
space = ' ' * (width1 - width2)
def keep_links(match):
links.append (match.group (1))
g = match.group(1)
return '__KEEPLINKS__' + str(len(links))
print ('</pre></td><td><pre>')
def replace_links(match):
i = links[int (match.group (1)) - 1]
return '<a href="'+version+'/ident/'+i+'">'+i+'</a>'
for l in lines:
l = cgi.escape (l)
l = sub ('"', '&quot;', l)
l = sub ('\033\[31m(.*?)\033\[0m', '<a href="'+version+'/ident/\\1">\\1</a>', l)
l = sub ('\033\[31m(.*?)\033\[0m', keep_links, l)
l = sub ('\033\[32m', '', l)
l = sub ('\033\[33m', '', l)
l = sub ('\033\[0m', '', l)
print (l)
code.write (l + '\n')
print ('</pre></td></tr></table>')
print ('</div>', end='')
code = code.getvalue()
try:
lexer = pygments.lexers.guess_lexer_for_filename (path, code)
except:
lexer = pygments.lexers.get_lexer_by_name ('text')
formatter = pygments.formatters.HtmlFormatter (linenos=True, anchorlinenos=True)
result = pygments.highlight (code, lexer, formatter)
result = sub ('href="#-(\d+)', 'name="L\\1" id="L\\1" href="'+version+'/source'+path+'#L\\1', result)
result = sub ('__KEEPLINKS__(\d+)', replace_links, result)
print ('<div class="lxrcode">' + result + '</div>')
elif mode == 'ident':
field = '</h1>\n<form method="get" action="'+version+'/ident">\nIdentifier: <input type="text" name="i" value="'+ident+'"size="60"/>\n<input type="submit" value="Go get it"/>\n</form>\n<h1>' + ident
head = sub ('\$banner', field, head)
head = sub ('\$title', ident+' - Elixir - Free Electrons', head)
print (head, end='')
data['title'] = ident+' - Elixir - Free Electrons'
lines = do_query ('ident', version2, ident)
lines = do_query ('ident', tag, ident)
lines = iter (lines)
print ('<div class="lxrident">')
m = search ('Defined in (\d*) file', next (lines))
if m:
num = int (m.group(1))
if num == 0:
status = 404
print ('Defined in '+str(num)+' files:')
print ('<h2>Defined in '+str(num)+' files:</h2>')
print ('<ul>')
for i in range (0, num):
l = next (lines)
m = search ('^(.*): (\d*) \((.*)\)$', l)
f, n, t = m.groups()
print ('<li><a href="'+version+'/source/'+f+'#L'+n+'">'+f+', line '+n+' (as a '+t+')</a>', end='')
print ('<li><a href="'+version+'/source/'+f+'#L'+n+'"><strong>'+f+'</strong>, line '+n+' <em>(as a '+t+')</em></a>')
print ('</ul>')
next (lines)
@ -280,7 +301,7 @@ elif mode == 'ident':
m = search ('Referenced in (\d*) file', next (lines))
num = int (m.group(1))
print ('Referenced in '+str(num)+' files:')
print ('<h2>Referenced in '+str(num)+' files:</h2>')
print ('<ul>')
for i in range (0, num):
l = next (lines)
@ -289,13 +310,13 @@ elif mode == 'ident':
ln = m.group (2).split (',')
if len (ln) == 1:
n = ln[0]
print ('<li><a href="'+version+'/source/'+f+'#L'+str(n)+'">'+f+', line '+str(n)+'</a>', end='')
print ('<li><a href="'+version+'/source/'+f+'#L'+str(n)+'"><strong>'+f+'</strong>, line '+str(n)+'</a>')
else:
if num > 100: # Concise display
n = len (ln)
print ('<li><a href="'+version+'/source/'+f+'">'+f+'</a>, '+str(n)+' times')
print ('<li><a href="'+version+'/source/'+f+'"><strong>'+f+'</strong>, <em>'+str(n)+' times</em></a>')
else: # Verbose display
print ('<li>'+f)
print ('<li><a href="'+version+'/source/'+f+'#L'+str(ln[0])+'"><strong>'+f+'</strong></a>')
print ('<ul>')
for n in ln:
print ('<li><a href="'+version+'/source/'+f+'#L'+str(n)+'">line '+str(n)+'</a>')
@ -303,24 +324,21 @@ elif mode == 'ident':
print ('</ul>')
else:
if ident != '':
print ('<br><b>Not used</b>')
print ('<h2>Identifier not used</h2>')
status = 404
elif mode == 'search':
head = sub ('\$banner', '', head)
head = sub ('\$title', 'Freetext search - Elixir - Free Electrons', head)
print (head, end='')
print ('<form method="get" action="http://www.google.com/search"><input type="text" name="q" size="31" maxlength="255" value="" /><input type="submit" value="Google Search" /><input type="radio" name="sitesearch" value="" /> The Web<input type="radio" name="sitesearch" value="lxr.free-electrons.com" checked="checked"/>LXR<input type="radio" name="sitesearch" value="elixir.free-electrons.com/'+project+'/'+version+'"/>Elixir</form>')
print ('</div>')
else:
print (head)
print ('Invalid request')
print (open ('template-tail').read(), end='')
if status == 404:
realprint ('Status: 404 Not Found')
import jinja2
loader = jinja2.FileSystemLoader (os.path.join (os.path.dirname (__file__), '../templates/'))
environment = jinja2.Environment (loader=loader)
template = environment.get_template ('layout.html')
realprint ('Content-Type: text/html;charset=utf-8\n')
realprint (outputBuffer.getvalue(), end='')
data['main'] = outputBuffer.getvalue()
realprint (template.render(data), end='')

21
templates/header.html Normal file
View file

@ -0,0 +1,21 @@
<header class="header">
<h1><a href="http://free-electrons.com/">free electrons</a></h1>
<h2>Embedded Linux Experts</h2>
<nav>
<ul class="nav-links">
<li><a href="http://free-electrons.com/">Home</a></li>
<li><a href="http://free-electrons.com/engineering/">Engineering</a></li>
<li><a href="http://free-electrons.com/training/">Training</a></li>
<li><a href="http://free-electrons.com/docs/">Docs</a></li>
<li><a href="http://free-electrons.com/community/">Community</a></li>
<li><a href="http://free-electrons.com/company/">Company</a></li>
<li><a href="http://free-electrons.com/blog/">Blog</a></li>
</ul>
<ul class="social-icons">
<li><a target="_blank" class="icon-twitter" href="http://twitter.com/free_electrons">twitter</a></li>
<li><a target="_blank" class="icon-googleplus" href="https://plus.google.com/+FreeElectronsDevelopers">google+</a></li>
<li><a target="_blank" class="icon-linkedin" href="http://www.linkedin.com/groups/Free-Electrons-4501089">linkedin</a></li>
<li><a target="_blank" class="icon-github" href="https://github.com/free-electrons">github</a></li>
</ul>
</nav>
</header>

65
templates/layout.html Normal file
View file

@ -0,0 +1,65 @@
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>{{title}}</title>
<meta name="description" content="Elixir Cross Referencer">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" />
<link rel="stylesheet" href="/style.css">
<base href="{{baseurl}}"/>
<script>document.documentElement.className = 'js'</script>
</head>
<body>
<!--[if lte IE 9]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
<![endif]-->
{% include 'header.html' %}
<header class="sub-header">
<select class="select-projects" onchange="window.location.href=this.value">
{%- for p in projects %}
<option{% if p == project %} selected{% endif %} value="/{{p}}/latest/source">{{p}}</option>
{%- endfor %}
</select>
</header>
<div class="wrapper">
<main>
<header class="topbar">
<div class="breadcrumb">
<a href="{{version}}/{{url}}#menu" class="open-menu icon-menu screenreader" title="Open Menu">Open Menu</a>
{{breadcrumb}}
</div>
<div class="search">
<form method="post" action="{{version}}/ident">
<input placeholder="Search Identifier" type="text" name="i" value="{{ident}}"/>
<button class="icon-search"><span class="screenreader">Go get it</span></button>
</form>
</div>
</header>
<div class="scrollable">
{{main}}
</div>
<footer class="footer">
<span class="version"><a href="{{version}}/source">{{project}}</a> <em class="icon-tag">{{tag}}</em></span>
<a title="Go to top of the page" class="go-top icon-up screenreader" href="{{version}}/{{url}}#">Top</a>
<span class="poweredby">powered by <a target="_blank" href="https://github.com/free-electrons/elixir">Elixir 0.1.2</a></span>
</footer>
</main>
<aside class="sidebar" id="menu">
<nav>
<h3 class="screenreader">Projects</h3>
<ul class="projects">
{%- for p in projects %}
<li{% if p == project %} class="active"{% endif %}><a href="/{{p}}/latest/source">{{p}}</a></li>
{%- endfor %}
</ul>
<h3 class="screenreader">Versions</h3>
<ul class="versions">
{{versions}}
</ul>
</nav>
</aside>
</div>
<script src="/script.js"></script>
</body>
</html>