Commits

Philipp Gesang  committed a4c94b9

compensate for buffers leaving spaces

  • Participants
  • Parent commits 5fc085d

Comments (0)

Files changed (3)

-Copyright 2010-2011 Philipp Gesang. All rights reserved.
+Copyright 2010-2012 Philipp Gesang. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
 Read the section *Features Not Implemented* in the manual first.
 
-*Note*: if you happen to read this on BitBucket, the error messages some lines
-below just mean that *their* implementation doesn’t understand TeX directives.
+*Note*: if you happen to read this on BitBucket_, the error messages some lines
+below just mean that *their* implementation doesn’t understand |TeX| directives.
 Don’t worry, |rstcontext| does.
 
 ============
 ``com`` (find me on BitBucket_).
 
 .. |rstcontext| ctx:: {{\em rst}\kern.5pt\CONTEXT}
+.. |TeX| ctx:: {\TEX}
 .. |CONTEXT| ctx:: {\CONTEXT}
 
 .. _Contact: megas.kapaneus@gmail.com

File mod/tex/context/third/rst/rst_directives.lua

 --        USAGE:  called by rst_parser.lua
 --  DESCRIPTION:  Complement to the reStructuredText parser
 --       AUTHOR:  Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
---      CHANGED:  2011-08-28 13:47:00+0200
+--      CHANGED:  2012-06-05 21:18:54+0200
 --------------------------------------------------------------------------------
 --
 
     return mpcode
 end
 
+--- There’s an issue with buffers leaving trailing spaces due to their
+--- implementation.
+--- http://archive.contextgarden.net/message/20111108.175913.1d994624.en.html
 rst_directives.ctx = function(name, data)
     local ctx = fmt([[
 
-\startbuffer[%s]
+\startbuffer[%s]%%
 %s\stopbuffer
 \def\RSTsubstitution%s{%%
-  \getbuffer[%s]%%
+  \getbuffer[%s]\removeunwantedspaces%%
 }
 ]], name, data, name, name)
     return ctx
 rst_directives.lua = function(name, data)
     local luacode = fmt([[
 
-\startbuffer[%s]
+\startbuffer[%s]%%
 \startluacode
 %s
 \stopluacode
 \stopbuffer
 \def\RSTsubstitution%s{%%
-  \getbuffer[%s]%%
+  \getbuffer[%s]\removeunwantedspaces%%
 }
 ]], name, data, name, name)
     return luacode