Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Generate dependent CSL style
require 'csl' # gem install csl --pre
style = do |s|
s['class'] = 'in-text'
s['default-locale'] = 'en-US'
s.title = 'Natura' = ''
# add default self link to id
s.independent_parent_link = ''
s.documentation_link = '' = '7283-0918' = 'numeric' = { field: 'biology'} = { field: 'physics'}
# style.dependent? #-> true
# style.independent_parent #-> would load and parse the parent style
# style.valid? #-> would make sure the style is valid
# add the default CC license
# tag the updated field with the current time!
# puts style.to_xml #-> would output the style as xml
puts style.to_s #-> pretty prints the style as xml
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="" version="1.0" class="in-text" default-locale="en-US">
<link href="" rel="self"/>
<link href="" rel="independent-parent"/>
<link href="" rel="documentation"/>
<category citation-format="numeric"/>
<category field="biology"/>
<category field="physics"/>
<updated>2013-03-28 18:33:35 +0100</updated>
<rights license="">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>

This comment has been minimized.

Copy link
Owner Author

@inukshuk inukshuk commented Mar 28, 2013

This should include the xmlns in the style node – that's most likely a bug in the gem version, will be fixed upstream. : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.