Cite web generator
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
Makefile
README.markdown
aiwatchsql-minified.js
aiwatchsql-part.js
citeweb_example.png
common.js
ff_example.png
main.js
markdown-minified.js
markdown-part.js
markdownfootnote-minified.js
markdownfootnote-part.js
mediawiki-minified.js
mediawiki-part.js
mediawikinotemplate-minified.js
mediawikinotemplate-part.js

README.markdown

Citewebgen

Citewebgen is a Cite web generator. It is a single JavaScript file that can be installed as a bookmarklet on a browser.

Features

  • Detection of all common fields
  • Support for the quote field if text is selected on the page
  • Date reported in UTC
  • Works on all browsers supporting JavaScript

Installation

You can install the script by copying the contents of the minified script into a bookmark.

Minified scripts for Markdown and Markdown footnote versions are also available.

Examples

From https://www.theguardian.com/global-development-professionals-network/2015/dec/04/funding-humanitarian-assistance-development-aid on Firefox:

Firefox example

From http://www.wikihow.com/Archive-Websites-on-Unix-Like-Systems on Google Chrome:

Example output

Caveats

On Firefox, some websites (e.g. GitHub and Twitter) block bookmarklets from executing. If you have the developer console open while trying to run the script, you will see the following message:

Content Security Policy: The page’s settings blocked the loading of a resource at self

I'm not sure how to fix this on Firefox, but one workaround is to open the same page on Chrome and run Citewebgen there.

See here or here for more information.

Adding a new filetype

In this section, by "filetype" we mean the output formats, like MediaWiki, Markdown, or Markdown footnote. Citewebgen is written in a modular way, so that it is possible to easily add new filetypes. The files common.js and main.js are used for all filetypes. To add a new filetype, all you need to do is implement the printStr function. This function takes as input a dictionary called metadata with all of the metadata in separate key-value pairs. The function must return a string. You can look at the samples mediawiki-part.js, markdown-part.js, and markdownfootnote-part.js to see how the function is implemented for the existing filetypes.

Once you have implemented printStr, place that in a file called newfiletype-part.js. Then do:

(echo 'javascript:(function(){' && cat common.js newfiletype-part.js main.js && echo '})();') > temp.js
yui-compressor temp.js > newfiletype-minified.js
rm -f temp.js

Now the final bookmarklet is stored in newfiletype-minified.js.

Acknowledgements

Special thanks to Ark25 for creating and hosting RefScript. I referred to the source of RefScript while working on Citewebgen. Both scripts are in the public domain.