Auto-generate title information from metadata
This commit is contained in:
parent
be846f801d
commit
3d003bc087
|
@ -13,19 +13,49 @@ add_filter {
|
|||
Pandoc = function(elem)
|
||||
local blocks, meta = elem.blocks, elem.meta
|
||||
|
||||
local page_title = utils.stringify(meta.title)
|
||||
local page_names = {}
|
||||
for k, v in ipairs(meta.titles) do
|
||||
page_names[k] = utils.stringify(v)
|
||||
end
|
||||
local page_firstname = page_names[1]
|
||||
local page_section = utils.stringify(meta.section)
|
||||
local page_manual = utils.stringify(meta.manual)
|
||||
local page_name, page_section = page_title:match("^([^%(]+)%(([^%)]+)%)$")
|
||||
local page_firsttitle = string.format("%s(%s)", page_firstname, page_section)
|
||||
local page_shortdesc = meta.shortdesc
|
||||
|
||||
-- add page title
|
||||
meta.title = pandoc.MetaString(string.format("%s | %s", text.upper(page_title), page_manual))
|
||||
meta.title = pandoc.MetaString(string.format("%s | %s", text.upper(page_firsttitle), page_manual))
|
||||
local startidx = 1
|
||||
if is_latex then
|
||||
local titleid = string.format("man:%s.%s", page_name, page_section)
|
||||
local titleobj = pandoc.Header(1, pandoc.Code(page_title))
|
||||
local titleid = string.format("man:%s.%s", page_firstname, page_section)
|
||||
local titleobj = pandoc.Header(1, pandoc.Code(page_firsttitle))
|
||||
titleobj.identifier = titleid
|
||||
blocks:insert(1, titleobj)
|
||||
for i = 2, #page_names do
|
||||
blocks:insert(i, pandoc.RawBlock("latex", string.format("\\label{man:%s.%s}", page_names[i], page_section)))
|
||||
end
|
||||
startidx = #page_names+1
|
||||
end
|
||||
|
||||
-- insert naming information
|
||||
if is_man then
|
||||
blocks:insert(1, pandoc.Header(1, "NAME"))
|
||||
startidx = 2
|
||||
end
|
||||
local format_name = pandoc.Code
|
||||
if is_man then
|
||||
format_name = pandoc.Str
|
||||
end
|
||||
local nameinfo = pandoc.Plain(format_name(page_firstname))
|
||||
for i = 2, #page_names do
|
||||
nameinfo.content:insert(pandoc.Str(", "))
|
||||
nameinfo.content:insert(format_name(page_names[i]))
|
||||
end
|
||||
nameinfo.content:insert(pandoc.Str(" - "))
|
||||
nameinfo.content:extend(page_shortdesc)
|
||||
blocks:insert(startidx, nameinfo)
|
||||
startidx = startidx + 1
|
||||
|
||||
-- add "See Also" section
|
||||
local seealso = elem.meta.seealso
|
||||
if not seealso then
|
||||
|
@ -58,8 +88,8 @@ add_filter {
|
|||
if is_latex then
|
||||
add_filter {
|
||||
Str = function(elem)
|
||||
if elem.tex == "Advtrains" then
|
||||
return pandoc.RawInline("latex", "\\advtrains{}")
|
||||
if elem.text == "Advtrains" then
|
||||
return pandoc.SmallCaps("advtrains")
|
||||
end
|
||||
end
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
---
|
||||
title: 'rwt_add(3advtrains)'
|
||||
titles:
|
||||
- rwt_add
|
||||
- rwt_diff
|
||||
- rwt_sub
|
||||
section: 3advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: add or subtract railway time objects
|
||||
---
|
||||
|
||||
# Name
|
||||
`add`, `diff`, `sub` - Add or subtract railway time objects
|
||||
|
||||
# Synopsis
|
||||
|
||||
* `add(t1, t2)`
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
---
|
||||
title: 'rwt_copy(3advtrains)'
|
||||
titles:
|
||||
- rwt_copy
|
||||
- rwt_new
|
||||
- rwt_to_table
|
||||
- rwt_to_secs
|
||||
- rwt_to_string
|
||||
section: 3advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: create and copy railway time objects
|
||||
---
|
||||
|
||||
# Name
|
||||
`copy`, `new`, `to_table`, `to_secs`, `to_string` - Create and copy railway time objects
|
||||
|
||||
# Synopsis
|
||||
|
||||
* `copy(obj)`
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
---
|
||||
title: 'rwt_last_rpt(3advtrains)'
|
||||
titles:
|
||||
- rwt_last_rpt
|
||||
- rwt_next_rpt
|
||||
- rwt_time_from_last_rpt
|
||||
- rwt_time_to_next_rpt
|
||||
section: 3advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: calculate time for repeating events
|
||||
---
|
||||
|
||||
# Name
|
||||
`last_rpt`, `next_rpt`, `time_from_last_rpt`, `time_to_next_rpt` - Calculate time for repeating events
|
||||
|
||||
# Synopsis
|
||||
|
||||
* `last_rpt(time, interval, offset)`
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: 'rwt_now(3advtrains)'
|
||||
titles:
|
||||
- rwt_now
|
||||
section: 3advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: get the current railway time
|
||||
---
|
||||
|
||||
# Name
|
||||
`now` - Get the current railway time
|
||||
|
||||
# Description
|
||||
`now()` returns the current railway time as a table.
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
---
|
||||
title: 'speed_lessp(3advtrains)'
|
||||
titles:
|
||||
- speed_lessp
|
||||
- speed_greaterp
|
||||
- speed_equalp
|
||||
- speed_not_lessp
|
||||
- speed_not_greaterp
|
||||
- speed_not_equalp
|
||||
- speed_min
|
||||
- speed_max
|
||||
section: 3advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: compare speed limits
|
||||
---
|
||||
|
||||
# Name
|
||||
`lessp`, `greaterp`, `equalp`, `not_lessp`, `not_greaterp`, `not_equalp`, `min`, `max` - Speed limit comparison functions
|
||||
|
||||
# Synopsis
|
||||
|
||||
* `lessp(a, b)`
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
---
|
||||
title: 'speed_set_restriction(3advtrains)'
|
||||
titles:
|
||||
- speed_set_restriction
|
||||
- speed_merge_aspect
|
||||
section: 3advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: apply speed limits to trains
|
||||
---
|
||||
|
||||
# Name
|
||||
`set_restriction`, `merge_aspect` - Apply speed limits to trains
|
||||
|
||||
# Synopsis
|
||||
|
||||
* `set_restriction(train, type, val)`
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
title: 'node_definition(7advtrains)'
|
||||
titles:
|
||||
- node_definition
|
||||
section: 7advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: node definition entries specific to Advtrains
|
||||
seealso:
|
||||
- signal_aspects(7advtrains)
|
||||
---
|
||||
|
||||
# Name
|
||||
`node_definition` - Advtrains-specific node definition entries
|
||||
|
||||
# Description
|
||||
This page describes various fields in node definition tables that are used by Advtrains.
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
title: 'rwt(7advtrains)'
|
||||
titles:
|
||||
- rwt
|
||||
section: 7advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: Advtrains railway time
|
||||
seealso:
|
||||
- rwt_add(3advtrains)
|
||||
- rwt_copy(3advtrains)
|
||||
|
@ -8,9 +11,6 @@ seealso:
|
|||
- rwt_now(3advtrains)
|
||||
---
|
||||
|
||||
# Name
|
||||
`rwt` - Advtrains railway time
|
||||
|
||||
# Description
|
||||
Advtrains depends on Minetest's "dtime" for most operations, and may slow itself down when necessary to prevent unexpected behavior, such as in a situation with a significant amount of lag. As a result, the internal time used by Advtrains is not synchronized to real-life time due to lag and server restarts. Railway time was therefore introduced as a method of accurately measuring internal time and, with this information, implementing a scheduling system. It can, however, also be set up to keep in sync with real-life time.
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
title: 'signal_aspects(7advtrains)'
|
||||
titles:
|
||||
- signal_aspects
|
||||
section: 7advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: signal aspect tables for Advtrains
|
||||
seealso:
|
||||
- speed(7advtrains)
|
||||
---
|
||||
|
||||
# Name
|
||||
`signal_aspects` - Signal aspect tables for Advtrains
|
||||
|
||||
# Description
|
||||
A signal aspect table describes the status of a signal in relation to a train following it.
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
title: 'speed(7advtrains)'
|
||||
titles:
|
||||
- speed
|
||||
section: 7advtrains
|
||||
manual: 'Advtrains Developer''s Manual'
|
||||
shortdesc: Advtrains speed limit library
|
||||
seealso:
|
||||
- speed_lessp(3advtrains)
|
||||
- speed_set_restriction(3advtrains)
|
||||
- signal_aspects(7advtrains)
|
||||
---
|
||||
|
||||
# Name
|
||||
`speed` - Advtrains speed limit library
|
||||
|
||||
# Description
|
||||
The speed library allows the manipulation of speed limits, which can be represented with
|
||||
|
||||
|
|
Loading…
Reference in New Issue