Skip to content

Commit

Permalink
Merge branch 'develop' into gh-pages
Browse files Browse the repository at this point in the history
* develop:
  v12.1.0
  chore(package): update deps (#1241)
  feat(ui/search-specref): reimagine specref search (#1240)
  • Loading branch information
marcoscaceres committed May 29, 2017
2 parents 90583e2 + e78bad6 commit f58b3ed
Show file tree
Hide file tree
Showing 8 changed files with 320 additions and 113 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -50,6 +50,7 @@ js/core/worker.js
js/templates.js
js/ui/about-respec.js
js/ui/dfn-list.js
js/ui/search-specref.js
js/w3c/abstract.js
js/w3c/aria.js
js/w3c/conformance.js
Expand Down
2 changes: 1 addition & 1 deletion builds/respec-w3c-common.build.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/respec-w3c-common.js

Large diffs are not rendered by default.

97 changes: 0 additions & 97 deletions js/ui/search-specref.js

This file was deleted.

95 changes: 94 additions & 1 deletion js/ui/ui.css
Expand Up @@ -287,4 +287,97 @@

p + .respec-button-copy-paste {
margin: 1px 127px;
}
}

#specref-ui {
margin: 0 2%;
margin-bottom: .5cm;
}

#specref-ui header {
font-size: .7em;
background-color: #eee;
text-align: center;
padding: .2cm;
margin-bottom: .5cm;
border-radius: 0 0 .2cm .2cm;
}

#specref-ui header h1 {
padding: 0;
margin: 0;
color: black;
}

#specref-ui p {
padding: 0;
margin: 0;
font-size: .8em;
text-align: center;
}

#specref-ui p.state {
margin: 1cm;
}

#specref-ui .searchcomponent {
display: grid;
grid-template-columns: auto 1.6cm;
margin: 0 .5cm;
}
#specref-ui .searchcomponent:focus {

}

#specref-ui input,
#specref-ui button {
border: 0;
padding: 6px 12px;
}

#specref-ui label {
font-size: 0.6em;
grid-column-end: 3;
text-align: right;
grid-column-start: 1;
}

#specref-ui input[type=search] {
border-radius: .1cm 0 0 .1cm;
border: 1px solid rgb(204,204,204);
}

#specref-ui button[type=submit]{
color: white;
border-radius: 0 .1cm .1cm 0;
background-color: rgb(51,122,183);
}

#specref-ui button[type=submit]:hover {
background-color: #286090;
border-color: #204d74;
}

#specref-ui .result-stats {
margin: 0;
padding: 0;
color: rgb(128,128,128);
font-size: .7em;
font-weight: bold;
}

#specref-ui .specref-results {
font-size: .8em;
}

#specref-ui .specref-results dd + dt {
margin-top: .51cm;
}

#specref-ui .specref-results a {
text-transform: capitalize;
}
#specref-ui .specref-results .authors {
display: block;
color: #006621;
}
24 changes: 12 additions & 12 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "respec",
"version": "12.0.6",
"version": "12.1.0",
"license": "W3C",
"description": "A technical specification pre-processor.",
"engines": {
Expand All @@ -18,14 +18,14 @@
"babel-cli": "^6.24.1",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-es2015-modules-amd": "^6.24.1",
"babel-preset-env": "^1.4.0",
"chai": "^3.5.0",
"babel-preset-env": "^1.5.1",
"chai": "^4.0.0",
"clipboard": "^1.6.1",
"domReady": "github:requirejs/domReady",
"glob": "^7.1.1",
"handlebars": "^4.0.8",
"glob": "^7.1.2",
"handlebars": "^4.0.10",
"http-server": "^0.10.0",
"jasmine-core": "^2.6.1",
"jasmine-core": "^2.6.2",
"jasmine-reporters": "^2.2.1",
"jquery": "^3.2.1",
"js-beautify": "^1.6.14",
Expand All @@ -44,11 +44,11 @@
"karma-safari-launcher": "^1.0.0",
"karma-safaritechpreview-launcher": "0.0.5",
"karma-verbose-summary-reporter": "0.0.1",
"mocha": "^3.4.1",
"mocha": "^3.4.2",
"moment": "^2.18.1",
"requirejs": "^2.3.3",
"text": "github:requirejs/text",
"uglify-es": "^3.0.8",
"uglify-es": "^3.0.12",
"webidl2": "^3.0.1",
"whatwg-fetch": "^2.0.3"
},
Expand Down Expand Up @@ -76,19 +76,19 @@
},
"dependencies": {
"colors": "^1.1.2",
"command-line-args": "^4.0.4",
"command-line-args": "^4.0.5",
"command-line-usage": "^4.0.0",
"epipebomb": "^1.0.0",
"express": "^4.15.2",
"express": "^4.15.3",
"fs-extra": "^3.0.1",
"highlight.js": "github:marcoscaceres/highlight.js",
"hyperhtml": "^0.11.0",
"hyperhtml": "^0.11.6",
"loading-indicator": "^2.0.0",
"marcosc-async": "^4.0.3",
"marked": "^0.3.6",
"nightmare": "^2.10.0",
"prompt": "^1.0.0",
"snyk": "^1.30.1"
"snyk": "^1.31.0"
},
"snyk": true
}
52 changes: 51 additions & 1 deletion src/core/biblio.js
Expand Up @@ -5,7 +5,6 @@

/*jshint jquery: true*/
/*globals console*/

import "deps/regenerator";
import { biblioDB } from "core/biblio-db";
import { createResourceHint } from "core/utils";
Expand Down Expand Up @@ -46,6 +45,57 @@ const REF_STATUSES = new Map([
["WG-NOTE", "W3C Working Group Note"],
]);


const defaultsReference = Object.freeze({
authors: [],
date: "",
href: "",
publisher: "",
status: "",
title: "",
etAl: false,
});

const endNormalizer = function(endStr){
return str => {
const trimmed = str.trim();
const result = !trimmed || trimmed.endsWith(endStr) ? trimmed : trimmed + endStr;
return result;
}
}

const endWithDot = endNormalizer(".");

export function wireReference(rawRef, target="_blank") {
if(typeof rawRef !== "object"){
throw new TypeError("Only modern object refereces are allowed");
}
const ref = Object.assign({}, defaultsReference, rawRef);
const authors = ref.authors.join("; ") + (ref.etAl ? " et al" : "");
const status = REF_STATUSES.get(ref.status) || ref.status
return hyperHTML.wire(ref)`
<cite>
<a
href="${ref.href}"
target="${target}"
rel="noopener noreferrer">
${ref.title.trim()}</a>.
</cite>
<span class="authors">
${endWithDot(authors)}
</span>
<span class="publisher">
${endWithDot(ref.publisher)}
</span>
<span class="pubDate">
${endWithDot(ref.date)}
</span>
<span class="pubStatus">
${endWithDot(status)}
</span>
`;
}

export function stringifyReference(ref) {
if (typeof ref === "string") return ref;
let output = `<cite>${ref.title}</cite>`;
Expand Down

0 comments on commit f58b3ed

Please sign in to comment.