Replies: 6 comments 4 replies
-
That seems fairly sensible, but it would be a bit weird if we enabled the |
Beta Was this translation helpful? Give feedback.
-
It could be used with Divs and Spans too. A Div with custom_styles="mystyle" could surround its content with \startmystyle … \stopmystyle. A Span with the same attribute would place its content in the unique argument of the macro \mystyle. Both \mystyle and \startmystyle … \stopmystyle could be defined by the user with \definestartstop[mystyle][...=...,...] (examples here: https://wiki.contextgarden.net/Command/definestartstop).
|
Beta Was this translation helpful? Give feedback.
-
I'm asking to the ConTeXt mailing list for the best ways to express Span
and paragraphs (Div) custom styles.
As I wrote, \definestartstop[mystyle] can define both \startmystyle … \stopmystyle (block-level) and \mystyle{…} (inline). There is an example of that in the page linked above.
Pandoc should put a \definestartstop[mystyle] at the start of the
document, leaving to the user to "fill" it with
\setupmystyle[...=..., ....] in the template or inside a RawBlock.
I think that it is good enough.
- there could be clashes with existing \start ... \stop environments
(e.g. "narrower")
Sure, but it does not seem a problem to me to let the user check this as he decides to use custom styles instead of the default constructs provided by Pandoc. This is a bit like RawInlines giving the user the power to generate an invalid document.
|
Beta Was this translation helpful? Give feedback.
-
This would be useful for LaTeX too. Not perhaps for tables (are there any packages for tables with "styles"?) but definitely for Divs/environments and Spans/commands. Of course it should be subject to an extension which is off by default. This probably goes without saying but in case it does not... I'm (unsurprisingly) currently doing this with filters, although I call my attributes I even have some filters which use mini-templates (defined as Code(Block)s in metadata or in external files) so that you can interpolate values from attributes or (a subtree of) metadata and insert a RawBlock/RawInline with the result before and/or after the Div/Span. One version uses a fairly "sophisticated" library using Lpeg/re; the others uses a simple Ideally Pandoc should make arguments available as key—value pairs to TeX, at least such with some prefix. There is the question of how to handle that in LaTeX. There is the keycommand package, but it has been unmaintained for a long time and AFAIK still is. |
Beta Was this translation helpful? Give feedback.
-
This would be useful for LaTeX too.
Not perhaps for tables (are there any packages for tables with
"styles"?) but definitely for Divs/environments and Spans/commands.
Of course it should be subject to an extension which is off by default.
This probably goes without saying but in case it does not...
Sure!
Ideally Pandoc should make arguments available as key—value pairs to
TeX, at least such with some prefix. There is the question of how to
handle that in LaTeX. There is the keycommand package, but it has
been unmaintained for a long time and AFAIK still is.
https://ctan.org/pkg/expkv-bundle should work with all TeX formats.
|
Beta Was this translation helpful? Give feedback.
-
The implementation for ConTeXt could be this: ...\start[myStyle]text with character custom style\stop{}... for For ...
\start[myStyle]
paragraphs (blocks) with custom paragraph style
\stop
... That works without errors even when there's no
For simplicity, I'd follow @badumont advice of leaving to the user to check clashes with existing ConTeXt environments; I thank Wolfgang Schuster of the ConTeXt Group for the advice he gave me on this topic:
\starttext
before \start[important]inbetween\stop{} after
\definestartstop [important] [color=red,style=bold]
before \start[important]inbetween\stop{} after
\stoptext |
Beta Was this translation helpful? Give feedback.
-
This is a feature request to have
\startxtable[myCustomStyle]
instead of simply\startxtable
in ConTeXt output, when aTable
block has acustom-style
attribute (in the example its value is "myCustomStyle").Pandoc 3.4 added support for
custom-style
attribute in Docx writer.Such attribute could be used in ConTeXt output too.
Pandoc's ConTeXt writer outputs a table as:
When the table has a
custom-style
attribute, e.g. with value "myStyle", the output could be:so that you could customize the table with these ConTeXt commands:
These custom definitions could be written in a user-defined template, or in a
RawBlock
of typecontext
preceding theTable
in the document.Without the definitions,
\startxtable[myStyle]
would be equivalent to\startxtable
in ConTeXt output: you would just get some error messages in its log, but the table would be there, just not customized.For further reference, you can see the Extreme tables manual and \setupxtable in the ConTeXt WIKI.
Beta Was this translation helpful? Give feedback.
All reactions