From 624597b9a1dcc821a2d6b2ad000f134f75f5ef96 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 3 Jun 2013 18:55:29 +0200 Subject: fix single-line image directives --- mod/tex/context/third/rst/rst_directives.lua | 9 ++++++--- mod/tex/context/third/rst/rst_parser.lua | 4 ++-- mod/tex/context/third/rst/rst_setups.lua | 14 +++++++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'mod/tex/context') diff --git a/mod/tex/context/third/rst/rst_directives.lua b/mod/tex/context/third/rst/rst_directives.lua index d1be13b..b64bafc 100644 --- a/mod/tex/context/third/rst/rst_directives.lua +++ b/mod/tex/context/third/rst/rst_directives.lua @@ -4,7 +4,7 @@ -- USAGE: called by rst_parser.lua -- DESCRIPTION: Complement to the reStructuredText parser -- AUTHOR: Philipp Gesang (Phg), --- CHANGED: 2013-03-26 22:45:45+0100 +-- CHANGED: 2013-06-03 18:52:35+0200 -------------------------------------------------------------------------------- -- @@ -73,19 +73,22 @@ local function img_setup (properties) end rst_directives.image = function(data) + rst_context.addsetups "image" local inline_parser = rst_context.inline_parser local properties = {} local anon = false local rdi = rst_directives.images local hp = helpers.patterns local caption = "" - local name + local name = "" if data.name then name = stringstrip(data.name) data.name = nil else - name = data[1] + if next(data[1]) then + name = data[1][1] + end end --rd.anonymous = rd.anonymous + 1 diff --git a/mod/tex/context/third/rst/rst_parser.lua b/mod/tex/context/third/rst/rst_parser.lua index a397f55..2dcc4d3 100644 --- a/mod/tex/context/third/rst/rst_parser.lua +++ b/mod/tex/context/third/rst/rst_parser.lua @@ -5,7 +5,7 @@ -- DESCRIPTION: https://bitbucket.org/phg/context-rst/overview -- AUTHOR: Philipp Gesang (Phg), -- VERSION: 0.6 --- CHANGED: 2013-03-26 22:45:59+0100 +-- CHANGED: 2013-06-03 18:52:42+0200 -------------------------------------------------------------------------------- -- @@ -197,7 +197,7 @@ local parser = P{ * V"directive_indented_lines" , - directive_block_single = Ct(C((1 - V"eol")^1)) * V"eol", + directive_block_single = V"whitespace"^1 * Ct(C((1 - V"eol")^1)) * V"eol", -------------------------------------------------------------------------------- -- Substitution definition block diff --git a/mod/tex/context/third/rst/rst_setups.lua b/mod/tex/context/third/rst/rst_setups.lua index de70d4b..7dd8161 100644 --- a/mod/tex/context/third/rst/rst_setups.lua +++ b/mod/tex/context/third/rst/rst_setups.lua @@ -4,7 +4,7 @@ -- USAGE: called by rst_parser.lua -- DESCRIPTION: Complement to the reStructuredText parser -- AUTHOR: Philipp Gesang (Phg), --- CHANGED: 2013-03-26 23:55:20+0100 +-- CHANGED: 2013-06-03 18:52:29+0200 -------------------------------------------------------------------------------- -- @@ -361,5 +361,17 @@ function optional_setups.citator () return cit end +function optional_setups.image () + local image = [[ + +%---------------------------------------------------------------% +% images % +%---------------------------------------------------------------% +\setupexternalfigure[location={local,global,default}] + +]] + return image +end + return optional_setups -- cgit v1.2.3