Skip to content

Commit 19bbcf0

Browse files
add html mark format correctly, output copyright only if not cc-0
1 parent 580b6b6 commit 19bbcf0

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ <h3>Mark Your Work</h3>
351351
<p>If you are licensing or marking one work, paste the code next to it. If you are licensing or marking the whole page or blog, you can paste the code at the bottom of the page.</p>
352352

353353
<article>
354-
<details class="format">
354+
<details class="format" name="website" open>
355355
<summary>Rich Text</summary>
356356

357357
<p class="rich-text mark">[contextually formatted mark here]</p>
@@ -367,7 +367,7 @@ <h3>Mark Your Work</h3>
367367
</article>
368368

369369
<article>
370-
<details class="format">
370+
<details class="format" name="website">
371371
<summary>HTML</summary>
372372

373373
<textarea class="html mark" readonly="true">[contextually formatted mark here]</textarea>
@@ -390,7 +390,7 @@ <h3>Mark Your Work</h3>
390390
<p>Copy the text below and paste it on the title and/or copyright page of your print work or presentation, or in the credits of your media.</p>
391391

392392
<article>
393-
<details class="format" open>
393+
<details class="format" name="print" open>
394394
<summary>Plain Text</summary>
395395

396396
<p class="plain-text mark">[contextually formatted mark here]</p>
@@ -804,7 +804,7 @@ <h4>Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International</
804804
</template>
805805

806806
<template id="plain-text" class="mark">
807-
<p>{{title}} © {{year}} by {{creator}} is {{typeAsVerb}} {{toolName}}. To view a copy of this {{type}}, visit {{toolURL}}</p>
807+
<p>{{title}} {{copyright}} by {{creator}} is {{typeAsVerb}} {{toolName}}. To view a copy of this {{type}}, visit {{toolURL}}</p>
808808
</template>
809809

810810
</body>

src/scripts.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,11 @@ function renderMarkingFormats(state) {
265265

266266
let type = "license";
267267
let typeAsVerb = "licensed under";
268+
let copyright = ' © ' + attribution.workCreationYear;
268269
if (state.props.tool == 'cc-0') {
269270
type = "mark";
270271
typeAsVerb = "marked";
272+
copyright = '';
271273
}
272274

273275
// set contents of plain text mark
@@ -290,6 +292,7 @@ function renderMarkingFormats(state) {
290292
markProps.toolShort = state.props.toolShort;
291293
markProps.toolLong = state.props.toolLong;
292294
markProps.toolURL = state.props.toolURL;
295+
markProps.copyright = copyright;
293296

294297
// set contents of plain text mark
295298
plainTextFullName = document.querySelector('#plain-text-full-name').checked;
@@ -352,7 +355,7 @@ function renderMarkingFormats(state) {
352355
markProps.toolName = state.props.toolShort;
353356
}
354357

355-
let richTextMark = attribution.title + ' © ' + attribution.workCreationYear + ' by ' + attribution.creator + ' is ' + typeAsVerb + ' ' + '<a href="' + state.props.toolURL + '">' + markProps.toolName + '</a>' + ccIconSet;
358+
let richTextMark = '<a href="' + attribution.workLink + '">' + attribution.title + '</a>' + copyright + ' by ' + '<a href="' + attribution.creatorLink + '">' + attribution.creator + '</a>' + ' is ' + typeAsVerb + ' ' + '<a href="' + state.props.toolURL + '">' + markProps.toolName + '</a>' + ccIconSet;
356359
document.querySelector('#mark-your-work .rich-text.mark').innerHTML = richTextMark;
357360

358361

@@ -365,8 +368,8 @@ function renderMarkingFormats(state) {
365368
} else {
366369
markProps.toolName = state.props.toolShort;
367370
}
368-
defaultHTML = '<p xmlns:cc="http://creativecommons.org/ns#">This work is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0<img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg" alt=""><img src="https://mirrors.creativecommons.org/presskit/icons/by.svg" alt=""><img src="https://mirrors.creativecommons.org/presskit/icons/sa.svg" alt=""></a></p>';
369-
let htmlMark = defaultHTML;
371+
//defaultHTML = '<p xmlns:cc="http://creativecommons.org/ns#">This work is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0<img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg" alt=""><img src="https://mirrors.creativecommons.org/presskit/icons/by.svg" alt=""><img src="https://mirrors.creativecommons.org/presskit/icons/sa.svg" alt=""></a></p>';
372+
let htmlMark = '<a href="' + attribution.workLink + '">' + attribution.title + '</a>' + copyright + ' by ' + '<a href="' + attribution.creatorLink + '">' + attribution.creator + '</a>' + ' is ' + typeAsVerb + ' ' + '<a href="' + state.props.toolURL + '">' + markProps.toolName + '</a>' + ccIconSet;
370373
document.querySelector('#mark-your-work .html.mark').innerHTML = htmlMark;
371374
}
372375

0 commit comments

Comments
 (0)