css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div id="content">
	<h1>Making the <code>&lt;cite&gt;</code> tag sane</h1>
Simple citations is a script to generate a list of citations from citations within the the article. <cite data-source="https://webkit.org/blog/41/introducing-the-web-inspector/" data-date="01/16/06" data-title="Webkit.org - Introducing the Web Inspector"></cite> Each citation uses the under-utilized <code>&lt;cite&gt;&lt;cite&gt;</code> tag. <cite data-source="https://www.w3schools.com/tags/tag_cite.asp" data-title="w3schools - cite" data-date="10/10/18"></cite> <cite data-source="http://www.google.com" data-title="google.com" data-date="10/10/18"></cite> It can even detect duplicate citings as long as the URL is the same.<cite data-source="https://webkit.org/blog/41/introducing-the-web-inspector/" data-date="01/16/06" data-title="Webkit.org - Introducing the Web Inspector"></cite> Each <code>&lt;cite&gt;</code> tag requires a <code>data-date</code>, <code>data-title</code>, and <code>date-source</code>. Somewhere in the article you will a blank <code>&lt;div&gt;&lt;div&gt;</code> with an identifer (class or ID) for the list of sources to be stashed in. I realize there's far more robust plugins for this, but I wanted something light-weight and easy to manage.
	
<p>Filler text. In 1985 Aldus Corporation launched its first desktop publishing program Aldus PageMaker for Apple Macintosh computers, released in 1987 for PCs running Windows 1.0. Both contained the variant lorem ipsum most common today. Laura Perry, then art director with Aldus, modified prior versions of Lorem Ipsum text from typographical specimens; in the 1960s and 1970s it appeared often in lettering catalogs by Letraset. Anecdotal evidence has it that Letraset used Lorem ipsum already from 1970 onwards, eg. for grids (page layouts) for ad agencies. Many early desktop publishing programs, eg. Adobe PageMaker, used it to create template.

	<p>Do you like Cheese Whiz? Spray tan? Fake eyelashes? That's what is Lorem Ipsum to many—it rubs them the wrong way, all the way. It's unreal, uncanny, makes you wonder if something is wrong, it seems to seek your attention for all the wrong reasons. Usually, we prefer the real thing, wine without sulfur based preservatives, real butter, not margarine, and so we'd like our layouts and designs to be filled with real words, with thoughts that count, information that has value.
<p>The toppings you may chose for that TV dinner pizza slice when you forgot to shop for foods, the paint you may slap on your face to impress the new boss is your business. But what about your daily bread? Design comps, layouts, wireframes—will your clients accept that you go about things the facile way? Authorities in our business will tell in no uncertain terms that Lorem Ipsum is that huge, huge no no to forswear forever. Not so fast, I'd say, there are some redeeming factors in favor of greeking text, as its use is merely the symptom of a worse problem to take into consideration.

<p>You begin with a text, you sculpt information, you chisel away what's not needed, you come to the point, make things clear, add value, you're a content person, you like words. Design is no afterthought, far from it, but it comes in a deserved second. Anyway, you still use Lorem Ipsum and rightly so, as it will always have a place in the web workers toolbox, as things happen, not always the way you like it, not always in the preferred order. Even if your less into design and more into content strategy you may find some redeeming value with, wait for it, dummy copy, no less.


<div id="citations"></div>
</div>
            
          
!
            
              cite { font-size: 11px; padding-right: 3px;}
#citations {font-size: 11px; margin-top: 2em; 
	span { padding-right: 1em;} 
}
code { color: lightgreen}

//formatting
#content { max-width: 800px; margin-left: auto; margin-right: auto; margin-top: 3em; padding-left: 1em; padding-right: 1em;}
html {	background-color: #222;	color: #eee;	font-family: 'Noto Serif SC', serif;	line-height: 1.4em; 	padding-bottom: 1em;
	a {
		color: orange;
	}
	-webkit-font-smoothing: antialiased;	-moz-osx-font-smoothing: grayscale;
}
h1 { line-light: 1.3em}
            
          
!
            
              let i = 0; // set the counter's starting point
let citeArray = [];

let citer = {
	init: (target) => {
		citer.createArray();
		citer.writeToDOM(target);
	},
	createArray: () => {
		$("cite").each( function() { //fat arrow make jQuery this goof
			i = i + 1; //citations do not start at 0 
			let newObj = {
				date :  $(this).data("date"),
				title: $(this).data("title"),
				source: $(this).data("source"),
				i: i
			}
			let duplicate = citer.checkDuplicates(newObj);
			if (duplicate === false) { //only push new instance if URL is different
					citeArray.push(newObj);
			}
		});
	},
	writeToDOM: (target) => {
		citeArray.forEach( (instance)  => {
			const subcite = `<a href="#cite${instance.i}">${instance.i}</a>`;
			const citation = `<a href="${instance.source}" id="cite${instance.i}">${instance.i} ${instance.title}</a>  <span>${instance.date}</span>`
			$(`[data-source="${instance.source}"]`).html(subcite);
			$(target).append(citation);
		});
	},
	checkDuplicates: (newObj) => {
    let duplicate = false;
		citeArray.forEach( (instance) => {
			if ( instance.source === newObj.source  ) {
				duplicate = true;
			}	
 	  });
		return duplicate;
	}
}
citer.init("#citations");
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console