From: "T. Kurt Bond" <tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: I need tables in ConTeXt output to NOT float
Date: Wed, 14 Jul 2021 23:28:25 -0400 [thread overview]
Message-ID: <CAN1EhV-v2rayAb+oWQbcPcjccXcfRqwwdjpwjdn8g3==bhb6OA@mail.gmail.com> (raw)
In-Reply-To: <CAN1EhV_dFDBA28NCsXAiTS+f-nAQCx5zLymm=tAywQ9XHj1OQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 552 bytes --]
Ok, here's a fixed patch.
--
T. Kurt Bond, tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAN1EhV-v2rayAb%2BoWQbcPcjccXcfRqwwdjpwjdn8g3%3D%3Dbhb6OA%40mail.gmail.com.
[-- Attachment #1.2: Type: text/html, Size: 1162 bytes --]
[-- Attachment #2: no-table-force.patch --]
[-- Type: application/octet-stream, Size: 4227 bytes --]
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index a6df12715..9b2c4f699 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -958,6 +958,10 @@ options =
UTF8.hPutStr stdout (T.pack $ usageMessage prg options)
exitSuccess ))
"" -- "Show help"
+ , Option "" ["no-table-float"]
+ (NoArg
+ (\opt -> return opt { optTableFloat = False }))
+ "" -- "Do not let tables float"
]
getDataFileNames :: IO [FilePath]
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs
index d54d932b7..569d6d82c 100644
--- a/src/Text/Pandoc/App/Opt.hs
+++ b/src/Text/Pandoc/App/Opt.hs
@@ -160,6 +160,7 @@ data Opt = Opt
, optCSL :: Maybe FilePath -- ^ CSL stylesheet
, optBibliography :: [FilePath] -- ^ Bibliography files
, optCitationAbbreviations :: Maybe FilePath -- ^ Citation abbreviations
+ , optTableFloat :: Bool -- ^ Should tables float?
} deriving (Generic, Show)
instance FromYAML (Opt -> Opt) where
@@ -673,6 +674,7 @@ defaultOpts = Opt
, optCSL = Nothing
, optBibliography = []
, optCitationAbbreviations = Nothing
+ , optTableFloat = True
}
parseStringKey :: Node Pos -> Parser Text
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs
index 3864ab188..45634a705 100644
--- a/src/Text/Pandoc/App/OutputSettings.hs
+++ b/src/Text/Pandoc/App/OutputSettings.hs
@@ -211,6 +211,7 @@ optToOutputSettings opts = do
, writerReferenceDoc = optReferenceDoc opts
, writerSyntaxMap = syntaxMap
, writerPreferAscii = optAscii opts
+ , writerTableFloat = optTableFloat opts
}
return $ OutputSettings
{ outputFormat = format
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 85d9aa103..8a09a84ac 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -265,6 +265,7 @@ data WriterOptions = WriterOptions
, writerReferenceLocation :: ReferenceLocation -- ^ Location of footnotes and references for writing markdown
, writerSyntaxMap :: SyntaxMap
, writerPreferAscii :: Bool -- ^ Prefer ASCII representations of characters when possible
+ , writerTableFloat :: Bool -- ^ Should tables float?
} deriving (Show, Data, Typeable, Generic)
instance Default WriterOptions where
@@ -300,6 +301,7 @@ instance Default WriterOptions where
, writerReferenceLocation = EndOfDocument
, writerSyntaxMap = defaultSyntaxMap
, writerPreferAscii = False
+ , writerTableFloat = True
}
instance HasSyntaxExtensions WriterOptions where
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 3cafcefba..b31df2540 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -259,6 +259,7 @@ blockToConTeXt (Table _ blkCapt specs thead tbody tfoot) = do
let tabl = if isEnabled Ext_ntb opts
then Ntb
else Xtb
+ let flt = writerTableFloat opts
captionText <- inlineListToConTeXt caption
headers <- if all null heads
then return empty
@@ -266,9 +267,13 @@ blockToConTeXt (Table _ blkCapt specs thead tbody tfoot) = do
rows' <- mapM (tableRowToConTeXt tabl aligns widths) rows
body <- tableToConTeXt tabl headers rows'
return $ "\\startplacetable" <> brackets (
- if null caption
- then "location=none"
- else "title=" <> braces captionText
+ if flt
+ then if null caption
+ then "location=none"
+ else "title=" <> braces captionText
+ else if null caption
+ then "location={none,force}"
+ else "title=" <> braces captionText
) $$ body $$ "\\stopplacetable" <> blankline
tableToConTeXt :: PandocMonad m
next prev parent reply other threads:[~2021-07-15 3:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 16:08 T. Kurt Bond
[not found] ` <CAN1EhV-Oe9U__+PyDfajyYDoODS6_7OWPxF33LLWiG6gQEmrpA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-06-15 10:22 ` 'Frederik Elwert' via pandoc-discuss
2021-06-15 14:39 ` AW: " denis.maier-NSENcxR/0n0
[not found] ` <eace606fe51249efa0393dda0e829959-NSENcxR/0n0@public.gmane.org>
2021-07-14 19:26 ` T. Kurt Bond
2021-07-14 21:54 ` T. Kurt Bond
[not found] ` <CAN1EhV94hy6m=KQ4A8=9PaRH=+VbR36oU-OwhAAj4=h1XHztCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-07-15 1:00 ` T. Kurt Bond
[not found] ` <CAN1EhV_dFDBA28NCsXAiTS+f-nAQCx5zLymm=tAywQ9XHj1OQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-07-15 3:28 ` T. Kurt Bond [this message]
[not found] ` <CAN1EhV-v2rayAb+oWQbcPcjccXcfRqwwdjpwjdn8g3==bhb6OA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-07-15 3:50 ` T. Kurt Bond
[not found] ` <CAN1EhV-gLh=HsNf9kwT3dqLnbUXW27PDrQkJy5wL_QcbM6rfCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-07-16 2:17 ` T. Kurt Bond
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN1EhV-v2rayAb+oWQbcPcjccXcfRqwwdjpwjdn8g3==bhb6OA@mail.gmail.com' \
--to=tkurtbond-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).