diff --git a/scripts/gh-book/opf-file.coffee b/scripts/gh-book/opf-file.coffee
index 7dcd200b..ca26cea8 100644
--- a/scripts/gh-book/opf-file.coffee
+++ b/scripts/gh-book/opf-file.coffee
@@ -10,7 +10,8 @@ define [
'cs!gh-book/uuid'
'hbs!templates/gh-book/defaults/opf'
'hbs!templates/gh-book/defaults/nav'
- 'hbs!templates/gh-book/nav-metadata'
+ 'hbs!templates/gh-book/nav-body-metadata'
+ 'hbs!templates/gh-book/nav-head-metadata'
], (
Backbone,
mediaTypes,
@@ -23,7 +24,8 @@ define [
uuid,
defaultOpf,
defaultNav,
- navMetadata
+ navBodyMetadata,
+ navHeadMetadata
) ->
SAVE_DELAY = 10 # ms
@@ -69,9 +71,12 @@ define [
# This way we can ignore firing events when Backbone is parsing as well as
# when we are internally updating models.
setNavModel = (options) =>
+ console.log 'here'
if not options.doNotReparse
+ console.log 'here2'
options.doNotReparse = true
- @navModel.set 'body', @_serializeNavModel(), options
+ @navModel.set 'head', @_serializeNavModelHead(), options
+ @navModel.set 'body', @_serializeNavModelBody(), options
# if we're updating the nav the spine also probably needs to be updated
@_buildSpine()
@@ -99,7 +104,9 @@ define [
return if not value
container = @$xml.find('metadata')
- selector = tagName.replace(':', '\\:')
+
+ # remove any namespace on the tagname so jquery will work
+ selector = tagName.replace(/.*:/, '')
element = @$xml[0].createElement(tagName)
@@ -147,7 +154,10 @@ define [
return if not values.length
container = @$xml.find('metadata')
- selector = tagName.replace(':', '\\:')
+
+ # remove any namespace on the tagname so jquery will work
+ selector = tagName.replace(/.*:/, '')
+
template = @$xml[0].createElement(tagName)
_.forIn attributes, (value, key) ->
@@ -184,7 +194,7 @@ define [
container = @$xml.find('metadata')
template = ""
- @$xml.find('dc\\:subject').not('[xsi\\:type="http://github.com/Connexions/rhaptos.cnxmlutils/rhaptos/cnxmlutils/schema"]').remove()
+ @$xml.find('subject').not('[xsi\\:type="http://github.com/Connexions/rhaptos.cnxmlutils/rhaptos/cnxmlutils/schema"]').remove()
_.each(value, (keyword) ->
container.append(' ')
@@ -202,7 +212,7 @@ define [
return if not creators.length
# remove the existing ones so we don't get dupes
- @$xml.find('dc\\:creator[id^="'+type+'"]').remove()
+ @$xml.find('creator[id^="'+type+'"]').remove()
@$xml.find('meta[refines^="#'+type+'"]').remove()
container = @$xml.find('metadata')
@@ -452,12 +462,12 @@ define [
@_markDirty({}) if start != @serialize()
- _serializeNavModel: () ->
- $wrapper = $('
')
+ _serializeNavModelHead: () ->
+ return navHeadMetadata(@toJSON())
- $wrapper
- .append(navMetadata(@toJSON()))
- .append('')
+ _serializeNavModelBody: () ->
+ $wrapper = $('')
+ $wrapper.append('')
$nav = $wrapper.find 'nav'
@@ -494,7 +504,7 @@ define [
# Trim the HTML and put newlines between elements
html = $wrapper.html()
html = html.replace(/>\n<')
- return html
+ return navBodyMetadata(@toJSON()) + html
parse: (json) ->
diff --git a/templates/gh-book/nav-body-metadata.html b/templates/gh-book/nav-body-metadata.html
new file mode 100644
index 00000000..3a83196a
--- /dev/null
+++ b/templates/gh-book/nav-body-metadata.html
@@ -0,0 +1,5 @@
+ {{ title }}
+ {{#if authors }}By: {{#each authors }}{{#if @index }}, {{/if}}{{ this }}{{/each}}{{/if}}
+ {{#if publishers }}Published By: {{#each publishers }}{{#if @index }}, {{/if}}{{ this }}{{/each}}{{/if}}
+ {{#if description }}{{ description }}
{{/if}}
+ Table of Contents
diff --git a/templates/gh-book/nav-metadata.html b/templates/gh-book/nav-head-metadata.html
similarity index 54%
rename from templates/gh-book/nav-metadata.html
rename to templates/gh-book/nav-head-metadata.html
index 2e05d597..adc6d3e0 100644
--- a/templates/gh-book/nav-metadata.html
+++ b/templates/gh-book/nav-head-metadata.html
@@ -1,25 +1,19 @@
{{ title }}
- {{#if language }}{{/if}}
- {{#if rights }}{{/if}}
- {{#if rightsUrl }}{{/if}}
- {{#if dateModified }}{{/if}}
- {{#if datePublished }}{{/if}}
- {{#each subject}}
+ {{#if language }}{{/if}}
+ {{#if rights }}{{/if}}
+ {{#if rightsUrl }}{{/if}}
+ {{#if dateModified }}{{/if}}
+ {{#if datePublished }}{{/if}}
+ {{#each subject}}
{{/each}}
- {{#each keywords}}
+ {{#each keywords}}
{{/each}}
- {{#each rightsHolders}}
+ {{#each rightsHolders}}
{{/each}}
- {{#each editors }}
+ {{#each editors }}
{{/each}}
- {{#each translators }}
-
+ {{#each translators }}
+
{{/each}}
- {{#each illustrators }}
+ {{#each illustrators }}
{{/each}}
-
- {{ title }}
- {{#if authors }}By: {{#each authors }}{{#if @index }}, {{/if}}{{ this }}{{/each}}{{/if}}
- {{#if publishers }}Published By: {{#each publishers }}{{#if @index }}, {{/if}}{{ this }}{{/each}}{{/if}}
- {{#if description }}{{ description }}
{{/if}}
- Table of Contents