Skip to content

Commit

Permalink
With form=short, truncate URL to host only, and protocol only if no www
Browse files Browse the repository at this point in the history
  • Loading branch information
fbennett committed Jul 20, 2019
1 parent f13ccf7 commit 9e93d49
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/node_text.js
Expand Up @@ -307,6 +307,12 @@ CSL.Node.text = {
if (this.variables[0]) {
value = state.getVariable(Item, this.variables[0], form);
if (value) {
if (this.variables[0] === "URL" && form === "short") {
value = value.replace(/(.*\.[^\/]+)\/.*/, "$1");
if (value.match(/\/\/www\./)) {
value = value.replace(/https?:\/\//, "");
}
}
// true is for non-suppression of periods
if (state.opt.development_extensions.wrap_url_and_doi) {
if (!this.decorations.length || this.decorations[0][0] !== "@" + this.variables[0]) {
Expand Down

0 comments on commit 9e93d49

Please sign in to comment.