1 /*============================================================================= 2 Copyright (c) 2002 2004 2006 Joel de Guzman 3 Copyright (c) 2004 Eric Niebler 4 http://spirit.sourceforge.net/ 5 6 Use, modification and distribution is subject to the Boost Software 7 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 8 http://www.boost.org/LICENSE_1_0.txt) 9 =============================================================================*/ 10 11 #include "markups.hpp" 12 #include <map> 13 #include <ostream> 14 #include "block_tags.hpp" 15 #include "for.hpp" 16 #include "phrase_tags.hpp" 17 #include "quickbook.hpp" 18 19 namespace quickbook 20 { 21 namespace detail 22 { 23 std::map<value::tag_type, markup> markups; 24 initialise_markups()25 void initialise_markups() 26 { 27 markup init_markups[] = { 28 {block_tags::paragraph, "<para>\n", "</para>\n"}, 29 {block_tags::paragraph_in_list, "<simpara>\n", "</simpara>\n"}, 30 {block_tags::blurb, "<sidebar role=\"blurb\">\n", 31 "</sidebar>\n"}, 32 {block_tags::blockquote, "<blockquote>", "</blockquote>"}, 33 {block_tags::preformatted, "<programlisting>", 34 "</programlisting>"}, 35 {block_tags::warning, "<warning>", "</warning>"}, 36 {block_tags::caution, "<caution>", "</caution>"}, 37 {block_tags::important, "<important>", "</important>"}, 38 {block_tags::note, "<note>", "</note>"}, 39 {block_tags::tip, "<tip>", "</tip>"}, 40 {block_tags::block, "", ""}, 41 {block_tags::ordered_list, "<orderedlist>", "</orderedlist>"}, 42 {block_tags::itemized_list, "<itemizedlist>", 43 "</itemizedlist>"}, 44 {block_tags::hr, "<para/>", 0}, 45 {phrase_tags::url, "<ulink url=\"", "</ulink>"}, 46 {phrase_tags::link, "<link linkend=\"", "</link>"}, 47 {phrase_tags::funcref, "<functionname alt=\"", 48 "</functionname>"}, 49 {phrase_tags::classref, "<classname alt=\"", "</classname>"}, 50 {phrase_tags::memberref, "<methodname alt=\"", "</methodname>"}, 51 {phrase_tags::enumref, "<enumname alt=\"", "</enumname>"}, 52 {phrase_tags::macroref, "<macroname alt=\"", "</macroname>"}, 53 {phrase_tags::headerref, "<headername alt=\"", "</headername>"}, 54 {phrase_tags::conceptref, "<conceptname alt=\"", 55 "</conceptname>"}, 56 {phrase_tags::globalref, "<globalname alt=\"", "</globalname>"}, 57 {phrase_tags::bold, "<emphasis role=\"bold\">", "</emphasis>"}, 58 {phrase_tags::italic, "<emphasis>", "</emphasis>"}, 59 {phrase_tags::underline, "<emphasis role=\"underline\">", 60 "</emphasis>"}, 61 {phrase_tags::teletype, "<literal>", "</literal>"}, 62 {phrase_tags::strikethrough, 63 "<emphasis role=\"strikethrough\">", "</emphasis>"}, 64 {phrase_tags::quote, "<quote>", "</quote>"}, 65 {phrase_tags::replaceable, "<replaceable>", "</replaceable>"}, 66 {phrase_tags::escape, "<!--quickbook-escape-prefix-->", 67 "<!--quickbook-escape-postfix-->"}, 68 {phrase_tags::break_mark, "<sbr/>\n", 0}}; 69 70 QUICKBOOK_FOR (markup m, init_markups) { 71 markups[m.tag] = m; 72 } 73 } 74 get_markup(value::tag_type t)75 markup const& get_markup(value::tag_type t) { return markups[t]; } 76 operator <<(std::ostream & out,markup const & m)77 std::ostream& operator<<(std::ostream& out, markup const& m) 78 { 79 return out << "{" << m.tag << ": \"" << m.pre << "\", \"" << m.post 80 << "\"}"; 81 } 82 } 83 } 84