Which dialect of Markdown does Hackage use to render READMEs? - haskell

Hackage has been able to display Markdown READMEs for a while.
But as one can see for example on the Hackage page for hpack, Hackage doesn't seem to support the same table syntax as GitHub.
Markdown:
#### <a name="flags"></a>Flags
| Hpack | Cabal | Default | Notes |
| --- | --- | --- | --- |
| `description` | `description` | | Optional |
| `manual` | `manual` | | Required (unlike Cabal) |
| `default` | `default` | | Required (unlike Cabal) |
Rendered on GitHub:
Rendered on Hackage:
So, I'm wondering:
Which Markdown dialect does Hackage support?
Is there a syntax for tables in that dialect?
Is there a syntax for tables in the subset of Markdown that is supported by both GitHub and Hackage?

A quick search through the source of Hackage shows that is uses cheapskate (by John MacFarlane, the author of Pandoc). Looking at the Cheapskate.Types you can see everything that is supported - and tables are not part of that.
Furthermore, it appears that Hackage has the raw HTML option for rendering set to False, thereby quashing any hope one may have had of putting in a simple HTML table (which I think should also work in GitHub).
I think the best alternative (supported by both Hackage and GitHub) is just to put your table in a code block. That way, it is at least monospace font (so columns can align). That means you enter something like
```
| Header1 | Header2 | Header2 |
+---------+---------+---------+
| Cell1 | Cell2 | Cell3 |
+---------+---------+---------+
```
And it will render as
| Header1 | Header2 | Header2 |
+---------+---------+---------+
| Cell1 | Cell2 | Cell3 |
+---------+---------+---------+

Related

Asciidoctor - overflow on a large table

I create a documentation with asciidoctor and Maven.
I need to put a large table (more than page width), but I don't know how to put an equivalent to css overflow-x:auto for this table.
my.adoc:
Tables :
|===
10+|*usertable*
| id | hostname | ip | profile | username 5+|
10+|*tapplications*
| id | category | feature | app_license_type | app_long_desc | app_name | app_nam_exec | app_short_desc | id_feature | logo
10+|*licenseusertable*
| id | date_since_granted | display | feature_version | handler | server_host | server_port | id_feature | id_user |
|===
Thanks in advance
You would need to add some custom CSS to accomplish that.
You could supply your own stylesheet file, totally overriding the Asciidoctor styles, by adding -a stylesheet="mystyles.css" to your asciidoctor invocation.
Since you likely just want to add a style to the existing styles, you need to use a docinfo file. See: https://asciidoctor.org/docs/user-manual/#docinfo-file
Create a file called docinfo.html containing your styles. For example:
<style>
.scrollable {
overflow-x: auto;
}
</style>
Note the <style> tag: the docinfo.html file is an HTML file (which gets embedded into the <head> of the generated page), so you can also embed custom Javascript, meta tags, etc.
Then, in the document containing the table, add the following attribute definition immediately after the document's title:
:docinfo: shared
Also, since HTML tables don't support horizontal scrolling, you need to wrap your table in an open block (which translates to some <div> wrappers):
[.scrollable]
--
Tables :
|===
10+|*usertable*
| id | hostname | ip | profile | username 5+|
10+|*tapplications*
| id | category | feature | app_license_type | app_long_desc | app_name | app_nam_exec | app_short_desc | id_feature | logo
10+|*licenseusertable*
| id | date_since_granted | display | feature_version | handler | server_host | server_port | id_feature | id_user |
|===
--

How to generate a table in Haddock documentation

I am writing some documentation with Haddock, and I need to put a multi-column table with some values in it. How can I do it with Haddock? I cannot find info about it. Embedding some html as alternative looks no possible too.
Haddock bundled with GHC 8.4 or newer (Haddock version >= 2.18.2) supports tables. As per the pull request where this was added, the syntax is based on RST Grid tables.
Sample use:
module Sample where
-- | A table:
--
-- +------------------------+------------+----------+----------+
-- | Header row, column 1 | Header 2 | Header 3 | Header 4 |
-- | (header rows optional) | | | |
-- +========================+============+==========+==========+
-- | body row 1, column 1 | column 2 | column 3 | column 4 |
-- +------------------------+------------+----------+----------+
-- | body row 2 | Cells may span columns. |
-- +------------------------+------------+---------------------+
-- | body row 3 | Cells may | \[ |
-- +------------------------+ span rows. | f(n) = \sum_{i=1} |
-- | body row 4 | | \] |
-- +------------------------+------------+---------------------+
sample :: ()
sample = ()
Turns into
Haddock "markup" doesn't currently support tables, see also Haddock User Guide - Chapter 3. Documentation and Markup. There is an open issue to add support for simple tables.

How to translate syntatic parse to a dependency parse tree?

Using Link Grammar I can have the syntaxic parse of sentences something like the following:
+-------------------Xp------------------+
+------->WV------->+------Ost------+ |
+-----Wd----+ | +----Ds**x---+ |
| +Ds**c+--Ss--+ +-PHc+---A---+ |
| | | | | | | |
LEFT-WALL a koala.n is.v a cute.a animal.n .
+---------------------Xp--------------------+
+------->WV------>+---------Osm--------+ |
+-----Wd----+ | +------Ds**x------+ |
| +Ds**c+--Ss-+ +--PHc-+-----A----+ |
| | | | | | | |
LEFT-WALL a wolf.n is.v a dangerous.a animal.n .
+--------------------Xp--------------------+
+------->WV------>+--------Ost--------+ |
+-----Wd----+ | +------Ds**x-----+ |
| +Ds**c+--Ss-+ +--PHc-+----A----+ |
| | | | | | | |
LEFT-WALL a dog.n is.v a faithful.a animal.n .
+-----------------------Xp----------------------+
+------->WV------->+----------Osm----------+ |
+-----Wd----+ | +-------Ds**x-------+ |
| +Ds**c+--Ss--+ +--PHv--+-----A-----+ |
| | | | | | | |
LEFT-WALL a monkey.n is.v an independant.a animal.n .
The problem with this that it's not possible AFAIK to make sens
of that output programmatically; It seems like the way to go
is to convert that syntaxic output to a dependency parse tree
how can I achieve that?
You may want to look at RelEx (at GitHub).
From link-grammar at Wikipedia (emphasis mine):
The semantic relationship extractor RelEx, layered on top of the
Link Grammar library, generates a dependency grammar output by
making explicit the semantic relationships between words in a
sentence. Its output can be classified as being at a level between
that of SSyntR and DSyntR of Meaning-Text Theory. It also provides
framing/grounding, anaphora resolution, head-word identification,
lexical chunking, part-of-speech identification, and tagging,
including entity, date, money, gender, etc. tagging. It includes a
compatibility mode to generate dependency output compatible with
the Stanford parser, and Penn Treebank-compatible POS tagging.

Should all fields that are visible on a screen be validated in Gherkin?

We are creating Gherkin feature files for our application to create executable specifications. Currently we have files that look like this:
Given product <type> is found
When the product is clicked
Then detailed information on the product appears
And the field text has a value
And the field price has a value
And the field buy is available
We are wondering if this whole list of and keywords that validate if fields are visible on the screen is the way to go, or if we should shorten that to something like 'validate input'.
We have a similar case in that our service can return a lot of 10's of elements for each case that we could validate. We do not validate every element for each interaction, we only test the elements that are relevant to the test case.
To make it easier to maintain and switch which elements we are using, we use scenario outlines and tables of examples.
Scenario Outline: PO Boxes correctly located
When we search in the USA for "<Input>"
Then the address contains
| Label | Text |
| PO Box | <PoBox> |
| City name | <CityName> |
| State code | <StateCode> |
| ZIP Code | <ZipCode> |
| +4 code | <ZipPlus4> |
Examples:
| ID | Input | PoBox | CityName | StateCode | ZipCode |
| 01 | PO Box 123, 12345 | PO Box 123 | Boston | MA | 12345 |
| 02 | PO Box 321, Whitefish | PO Box 123 | Whitefish | MN | 54321 |
By doing it this way, we have a generic step "the address contains" that uses the 'Label' and 'Text' to test the individual elements. It is a neat and tidy way to test a lot of potential combinations - but it probably depends on your individual use case - how important all of the fields are.
You only need to validate the ones that provide business value, which is probably all of them. I would avoid using tech terms like "field" because it isn't related to a behavior. Al Mills is right on for using the tables.
I'd word it like this:
Scenario Outline: Review product details
Given I find the product <Type>
When I select the product
Then detailed information on the product appears including
| Description | <Description> |
| Price | <Price> |
And I can buy the product
Examples:
| Type | Description | Price |
| Hose | Rubber Hose | 31.99 |
| Sprinkler | Rotating Sprinker | 12.99 |
The words I chose are behaviors or whats, not technical implementations or hows.

Writing variable length data in Excel file from Matlab

I am trying to create a excel file from Matlab with data for multiple cases. The excel file should look something like this:
Case #|____________________________Line 1_____________________________________________|_______ Line 2 _____________ ...
|______Node 1______|______Node 2______|______Node 3______|...|______OverAll_____|
| Min|Max|Mean|Std | Min|Max|Mean|Std | Min|Max|Mean|Std |...| Min|Max|Mean|Std |
|_______________________________________________________________________________|
1| | | | | | | | | | | | | | | | |
2| | | | | | | | | | | | | | | | |
I have the data for each Line>Node in a structured format which I can read through a for loop for a given case. How can I write the values in an excel file? I don't know how to get the next available cell range where I need to place the value. Also, how can I generate such header text dynamically. The number of Nodes and properties (Min/Max/Mean/Std) might change in future.
Thank you for your help. Any suitable tutorial which teaches little advanced xlswrite commands will also help.
Use Activexserver to import whole Excel Functionality in MATLAB using
hApp = actxserver('Excel.Application')
Rest you can use all methods available to Excel Application in MATLAB

Resources