← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/fh1-finish_help into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/fh1-finish_help into lp:widelands.

Commit message:
Converted the Tribal Encyclopedia to the new font renderer.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/fh1-finish_help/+merge/335708
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-finish_help into lp:widelands.
=== modified file 'data/scripting/richtext.lua'
--- data/scripting/richtext.lua	2017-12-27 14:25:35 +0000
+++ data/scripting/richtext.lua	2018-01-04 15:35:20 +0000
@@ -436,6 +436,7 @@
 --
 function inline_header(header, text)
    return
-      div("width=100%",  font("size=13 color=D1D1D1", header .. " ") ..
+      div("width=100%", vspace(8)) ..
+      div("width=100%", font("size=13 color=D1D1D1", header .. " ") ..
       font("size=12", text))
 end

=== modified file 'data/tribes/buildings/productionsites/barbarians/coalmine/helptexts.lua'
--- data/tribes/buildings/productionsites/barbarians/coalmine/helptexts.lua	2016-04-15 16:46:20 +0000
+++ data/tribes/buildings/productionsites/barbarians/coalmine/helptexts.lua	2018-01-04 15:35:20 +0000
@@ -1,7 +1,10 @@
 function building_helptext_lore()
-   -- TRANSLATORS#: Lore helptext for a building
-   return pgettext("barbarians_building", [[Ages ago, the Barbarians learned to delve into mountainsides for that black material that feeds their furnaces. <br>
-Wood may serve for a household fire and to keep you warm, but when it comes to working with iron or gold, there is no way around coal.]])
+   return {
+      -- TRANSLATORS: Lore helptext for a coal mine building, part 1
+      pgettext("barbarians_building", "Ages ago, the Barbarians learned to delve into mountainsides for that black material that feeds their furnaces."),
+      -- TRANSLATORS: Lore helptext for a coal mine building, part 2
+      pgettext("barbarians_building", "Wood may serve for a household fire and to keep you warm, but when it comes to working with iron or gold, there is no way around coal.")
+   }
 end
 
 function building_helptext_lore_author()
@@ -10,7 +13,7 @@
 end
 
 function building_helptext_purpose()
-   -- TRANSLATORS#: Purpose helptext for a building
+   -- TRANSLATORS: Purpose helptext for a building
    return pgettext("building", "Digs coal out of the ground in mountain terrain.")
 end
 

=== modified file 'data/tribes/buildings/productionsites/barbarians/coalmine_deep/helptexts.lua'
--- data/tribes/buildings/productionsites/barbarians/coalmine_deep/helptexts.lua	2016-04-15 16:46:20 +0000
+++ data/tribes/buildings/productionsites/barbarians/coalmine_deep/helptexts.lua	2018-01-04 15:35:20 +0000
@@ -1,7 +1,10 @@
 function building_helptext_lore()
-   -- TRANSLATORS#: Lore helptext for a building
-   return pgettext("barbarians_building", [[Ages ago, the Barbarians learned to delve into mountainsides for that black material that feeds their furnaces. <br>
-Wood may serve for a household fire and to keep you warm, but when it comes to working with iron or gold, there is no way around coal.]])
+   return {
+      -- TRANSLATORS: Lore helptext for a coal mine building, part 1
+      pgettext("barbarians_building", "Ages ago, the Barbarians learned to delve into mountainsides for that black material that feeds their furnaces."),
+      -- TRANSLATORS: Lore helptext for a coal mine building, part 2
+      pgettext("barbarians_building", "Wood may serve for a household fire and to keep you warm, but when it comes to working with iron or gold, there is no way around coal.")
+   }
 end
 
 function building_helptext_lore_author()
@@ -10,7 +13,7 @@
 end
 
 function building_helptext_purpose()
-   -- TRANSLATORS#: Purpose helptext for a building
+   -- TRANSLATORS: Purpose helptext for a building
    return pgettext("building", "Digs coal out of the ground in mountain terrain.")
 end
 

=== modified file 'data/tribes/buildings/productionsites/barbarians/coalmine_deeper/helptexts.lua'
--- data/tribes/buildings/productionsites/barbarians/coalmine_deeper/helptexts.lua	2016-04-15 16:46:20 +0000
+++ data/tribes/buildings/productionsites/barbarians/coalmine_deeper/helptexts.lua	2018-01-04 15:35:20 +0000
@@ -1,7 +1,10 @@
 function building_helptext_lore()
-   -- TRANSLATORS#: Lore helptext for a building
-   return pgettext("barbarians_building", [[Ages ago, the Barbarians learned to delve into mountainsides for that black material that feeds their furnaces. <br>
-Wood may serve for a household fire and to keep you warm, but when it comes to working with iron or gold, there is no way around coal.]])
+   return {
+      -- TRANSLATORS: Lore helptext for a coal mine building, part 1
+      pgettext("barbarians_building", "Ages ago, the Barbarians learned to delve into mountainsides for that black material that feeds their furnaces."),
+      -- TRANSLATORS: Lore helptext for a coal mine building, part 2
+      pgettext("barbarians_building", "Wood may serve for a household fire and to keep you warm, but when it comes to working with iron or gold, there is no way around coal.")
+   }
 end
 
 function building_helptext_lore_author()
@@ -10,7 +13,7 @@
 end
 
 function building_helptext_purpose()
-   -- TRANSLATORS#: Purpose helptext for a building
+   -- TRANSLATORS: Purpose helptext for a building
    return pgettext("building", "Digs coal out of the ground in mountain terrain.")
 end
 

=== modified file 'data/tribes/buildings/productionsites/barbarians/granitemine/helptexts.lua'
--- data/tribes/buildings/productionsites/barbarians/granitemine/helptexts.lua	2017-06-25 06:54:53 +0000
+++ data/tribes/buildings/productionsites/barbarians/granitemine/helptexts.lua	2018-01-04 15:35:20 +0000
@@ -4,8 +4,13 @@
 end
 
 function building_helptext_lore_author()
-   -- TRANSLATORS: Lore author helptext for a building
-   return pgettext("barbarians_building", [[This phrase was the reply Rimbert the miner – later known as Rimbert the loner – gave, when he was asked to remain seated on an emergency meeting at Stonford in the year of the great flood. <br> The same man had all the 244 granite blocks ready only a week later, and they still fortify the city’s levee.]])
+
+   return {
+      -- TRANSLATORS: Lore author helptext for a granite mine building, part 1
+      pgettext("barbarians_building", "This phrase was the reply Rimbert the miner – later known as Rimbert the loner – gave, when he was asked to remain seated on an emergency meeting at Stonford in the year of the great flood."),
+      -- TRANSLATORS: Lore author helptext for a granite mine building, part 2
+      pgettext("barbarians_building", "The same man had all the 244 granite blocks ready only a week later, and they still fortify the city’s levee.")
+   }
 end
 
 function building_helptext_purpose()

=== modified file 'data/tribes/buildings/productionsites/barbarians/well/helptexts.lua'
--- data/tribes/buildings/productionsites/barbarians/well/helptexts.lua	2015-12-02 04:01:09 +0000
+++ data/tribes/buildings/productionsites/barbarians/well/helptexts.lua	2018-01-04 15:35:20 +0000
@@ -5,7 +5,7 @@
 
 function building_helptext_lore_author()
    -- TRANSLATORS: Lore author helptext for a building
-   return pgettext("barbarians_building", [[Song written by Sigurd the Bard<br>when the first rain fell after the Great Drought in the 21st year of Chat’Karuth’s reign.]])
+   return pgettext("barbarians_building", [[Song written by Sigurd the Bard when the first rain fell after the Great Drought in the 21st year of Chat’Karuth’s reign.]])
 end
 
 function building_helptext_purpose()

=== modified file 'data/tribes/scripting/help/building_help.lua'
--- data/tribes/scripting/help/building_help.lua	2016-10-01 07:43:45 +0000
+++ data/tribes/scripting/help/building_help.lua	2018-01-04 15:35:20 +0000
@@ -15,6 +15,24 @@
 --  =======================================================
 
 -- RST
+-- .. function:: building_section_line(header, text, image)
+--
+--    Creates a line of h3 formatted text followed by normal text and an image.
+--
+--    :arg t1: header text.
+--    :arg t2: in-line paragraphs text.
+--    :arg image: image to be aligned right.
+--    :returns: header followed by normal text and image.
+--
+function building_section_line(header, text, image)
+   return
+      div("width=100%",
+         div("width=50%", p_font("size=13 color=D1D1D1", vspace(6) .. text .. space(6))) ..
+         div("width=*", p("align=right", vspace(6) .. img(image) .. vspace(12)))
+      )
+end
+
+-- RST
 -- .. function:: dependencies_basic(images[, text = nil])
 --
 --    Creates a dependencies line of any length.
@@ -28,12 +46,11 @@
       text = ""
    end
 
-   local string = "image=" .. images[1]
+   local imgstring = img(images[1])
    for k,v in ipairs({table.unpack(images,2)}) do
-      string = string .. ";images/richtext/arrow-right.png;" .. v
+      imgstring = imgstring .. img("images/richtext/arrow-right.png") .. img(v)
    end
-
-   return rt(string, text)
+   return p(imgstring .. text)
 end
 
 
@@ -51,11 +68,11 @@
    if not text then
       text = ""
    end
-   local string = "image=tribes/immovables/" .. resource  .. "/idle_00.png"
-   for k,v in ipairs({table.unpack(items)}) do
-      string = string .. ";images/richtext/arrow-right.png;" ..  v.icon_name
+   local items_with_resouce = { "tribes/immovables/" .. resource  .. "/idle_00.png" }
+   for count, item in pairs(items) do
+      table.insert(items_with_resouce, item.icon_name)
    end
-   return rt(string, p(text))
+   return dependencies_basic(items_with_resouce, text)
 end
 
 
@@ -86,14 +103,19 @@
       if (countlist > 1) then
          text = _"%s and":bformat(text)
       end
-      local images = food_images[1]
+      local images = img(food_images[1])
       for k,v in ipairs({table.unpack(food_images,2)}) do
-         images = images .. ";" .. v
+         images = images .. img(v)
       end
-      result = image_line(images, 1, p(text)) .. result
+      result =
+         div("width=100%",
+            div("width=50%", p(vspace(6) .. text .. space(6))) ..
+            div("width=*", p("align=right", vspace(6) .. images .. vspace(12)))
+         )
+         .. result
    end
    if (result ~= "") then
-      result = rt(h3(_"Food:")) .. result
+      result = h3(_"Food:") .. result
    end
    return result
 end
@@ -124,24 +146,26 @@
    for producer, weaponnames in pairs(producers) do
       local producer_description = wl.Game():get_building_description(producer)
       local weaponsstring = ""
+      local weaponslist = { producer_description.icon_name }
       for weaponname, hasweapon in pairs(weaponnames) do
          if (hasweapon) then
-            if(weaponsstring ~= "") then
-               weaponsstring = weaponsstring .. ";"
-            end
             local weapon_description = wl.Game():get_ware_description(weaponname)
-            weaponsstring = weaponsstring .. weapon_description.icon_name
+            if (#weaponslist < 2) then
+                  table.insert(weaponslist, weapon_description.icon_name)
+               else
+                  weaponsstring = weaponsstring .. img(weapon_description.icon_name)
+            end
          end
       end
       building_count = building_count + 1;
       result = result ..
          dependencies_basic(
-            {producer_description.icon_name, weaponsstring},
-            rt(p(producer_description.descname))
-      )
+            weaponslist,
+            weaponsstring .. " " .. producer_description.descname
+         )
    end
    if (result ~= "") then
-      result = rt(h3(_"Equipment:")) .. result
+      result = h3(_"Equipment:") .. result
    end
    return result
 end
@@ -164,16 +188,29 @@
 --
 function building_help_general_string(tribe, building_description)
    -- TRANSLATORS: Heading for a flavour text in the building help.
-   local result = rt(h2(_"Lore")) ..
-      rt("image=" .. building_description.representative_image, p(building_helptext_lore()))
-   if (building_helptext_lore_author() ~= "") then
-      result = result .. rt("text-align=right",
-                            p("font-size=10 font-style=italic",
-                              building_helptext_lore_author()))
-   end
-
-   result = result .. rt(h2(_"General"))
-   result = result .. rt(h3(_"Purpose:"))
+   local result = h2(_"Lore")
+   local lore_text = building_helptext_lore()
+   if type(lore_text) == "table" then
+      result = result .. li_image(building_description.representative_image, lore_text[1])
+      for k,v in ipairs({table.unpack(lore_text, 2)}) do
+         result = result .. p(v)
+      end
+   else
+    result = result ..
+      li_image(building_description.representative_image, lore_text)
+   end
+
+   local lore_author = building_helptext_lore_author()
+
+   if type(lore_author) ~= "table" then
+      lore_author = { building_helptext_lore_author() }
+   end
+   for i, item in ipairs(lore_author) do
+      result = result .. div("width=100%", p_font("align=right", "size=10 italic=1", item .. vspace(3)))
+   end
+
+   result = result .. h2(_"General")
+   result = result .. h3(_"Purpose:")
 
 -- TODO(GunChleoc) "carrier" for headquarters, "ship" for ports, "scout" for scouts_hut, "shipwright" for shipyard?
 -- TODO(GunChleoc) use aihints for gamekeeper, forester?
@@ -195,35 +232,35 @@
    end
 
    if(representative_resource) then
-      result = result .. image_line(representative_resource.icon_name, 1, p(building_helptext_purpose()))
+      result = result .. li_image(representative_resource.icon_name, building_helptext_purpose())
    else
-      result = result .. rt(p(building_helptext_purpose()))
+      result = result .. p(building_helptext_purpose())
    end
 
    if (building_helptext_note() ~= "") then
-      result = result .. rt(h3(_"Note:")) .. rt(p(building_helptext_note()))
+      result = result .. h3(_"Note:") .. p(building_helptext_note())
    end
 
    if(building_description.type_name == "productionsite") then
       if(building_description.workarea_radius and building_description.workarea_radius > 0) then
-         result = result .. text_line(_"Work area radius:", building_description.workarea_radius)
+         result = result .. inline_header(_"Work area radius:", building_description.workarea_radius)
       end
 
    elseif(building_description.type_name == "warehouse") then
-      result = result .. rt(h3(_"Healing:")
-         .. p(ngettext("Garrisoned soldiers heal %d health point per second.", "Garrisoned soldiers heal %d health points per second.", building_description.heal_per_second):bformat(building_description.heal_per_second)))
-      result = result .. text_line(_"Conquer range:", building_description.conquers)
+      result = result .. inline_header(_"Healing:",
+         ngettext("Garrisoned soldiers heal %d health point per second.", "Garrisoned soldiers heal %d health points per second.", building_description.heal_per_second):bformat(building_description.heal_per_second))
+      result = result .. inline_header(_"Conquer range:", building_description.conquers)
 
    elseif(building_description.type_name == "militarysite") then
-      result = result .. rt(h3(_"Healing:")
-         .. p(ngettext("Garrisoned soldiers heal %d health point per second.", "Garrisoned soldiers heal %d health points per second.", building_description.heal_per_second):bformat(building_description.heal_per_second)))
-      result = result .. text_line(_"Capacity:", building_description.max_number_of_soldiers)
-      result = result .. text_line(_"Conquer range:", building_description.conquers)
+      result = result .. h3(_"Healing:")
+         .. p(ngettext("Garrisoned soldiers heal %d health point per second.", "Garrisoned soldiers heal %d health points per second.", building_description.heal_per_second):bformat(building_description.heal_per_second))
+      result = result .. inline_header(_"Capacity:", building_description.max_number_of_soldiers)
+      result = result .. inline_header(_"Conquer range:", building_description.conquers)
 
    elseif(building_description.type_name == "trainingsite") then
-      result = result .. text_line(_"Capacity:", building_description.max_number_of_soldiers)
+      result = result .. inline_header(_"Capacity:", building_description.max_number_of_soldiers)
    end
-   result = result .. text_line(_"Vision range:", building_description.vision_range)
+   result = result .. inline_header(_"Vision range:", building_description.vision_range)
    return result
 end
 
@@ -255,11 +292,11 @@
    end
    if (hasinput) then
       -- TRANSLATORS: Heading in the building help for wares that a building accepts (e.g. wheat for a mill).
-      result =  rt(h3(_"Incoming:")) .. result
+      result =  h3(_"Incoming:") .. result
    end
 
    if ((not hasinput) and building_description.output_ware_types[1]) then
-      result = result .. rt(h3(_"Collects:"))
+      result = result .. h3(_"Collects:")
       for i, ware_description in ipairs(building_description.output_ware_types) do
          result = result ..
             dependencies({building_description, ware_description}, ware_description.descname)
@@ -271,7 +308,7 @@
 
    elseif (building_description.is_mine) then
       -- TRANSLATORS: This is a verb (The miner mines)
-      result = result .. rt(h3(_"Mines:"))
+      result = result .. h3(_"Mines:")
       for i, ware_description in ipairs(building_description.output_ware_types) do
 
          -- Need to hack this, because resource != produced ware.
@@ -291,7 +328,7 @@
 
    else
       if(building_description.output_ware_types[1] or building_description.output_worker_types[1]) then
-         result = result .. rt(h3(_"Produces:"))
+         result = result .. h3(_"Produces:")
       end
       for i, ware_description in ipairs(building_description.output_ware_types) do
          result = result ..
@@ -333,10 +370,10 @@
          end
       end
    end
-   if (outgoing ~= "") then result = result .. rt(h3(_"Outgoing:")) .. outgoing end
+   if (outgoing ~= "") then result = result .. h3(_"Outgoing:") .. outgoing end
 
-   if (result == "") then result = rt(p(_"None")) end
-   return rt(h2(_"Dependencies")) .. result
+   if (result == "") then result = p(_"None") end
+   return h2(_"Dependencies") .. result
 end
 
 -- RST
@@ -352,10 +389,10 @@
 function building_help_dependencies_training(tribe, building_description)
    local result = ""
    if (building_description.max_health and building_description.min_health) then
-      result = result .. rt(h2(_"Health Training"))
-      result = result .. rt(p(_"Trains ‘Health’ from %1% up to %2%":
-            bformat(building_description.min_health, building_description.max_health+1)))
-      result = result .. rt(h3(_"Soldiers:"))
+      result = result .. h2(_"Health Training")
+      result = result .. p(_"Trains ‘Health’ from %1% up to %2%":
+            bformat(building_description.min_health, building_description.max_health+1))
+      result = result .. h3(_"Soldiers:")
       result = result ..
          dependencies_basic({
             "tribes/workers/" .. tribe.name .. "/soldier/health_level" .. building_description.min_health .. ".png",
@@ -365,11 +402,11 @@
       result = result .. dependencies_training_weapons(building_description.weapons_health)
    end
    if (building_description.max_attack and building_description.min_attack) then
-      result = result .. rt(h2(_"Attack Training"))
+      result = result .. h2(_"Attack Training")
       -- TRANSLATORS: %1$s = Health, Evade, Attack or Defense. %2$s and %3$s are numbers.
-      result = result .. rt(p(_"Trains ‘Attack’ from %1% up to %2%":
-         bformat(building_description.min_attack, building_description.max_attack+1)))
-      result = result .. rt(h3(_"Soldiers:")) ..
+      result = result .. p(_"Trains ‘Attack’ from %1% up to %2%":
+         bformat(building_description.min_attack, building_description.max_attack+1))
+      result = result .. h3(_"Soldiers:") ..
          dependencies_basic({
             "tribes/workers/" .. tribe.name .. "/soldier/attack_level" .. building_description.min_attack .. ".png",
             building_description.icon_name,
@@ -378,10 +415,10 @@
       result = result .. dependencies_training_weapons(building_description.weapons_attack)
    end
    if (building_description.max_defense and building_description.min_defense) then
-      result = result .. rt(h2(_"Defense Training"))
-      result = result .. rt(p( _"Trains ‘Defense’ from %1% up to %2%":
-            bformat(building_description.min_defense, building_description.max_defense+1)))
-            result = result .. rt(h3(_"Soldiers:"))
+      result = result .. h2(_"Defense Training")
+      result = result .. p( _"Trains ‘Defense’ from %1% up to %2%":
+            bformat(building_description.min_defense, building_description.max_defense+1))
+            result = result .. h3(_"Soldiers:")
       result = result ..
          dependencies_basic({
             "tribes/workers/" .. tribe.name .. "/soldier/defense_level" .. building_description.min_defense .. ".png",
@@ -391,10 +428,10 @@
       result = result .. dependencies_training_weapons(building_description.weapons_defense)
    end
    if (building_description.max_evade and building_description.min_evade) then
-      result = result .. rt(h2(_"Evade Training"))
-      result = result .. rt(p( _"Trains ‘Evade’ from %1% up to %2%":
-            bformat(building_description.min_evade, building_description.max_evade+1)))
-      result = result .. rt(h3(_"Soldiers:"))
+      result = result .. h2(_"Evade Training")
+      result = result .. p( _"Trains ‘Evade’ from %1% up to %2%":
+            bformat(building_description.min_evade, building_description.max_evade+1))
+      result = result .. h3(_"Soldiers:")
       result = result ..
          dependencies_basic({
             "tribes/workers/" .. tribe.name .. "/soldier/evade_level" .. building_description.min_evade .. ".png",
@@ -419,20 +456,20 @@
 --
 function building_help_building_section(building_description)
    -- TRANSLATORS: This is the header for the "Building" section in the building help, containing size info, buildcost etc.
-   local result = rt(h2(_"Building"))
+   local result = h2(_"Building")
 
    -- Space required
    if (building_description.is_mine) then
-      result = result .. text_line(_"Space required:",_"Mine plot","images/wui/overlays/mine.png")
+      result = result .. building_section_line(_"Space required:",_"Mine plot","images/wui/overlays/mine.png")
    elseif (building_description.is_port) then
-      result = result .. text_line(_"Space required:",_"Port plot","images/wui/overlays/port.png")
+      result = result .. building_section_line(_"Space required:",_"Port plot","images/wui/overlays/port.png")
    else
       if (building_description.size == "small") then
-         result = result .. text_line(_"Space required:",_"Small plot","images/wui/overlays/small.png")
+         result = result .. building_section_line(_"Space required:",_"Small plot","images/wui/overlays/small.png")
       elseif (building_description.size == "medium") then
-         result = result .. text_line(_"Space required:",_"Medium plot","images/wui/overlays/medium.png")
+         result = result .. building_section_line(_"Space required:",_"Medium plot","images/wui/overlays/medium.png")
       elseif (building_description.size == "big") then
-         result = result .. text_line(_"Space required:",_"Big plot","images/wui/overlays/big.png")
+         result = result .. building_section_line(_"Space required:",_"Big plot","images/wui/overlays/big.png")
       else
          result = result .. p(_"Space required:" .. _"Unknown")
       end
@@ -442,16 +479,16 @@
    if (building_description.buildable or building_description.enhanced) then
 
       if (building_description.buildable and building_description.enhanced) then
-         result = result .. text_line(_"Note:",
+         result = result .. inline_header(_"Note:",
             _"This building can either be built directly or obtained by enhancing another building.")
       end
 
       if (building_description.buildable) then
          -- Build cost
          if (building_description.buildable and building_description.enhanced) then
-            result = result .. rt(h3(_"Direct build cost:"))
+            result = result .. h3(_"Direct build cost:")
          else
-            result = result .. rt(h3(_"Build cost:"))
+            result = result .. h3(_"Build cost:")
          end
          for ware, amount in pairs(building_description.build_cost) do
             local ware_description = wl.Game():get_ware_description(ware)
@@ -462,9 +499,9 @@
       if (building_description.enhanced) then
          former_building = building_description.enhanced_from
             if (building_description.buildable) then
-               result = result .. text_line(_"Or enhanced from:", former_building.descname)
+               result = result .. inline_header(_"Or enhanced from:", former_building.descname)
             else
-               result = result .. text_line(_"Enhanced from:", former_building.descname)
+               result = result .. inline_header(_"Enhanced from:", former_building.descname)
             end
 
          for ware, amount in pairs(building_description.enhancement_cost) do
@@ -473,7 +510,7 @@
          end
 
          -- Cumulative cost
-         result = result .. rt(h3(_"Cumulative cost:"))
+         result = result .. h3(_"Cumulative cost:")
          local warescost = {}
          for ware, amount in pairs(building_description.enhancement_cost) do
             if (warescost[ware]) then
@@ -518,20 +555,20 @@
                result = result .. help_ware_amount_line(ware_description, amount)
             end
          else
-            result = result .. rt(p(_"Unknown"))
+            result = result .. p(_"Unknown")
          end
 
          -- Dismantle yields
          if (building_description.buildable) then
-            result = result .. rt(h3(_"If built directly, dismantle yields:"))
+            result = result .. h3(_"If built directly, dismantle yields:")
             for ware, amount in pairs(building_description.returned_wares) do
                local ware_description = wl.Game():get_ware_description(ware)
                result = result .. help_ware_amount_line(ware_description, amount)
             end
-            result = result .. rt(h3(_"If enhanced, dismantle yields:"))
+            result = result .. h3(_"If enhanced, dismantle yields:")
          else
             -- TRANSLATORS: This is a heading for the resources that you will get back when you dismantle a building of this type. What dismantling will give you.
-            result = result .. rt(h3(_"Dismantle yields:"))
+            result = result .. h3(_"Dismantle yields:")
          end
          local warescost = {}
          for ware, amount in pairs(building_description.returned_wares_enhanced) do
@@ -567,12 +604,12 @@
                result = result .. help_ware_amount_line(ware_description, amount)
             end
          else
-            result = result .. rt(p(_"Unknown"))
+            result = result .. p(_"Unknown")
          end
       -- Buildable
       else
          -- Dismantle yields
-         result = result .. rt(h3(_"Dismantle yields:"))
+         result = result .. h3(_"Dismantle yields:")
          for ware, amount in pairs(building_description.returned_wares) do
             local ware_description = wl.Game():get_ware_description(ware)
             result = result .. help_ware_amount_line(ware_description, amount)
@@ -581,7 +618,7 @@
 
       -- Can be enhanced to
       if (building_description.enhancement) then
-         result = result .. text_line(_"Can be enhanced to:", building_description.enhancement.descname)
+         result = result .. inline_header(_"Can be enhanced to:", building_description.enhancement.descname)
          for ware, amount in pairs(building_description.enhancement.enhancement_cost) do
             local ware_description = wl.Game():get_ware_description(ware)
             result = result .. help_ware_amount_line(ware_description, amount)
@@ -611,7 +648,7 @@
 
    if(building_description.type_name == "productionsite" or building_description.type_name == "trainingsite") then
 
-      result = result .. rt(h2(_"Workers")) .. rt(h3(_"Crew required:"))
+      result = result .. h2(_"Workers") .. h3(_"Crew required:")
 
       local worker_description = building_description.working_positions[1]
       local becomes_description = nil
@@ -644,30 +681,12 @@
          local tool_string = help_tool_string(tribe, toolnames, number_of_workers)
          if (tool_string ~= "") then
             -- TRANSLATORS: Tribal Encyclopedia: Heading for which tool workers use
-            result = result .. rt(h3(ngettext("Worker uses:","Workers use:", number_of_workers))) .. tool_string
+            result = result .. h3(ngettext("Worker uses:","Workers use:", number_of_workers)) .. tool_string
          end
       end
 
-      if(becomes_description) then
-
-         result = result .. rt(h3(_"Experience levels:"))
-         -- TRANSLATORS: EP = Experience Points
-         local exp_string = _"%s to %s (%s EP)":format(
-               worker_description.descname,
-               becomes_description.descname,
-               worker_description.needed_experience
-            )
-
-         worker_description = becomes_description
-         becomes_description = worker_description.becomes
-         if(becomes_description) then
-            exp_string = exp_string .. "<br>" .. _"%s to %s (%s EP)":format(
-                  worker_description.descname,
-                  becomes_description.descname,
-                  worker_description.needed_experience
-               )
-         end
-         result = result ..  rt("text-align=right", p(exp_string))
+      if (becomes_description) then
+         result = result .. help_worker_experience(worker_description, becomes_description)
       end
    end
 
@@ -684,8 +703,8 @@
 --
 function building_help_production_section()
    if (building_helptext_performance() ~= "") then
-      return rt(h2(_"Production")) ..
-        text_line(_"Performance:", building_helptext_performance())
+      return h2(_"Production") ..
+        inline_header(_"Performance:", building_helptext_performance())
    else
       return ""
    end
@@ -733,6 +752,8 @@
             building_description.type_name == "dismantlesite") then
             -- TODO(GunChleoc) Get them a crew string for the builder
       return building_help_general_string(tribe, building_description)
+   elseif (building_description.type_name == "market") then
+      return building_help_general_string(tribe, building_description)
    else
       return ""
    end

=== modified file 'data/tribes/scripting/help/format_help.lua'
--- data/tribes/scripting/help/format_help.lua	2017-01-21 09:39:55 +0000
+++ data/tribes/scripting/help/format_help.lua	2018-01-04 15:35:20 +0000
@@ -4,7 +4,7 @@
 --
 -- Functions used in the ingame help windows for formatting the text and pictures.
 
-include "scripting/formatting.lua"
+include "scripting/richtext.lua"
 
 --  =======================================================
 --  *************** Basic helper functions ****************
@@ -22,17 +22,19 @@
 --    :returns: the text on the left and a picture row on the right.
 --
 function image_line(image, count, text)
-   local imgs={}
+   if not text then
+      text = ""
+   end
+   local images = ""
    for i=1,count do
-      imgs[#imgs + 1] = image
+      images = images .. img(image)
    end
-   local imgstr = table.concat(imgs, ";")
 
-   if text then
-      return rt("image=" .. imgstr .. " image-align=right", "  " .. text)
-   else
-      return rt("image=" .. imgstr .. " image-align=right", "")
-   end
+   return
+      div("width=100%",
+         div("width=50%", p(vspace(6) .. text .. space(6))) ..
+         div("width=*", p("align=right", vspace(6) .. images .. vspace(12)))
+      )
 end
 
 
@@ -54,11 +56,12 @@
    if not text then
       text = ""
    end
-   local string = "image=" .. items[1].icon_name
+   local images = img(items[1].icon_name)
    for k,v in ipairs({table.unpack(items,2)}) do
-      string = string .. ";images/richtext/arrow-right.png;" ..  v.icon_name
+      images = images .. img("images/richtext/arrow-right.png") ..  img(v.icon_name)
    end
-   return rt(string, p(text))
+   return
+      div("width=100%", p(vspace(6) .. images .. space(6) .. text .. vspace(12)))
 end
 
 
@@ -88,6 +91,38 @@
 end
 
 -- RST
+-- .. function:: help_worker_experience(worker_description, becomes_description)
+--
+--    Displays needed experience levels for workers
+--
+--    :arg worker_description: The :class:`LuaWorkerDescription` for the lower-level worker
+--    :arg becomes_description: The :class:`LuaWorkerDescription` for the higher-level worker
+--    :returns: text describing the needed experience
+--
+function help_worker_experience(worker_description, becomes_description)
+   local result = h2(_"Experience levels")
+   -- TRANSLATORS: EP = Experience Points
+   local exp_string = _"%s to %s (%s EP)":format(
+         worker_description.descname,
+         becomes_description.descname,
+         worker_description.needed_experience
+      )
+
+   worker_description = becomes_description
+   becomes_description = worker_description.becomes
+   if(becomes_description) then
+     -- TRANSLATORS: EP = Experience Points
+      exp_string = exp_string .. "<br>" .. _"%s to %s (%s EP)":format(
+            worker_description.descname,
+            becomes_description.descname,
+            worker_description.needed_experience
+         )
+   end
+   result = result .. p("align=right", exp_string)
+   return result
+end
+
+-- RST
 -- .. function:: help_tool_string(tribe, toolname, no_of_workers)
 --
 --    Displays tools with an intro text and images
@@ -152,20 +187,25 @@
       if (countlist > 1) then
          text = _"%s and":bformat(text)
       end
-      local images = consumed_images[1]
-      local image_counter = 2
+      local images = ""
+      local image_counter = 1
       while (image_counter <= consumed_amount[1]) do
-         images = images .. ";" .. consumed_images[1]
+         images = images .. img(consumed_images[1])
          image_counter = image_counter + 1
       end
       for k, v in ipairs({table.unpack(consumed_images,2)}) do
          image_counter = 1
          while (image_counter <= consumed_amount[k + 1]) do
-            images = images .. ";" .. v
+            images = images .. img(v)
             image_counter = image_counter + 1
          end
       end
-      consumed_items_string = image_line(images, 1, p(text)) .. consumed_items_string
+      consumed_items_string =
+         div("width=100%",
+            div("width=50%", p(vspace(6) .. text .. space(6))) ..
+            div("width=*", p("align=right", vspace(6) .. images .. vspace(12)))
+         )
+         .. consumed_items_string
    end
    if (consumed_items_counter > 0) then
       local consumed_header = ""
@@ -181,7 +221,7 @@
          -- TRANSLATORS: Tribal Encyclopedia: Heading for wares consumed by a productionsite
          consumed_header = _("Wares consumed:")
       end
-      result = result .. rt(h3(consumed_header)) .. consumed_items_string
+      result = result .. h3(consumed_header) .. consumed_items_string
    end
    return result
 end

=== modified file 'data/tribes/scripting/help/ware_help.lua'
--- data/tribes/scripting/help/ware_help.lua	2017-01-21 09:39:55 +0000
+++ data/tribes/scripting/help/ware_help.lua	2018-01-04 15:35:20 +0000
@@ -33,8 +33,8 @@
    purpose_text = pgettext("sentence_separator", "%s %s"):bformat(ware_helptext(), ware_helptext(tribe.name))
 
    -- TODO(GunChleoc): Split into purpose and note
-   local result = rt(h2(_"Purpose")) ..
-      rt("image=" .. ware_description.icon_name, p(purpose_text))
+   local result = h2(_"Purpose") ..
+      li_image(ware_description.icon_name, purpose_text)
    return result
 end
 
@@ -53,7 +53,7 @@
    for i, building in ipairs(ware_description.producers) do
       if (tribe:has_building(building.name)) then
          -- TRANSLATORS: Ware Encyclopedia: A building producing a ware
-         result = result .. rt(h2(_"Producer"))
+         result = result .. h2(_"Producer")
          result = result .. dependencies({building, ware_description}, building.descname)
 
          -- Find out which programs in the building produce this ware
@@ -94,7 +94,7 @@
             if (produced_wares_counters[program_name] > 0) then
                result = result
                   -- TRANSLATORS: Ware Encyclopedia: Wares produced by a productionsite
-                  .. rt(h3(ngettext("Ware produced:", "Wares produced:", produced_wares_counters[program_name])))
+                  .. h3(ngettext("Ware produced:", "Wares produced:", produced_wares_counters[program_name]))
                   .. produced_wares_strings[program_name]
             end
          end
@@ -155,7 +155,7 @@
    -- Now show consumers (buildings + workers)
    if (consumers_amount > 0) then
       -- TRANSLATORS: Ware Encyclopedia: A list of buildings and / or workers that consume a ware
-      result = result .. rt(h2(ngettext("Consumer", "Consumers", consumers_amount)))
+      result = result .. h2(ngettext("Consumer", "Consumers", consumers_amount))
       if (consumers ~= "") then
          result = result .. consumers_string
       end

=== modified file 'data/tribes/scripting/help/worker_help.lua'
--- data/tribes/scripting/help/worker_help.lua	2017-01-21 09:39:55 +0000
+++ data/tribes/scripting/help/worker_help.lua	2018-01-04 15:35:20 +0000
@@ -35,7 +35,7 @@
 
          if (recruits_this) then
             -- TRANSLATORS: Worker Encyclopedia: A building recruiting a worker
-            result = result .. rt(h2(_"Producer"))
+            result = result .. h2(_"Producer")
             result = result .. dependencies({building, worker_description}, building.descname)
 
             -- Find out which programs in the building recruit this worker if any
@@ -76,7 +76,7 @@
                if (recruited_workers_counters[program_name] > 0) then
                   result = result
                      -- TRANSLATORS: Worker Encyclopedia: Workers recruited by a productionsite
-                     .. rt(h3(ngettext("Worker recruited:", "Workers recruited:", recruited_workers_counters[program_name])))
+                     .. h3(ngettext("Worker recruited:", "Workers recruited:", recruited_workers_counters[program_name]))
                      .. recruited_workers_strings[program_name]
                end
             end
@@ -102,7 +102,7 @@
    if (#employers > 0) then
       -- TRANSLATORS: Worker Encyclopedia: A list of buildings where a worker can work
       -- TRANSLATORS: You can also translate this as 'workplace(s)'
-      result = result .. rt(h2(ngettext("Works at", "Works at", #employers)))
+      result = result .. h2(ngettext("Works at", "Works at", #employers))
       for i, building in ipairs(worker_description.employers) do
          result = result .. dependencies({worker_description, building}, building.descname)
       end
@@ -126,8 +126,8 @@
 function worker_help_string(tribe, worker_description)
    include(worker_description.helptext_script)
 
-   local result = rt(h2(_"Purpose")) ..
-      rt("image=" .. worker_description.icon_name, p(worker_helptext()))
+   local result = h2(_"Purpose") ..
+      li_image(worker_description.icon_name, worker_helptext())
 
    if (worker_description.is_buildable) then
       -- Get the tools for the workers.
@@ -141,7 +141,7 @@
       if (#toolnames > 0) then
          local tool_string = help_tool_string(tribe, toolnames, 1)
          -- TRANSLATORS: Tribal Encyclopedia: Heading for which tool a worker uses
-         result = result .. rt(h2(_"Worker uses")) .. tool_string
+         result = result .. h2(_"Worker uses") .. tool_string
       end
    else
       result = result .. worker_help_producers_string(tribe, worker_description)
@@ -153,75 +153,59 @@
    local becomes_description = worker_description.becomes
    if (becomes_description) then
 
-      result = result .. rt(h2(_"Experience levels"))
-      local exp_string = _"%s to %s (%s EP)":format(
-            worker_description.descname,
-            becomes_description.descname,
-            worker_description.needed_experience
-         )
-
-      worker_description = becomes_description
-      becomes_description = worker_description.becomes
-      if(becomes_description) then
-         exp_string = exp_string .. "<br>" .. _"%s to %s (%s EP)":format(
-               worker_description.descname,
-               becomes_description.descname,
-               worker_description.needed_experience
-            )
-      end
-      result = result .. rt("text-align=right", p(exp_string))
+      result = result .. help_worker_experience(worker_description, becomes_description)
    end
    -- Soldier properties
    if (worker_description.type_name == "soldier") then
       -- TRANSLATORS: Soldier levels
-      result = result .. rt(h2(_"Levels"))
+      result = result .. h2(_"Levels")
 
-      result = result .. rt(h3(_"Health"))
-      result = result .. rt(p(
-         listitem_bullet(
+      result = result .. h3(_"Health")
+      result = result ..
+         li(
             -- TRANSLATORS: Soldier health / defense / evade points. A 5 digit number.
             (_"Starts at %1% points."):bformat(worker_description.base_health)) ..
-         listitem_bullet(
+         li(
             -- TRANSLATORS: Soldier health / attack defense / evade points
             ngettext("Increased by %1% point for each level.", "Increased by %1% points for each level.", worker_description.health_incr_per_level):bformat(worker_description.health_incr_per_level)) ..
-         listitem_bullet(
+         li(
             -- TRANSLATORS: Soldier health / attack defense / evade level
-            ngettext("The maximum level is %1%.", "The maximum level is %1%.", worker_description.max_health_level):bformat(worker_description.max_health_level))))
+            ngettext("The maximum level is %1%.", "The maximum level is %1%.", worker_description.max_health_level):bformat(worker_description.max_health_level))
 
-      result = result .. rt(h3(_"Attack"))
-      result = result .. rt(p(
+      result = result .. h3(_"Attack")
+      result = result ..
       -- TRANSLATORS: Points are 4 digit numbers.
-         listitem_bullet(_"A random value between %1% and %2% points is added to each attack."):bformat(worker_description.base_min_attack, worker_description.base_max_attack) ..
+         li(_"A random value between %1% and %2% points is added to each attack."):bformat(worker_description.base_min_attack, worker_description.base_max_attack) ..
 
-         listitem_bullet(
+         li(
             ngettext("Increased by %1% point for each level.", "Increased by %1% points for each level.", worker_description.attack_incr_per_level):bformat(worker_description.attack_incr_per_level)) ..
-         listitem_bullet(
-            ngettext("The maximum level is %1%.", "The maximum level is %1%.", worker_description.max_attack_level):bformat(worker_description.max_attack_level))))
+         li(
+            ngettext("The maximum level is %1%.", "The maximum level is %1%.", worker_description.max_attack_level):bformat(worker_description.max_attack_level))
 
-      result = result .. rt(h3(_"Defense"))
+      result = result .. h3(_"Defense")
       if (worker_description.max_defense_level > 0) then
-         result = result .. rt(p(
-            listitem_bullet(
+         result = result ..
+            li(
                (_"Starts at %d%%."):bformat(worker_description.base_defense)) ..
-            listitem_bullet(
+            li(
                (_"Increased by %d%% for each level."):bformat(worker_description.defense_incr_per_level)) ..
-            listitem_bullet(
-               ngettext("The maximum level is %1%.", "The maximum level is %1%.", worker_description.max_defense_level):bformat(worker_description.max_defense_level))))
+            li(
+               ngettext("The maximum level is %1%.", "The maximum level is %1%.", worker_description.max_defense_level):bformat(worker_description.max_defense_level))
       else
-         result = result .. rt(p(
-            listitem_bullet(
+         result = result ..
+            li(
                (_"Starts at %d%%."):bformat(worker_description.base_defense)) ..
-            listitem_bullet(_"This soldier cannot be trained in defense.")))
+            li(_"This soldier cannot be trained in defense.")
       end
 
-      result = result .. rt(h3(_"Evade"))
-      result = result .. rt(p(
-         listitem_bullet(
+      result = result .. h3(_"Evade")
+      result = result ..
+         li(
             (_"Starts at %d%%."):bformat(worker_description.base_evade)) ..
-         listitem_bullet(
+         li(
             (_"Increased by %d%% for each level."):bformat(worker_description.evade_incr_per_level)) ..
-         listitem_bullet(
-            ngettext("The maximum level is %1%.", "The maximum level is %1%.", worker_description.max_evade_level):bformat(worker_description.max_evade_level))))
+         li(
+            ngettext("The maximum level is %1%.", "The maximum level is %1%.", worker_description.max_evade_level):bformat(worker_description.max_evade_level))
    end
    return result
 end

=== modified file 'src/wui/encyclopedia_window.cc'
--- src/wui/encyclopedia_window.cc	2017-12-28 14:57:00 +0000
+++ src/wui/encyclopedia_window.cc	2018-01-04 15:35:20 +0000
@@ -40,13 +40,6 @@
 
 constexpr int kPadding = 5;
 constexpr int kTabHeight = 35;
-// TODO(GunChleoc): Remove when all help is converted to new font renderer
-const std::string heading(const std::string& text) {
-	return ((boost::format("<rt><p font-size=18 font-weight=bold font-color=D1D1D1>"
-	                       "%s<br></p><p font-size=8> <br></p></rt>") %
-	         text)
-	           .str());
-}
 
 }  // namespace
 
@@ -173,21 +166,8 @@
 			cr->resume();
 			table = cr->pop_table();
 		}
-
-		// TODO(GunChleoc): Remove this when all in-game help has been converted.
-		try {
-			contents_.at(tab_name)->force_new_renderer();
-			contents_.at(tab_name)
-			   ->set_text(as_message(table->get_string("title"), table->get_string("text")));
-		} catch (const std::exception& e) {
-			log("Encyclopedia: falling back to OLD font renderer: %s\n", e.what());
-			contents_.at(tab_name)->force_new_renderer(false);
-			contents_.at(tab_name)
-			   ->set_text((boost::format("%s%s") % heading(table->get_string("title")) %
-			               table->get_string("text"))
-			                 .str());
-		}
-
+		contents_.at(tab_name)->force_new_renderer();
+		contents_.at(tab_name)->set_text(as_message(table->get_string("title"), table->get_string("text")));
 	} catch (LuaError& err) {
 		contents_.at(tab_name)->set_text(err.what());
 	}


Follow ups