support HTML definition lists (<dl>, <dt>, and <dd>)#173
Conversation
|
I just tested the feature locally as I am interested in the functionality for markdown conversion. It is great to see this becoming available, I noticed that the result is one big text paragraph. I think an additional newline would be needed after the |
|
@ninsbl - can you share a small testcase here for me to reproduce it? |
|
Sure. We are currently looking into moving documentation for GRASS GIS from HTML to Markdown. One manual page with <dl>, <dt> and <dd> is for example: https://grass.osgeo.org/grass84/manuals/grass.html Here is the code used for translation to Markdown (with python-markdownify installed for the branch) You can see resulting markdown here: https://github.com/ninsbl/grass/edit/md_test/md/grass.md. Please look at the "FLAGS" section... Note the line break before the Also, element content seems only parially wrapped... |
|
@ninsbl - here is the "Flags" section from the Markdown file you referenced: ### Flags:
**-h** \| **-help** \| **--help**
: Prints a brief usage message and exits
**-v** \| **--version**
: Prints the version of GRASS and exits
**-c XY**
: Creates new GRASS project (location) without coordinate reference system in specified GISDBASE
**-c geofile**
: Creates new GRASS project in specified GISDBASE with coordinate reference system based on georeferenced file
**-c EPSG:code**
: Creates new GRASS project in specified GISDBASE with coordinate reference system defined by EPSG code
**-c EPSG:code:datum\_trans**
: Creates new GRASS project in specified GISDBASE with coordinate reference system defined by EPSG code and datum transform parameters
**-e**
: Exit after creation of project or mapset. Only with **-c** flag
**-f**
: Forces removal of .gislock if exists (use with care!). Only with --text flag
**--text**
: Indicates that Text-based User Interface should be used (skip welcome screen)
**--gtext**
: Indicates that Text-based User Interface should be used (show welcome screen)
**--gui**
: Indicates that Graphical User Interface
(*[wxGUI](wxGUI.html)*) should be used
**--config**
: Prints GRASS configuration parameters (options: arch, build, compiler, date, path, python\_path, revision, svn\_revision, version)
**--exec EXECUTABLE**
: Execute GRASS module or script. The provided executable will be executed in a GRASS GIS non-interactive session.
**--tmp-project**
: Run using a temporary project which is created based on the given
coordinate reference system and deleted at the end of the execution
(use with the --exec flag).
The active mapset will be the PERMANENT mapset.
**--tmp-mapset**
: Run using a temporary mapset which is created in the specified
project and deleted at the end of the execution
(use with the --exec flag).To me, it looks like the code in the pull request is functioning properly. I am able to convert this Markdown back to HTML with Pandoc, and the definition list structures are converted correctly back to HTML. I do see the wrapping behavior you mention, but that exists with and without this pull request and would be something to investigate separately. |
7883eee to
98d9095
Compare
Signed-off-by: chrispy <[email protected]>
98d9095 to
0fb8556
Compare
…rt-definition-lists support HTML definition lists (`<dl>`, `<dt>`, and `<dd>`)
Fixes #172.
New
convert_dt()andconvert_dd()functions are added that follow the PHP Markdown Extra syntax:https://michelf.ca/projects/php-markdown/extra/#def-list
If additional definition list dialects are requested in the future, a configuration option can be added to select the format.
No
convert_dl()function is added; the child-tag conversion functions do all the work.The regression tests are updated to test various structures. I also used Pandoc to confirm that all Markdownify results are converted back to the expected HTML source.
Note: This pull request requires that #171 be merged first; otherwise the
test_dlunit test will fail.Limitations
There are two limitations in this support, both related to the fact that blank lines are added outside the
convert_dt()andconvert_dd()function scopes.Limitation 1 - multiple terms sharing the same definition are not handled properly (the term lines are separated by a blank line instead of kept directly adjacent):
Limitation 2 - a blank line is always inserted before definitions, causing them to signify paragraph-based definitions even when they were not: