# by Dag Wieërs
# http://github.com/dagwieers/asciidoc-odf

extension "odf"

### FIXME: Using class-names could make this a lot easier
### FIXME: But LibreOffice/Openoffice do not honor text:class-names (yet)
#styletemplate "<text:span text:class-names=\"$style\">$text</text:span>"
#styleseparator " "
#
#bold "strong$style"
#italics "emphasis$style"
#underline "underline$style"
#fixed "monospaced$style"
#color "$style"
#bgcolor "bg$style"

bold "<text:span text:style-name=\"strong\">$text</text:span>"
italics "<text:span text:style-name=\"emphasis\">$text</text:span>"
underline "<text:span text:style-name=\"underlined\">$text</text:span>"
fixed "<text:span text:style-name=\"monospaced\">$text</text:span>"
color "<text:span text:style-name=\"$style\">$text</text:span>"
bgcolor "<text:span text:style-name=\"bg$style\">$text</text:span>"

colormap
"green" "green"
"red" "red"
"darkred" "darkred"
"blue" "blue"
"brown" "brown"
"pink" "pink"
"yellow" "yellow"
"cyan" "cyan"
"purple" "purple"
"orange" "orange"
"brightorange" "brightorange"
"brightgreen" "brightgreen"
"darkgreen" "darkgreen"
"black" "black"
"teal" "teal"
"gray" "gray"
"darkblue" "darkblue"
default "black"
end

### FIXME: anchor and references missing

doctemplate
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<office:document
 xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"
 xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"
 xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"
 xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"
 xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
 xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"
 xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"
 office:version=\"1.2\"
 office:mimetype=\"application/vnd.oasis.opendocument.text\">

 <office:meta>
  <dc:title>$title</dc:title>
  <dc:description>$additional</dc:description>
  <meta:generator>source-highlight/3.1.4$GNU source-highlight</meta:generator>
 </office:meta>

 <office:font-face-decls>
  <style:font-face style:name=\"monospace\" svg:font-family=\"&apos;DejaVu Sans Mono&apos;\" style:font-adornments=\"Book\" style:font-family-generic=\"modern\" style:font-pitch=\"fixed\"/>
 </office:font-face-decls>

 <office:styles>
  <style:default-style style:family=\"paragraph\">
   <style:text-properties style:font-name=\"monospace\" fo:font-size=\"10pt\"/>
  </style:default-style>
 </office:styles>

 <office:automatic-styles>
  <style:page-layout style:name=\"Page\">
   <style:page-layout-properties fo:page-width=\"210.01mm\" fo:page-height=\"297mm\" style:num-format=\"1\" style:print-orientation=\"portrait\" fo:margin-top=\"15mm\" fo:margin-bottom=\"15mm\" fo:margin-left=\"20mm\" fo:margin-right=\"20mm\">
   </style:page-layout-properties>
  </style:page-layout>

  <style:style style:name=\"strong\" style:family=\"text\">
   <style:text-properties fo:font-weight=\"bold\"/>
  </style:style>

  <style:style style:name=\"emphasis\" style:family=\"text\">
   <style:text-properties fo:font-style=\"italic\"/>
  </style:style>

  <style:style style:name=\"underline\" style:family=\"text\">
   <style:text-properties style:text-underline-style=\"solid\" style:text-underline-width=\"auto\" style:text-underline-mode=\"continuous\" style:text-overline-mode=\"continuous\" style:text-line-through-mode=\"continuous\"/>
  </style:style>

  <style:style style:name=\"green\" style:family=\"text\"><style:text-properties fo:color=\"#33cc00\"/></style:style>
  <style:style style:name=\"red\" style:family=\"text\"><style:text-properties fo:color=\"#ff0000\"/></style:style>
  <style:style style:name=\"darkred\" style:family=\"text\"><style:text-properties fo:color=\"#990000\"/></style:style>
  <style:style style:name=\"blue\" style:family=\"text\"><style:text-properties fo:color=\"#0000ff\"/></style:style>
  <style:style style:name=\"brown\" style:family=\"text\"><style:text-properties fo:color=\"#9a1900\"/></style:style>
  <style:style style:name=\"pink\" style:family=\"text\"><style:text-properties fo:color=\"#cc33cc\"/></style:style>
  <style:style style:name=\"yellow\" style:family=\"text\"><style:text-properties fo:color=\"#ffcc00\"/></style:style>
  <style:style style:name=\"cyan\" style:family=\"text\"><style:text-properties fo:color=\"#66ffff\"/></style:style>
  <style:style style:name=\"purple\" style:family=\"text\"><style:text-properties fo:color=\"#993399\"/></style:style>
  <style:style style:name=\"orange\" style:family=\"text\"><style:text-properties fo:color=\"#ff6600\"/></style:style>
  <style:style style:name=\"brightorange\" style:family=\"text\"><style:text-properties fo:color=\"#ff9900\"/></style:style>
  <style:style style:name=\"brightgreen\" style:family=\"text\"><style:text-properties fo:color=\"#33ff33\"/></style:style>
  <style:style style:name=\"darkgreen\" style:family=\"text\"><style:text-properties fo:color=\"#009900\"/></style:style>
  <style:style style:name=\"black\" style:family=\"text\"><style:text-properties fo:color=\"#000000\"/></style:style>
  <style:style style:name=\"teal\" style:family=\"text\"><style:text-properties fo:color=\"#008080\"/></style:style>
  <style:style style:name=\"gray\" style:family=\"text\"><style:text-properties fo:color=\"#808080\"/></style:style>
  <style:style style:name=\"darkblue\" style:family=\"text\"><style:text-properties fo:color=\"#000080\"/></style:style>
  <style:style style:name=\"white\" style:family=\"text\"><style:text-properties fo:color=\"#000000\"/></style:style>
 </office:automatic-styles>

 <office:master-styles>
  <style:master-page style:name=\"Standard\" style:page-layout-name=\"Page\"/>
 </office:master-styles>

 <office:body>
  <office:text>
   <text:p>"
"</text:p>
  </office:text>
 </office:body>
</office:document>"
end

translations
" " "<text\:s/>"
"\n" "<text\:line-break/>"
"&" "&amp;"
"<" "&lt;"
">" "&gt;"
end
