Adding Vertical Space in Sphinx Documents - html

I am using sphinx to build latex and HTML documents with a lot of figures and enumerated lists. When I use figures in the middle of text outside of enumerated lists, the spacing is fine in both latex and HTML with and without captions. There is about a line of space above and below, which is acceptable. However When I try to use a figure within enumerated lists, such as the example below, the spacing is bad in HTML.
#. Here is an item in the list, above the figure
.. figure:: _images/myimage.png
:align: center
:width: 80 %
#. Here is another item below the figure.
The result of the above code is the bottom of the figure is right up against the next item in the list. There is no spacing between them, and this looks bad. This can be fixed in HTML by using the | character at the end of the figure to add a little space, but in the LaTeX output, this causes a DUlineblock environment that adds way too much space in the pdf.
Is there a way to simply add a single blank line after the figure in both HTML and Latex?

You can enter empty lines with:
text
|
text

I found that the replacement:
.. |br| raw:: html
<br />
Works well for adding a black line after a figure in enumerated lists. Since its a raw substitution it only affects html and the figure spacing in latex is fine without modification.

Related

Email HTML - line not able to line break properly with _ instead of -

I've spent hours researching this and I'm trying to edit an email where they would like the References to say something like:
American Parkinson Association: https://www.test.com/abcdefghijklmnopqrstuvwxyz/12-09.com
ABCDEF: https://www.test.com/abcdefghijklmnopqrstuvwxyz/1234567890_098765_4321.com
However, when I code the 2nd numbered list, because there are underscores in the link and not dashes, it instead turns to the below with the link on it's own separate line. If I change the underscores to dashes, it will work formatting wise, but the link is obviously incorrect. I tried adding a "space" in the text of the link but if someone has to copy the link and send it, it will contain the "%20" and error out. If I add a "br" in the text, I will have to link both sections of the link. If I force the link to span across, then the whole width of the email will stretch and look weird.
ABCDEF:
https://www.test.com/abcdefghijklmnopqrstuvwxyz/1234567890_098765_4321.com
This is driving me crazy. There has to be an easier way. Please help?
It looks like it's because the entirety of the line itself may be too long, and thus making the line jump down. It should not be because of underscores specifically, or any of that sort.
You have quite a few options.
1) Add CSS that formats the text and/or links to a size where the link is within the acceptable size that you desire. There are numerous ways to achieve this.
2) Simply make an anchor tag that links to your desired url, and you can type whatever seems the most reasonable as the visual link.
Example:
Whatever text you want
The second solution is more clean, and that way you can make it way more compact and straight to the point as well. Having ridiculously long links in an E-mail looks unprofessional in my opinion.

How to convert HTML into formatted Text so that the layout such as spacing, table borders, element positioning remains intact?

How to convert HTML into formatted Text, so that the layout such as spacing, table borders, element positioning remains intact? Is there any tool for the same?
Tried a few options already as follows but output formatting is not as desired:
TxtControl conversion
PythonCom conversion
Issue: Converting HTML table with spacing between cells resulting in cell content getting moved to next line hence disturbing the formatting.
Expected output is: Table row cell content shall be in the same line and border shall be intact in the text file.
Also, PDF/RTF to TEXT conversion will also work just formatting should be intact.
Attaching screenshots for more clarity on the requirement.
INPUT HTML SCREENSHOT
OUTPUT TEXT SCREENSHOT
Alternatively, is there any way to read HTML character by character and write into text file so that the layout does not change in text output.
Does this work?
You can convert HTML into BBCode and you have a RTF editor.
http://www.ecardmax.com/hoteditor/
Just make sure to check the HTML Checkbox so that you can insert HTML into that. So when you paste your text, you choose the HTML part, you should try both.
Here are the results of the post from yours in BBCode
Note that that is my edited version:
How to [B]convert[/B] HTML into formatted Text, so that the layout such as spacing, table borders, element positioning remains intact? Is there any tool for the same?
Tried a few options already as follows but output formatting is not as desired:
[LIST=1]
[*]TxtControl conversion
[*]PythonCom conversion[/LIST]
[B]Issue:[/B] Converting HTML table with spacing between cells resulting in cell content getting moved to next line hence disturbing the formatting.Expected output is : Table row cell content shall be in same line and border shall be intact in text file.
Also, PDF/RTF to TEXT conversion will also work just formatting should be intact.
It could be that you manually need to remove something from it, as example I had to remove the text called "Thanks for your edit!" that appears when you edit something and it's still in pending.
This is useful if you want to convert old posts you can't access anymore on XenForo.
You then could put it into a text replacer, where it could replace [B] into **

entering a new sentence without using <br> or <p>

If there are a number of links on a webpage, is it possible to break onto a new line while the link is either fully on either side?
For example: This blog http://northskie.blogspot.com/ shows a series of links using the standard A HREF="http://www... " etc .
But, you'll notice that on the first line, Chapin's Inferno appears on BOTH sentence line A, AND line B. This could easily be corrected by adding a BR, of course. BUT, what if I'm working on a huge number of links, such as http://asmrluv.blogspot.com/ ? Now, I'd prefer NOT to to simply add BR or P between each Breaking line. Also note, many sites could be added to the list later. This is why BR lines should be avoided here.
Can any code be implemented which automatically prevents a link from appearing on both lines? (of course, adding a CLASS or ID would along with code would be acceptable). I'm trying to avoid the problem of a link appearing halfway on one sentence, then on the next line as well.

I am trying to indent a HTML form and it does not see them

I am trying to create a Custom registration form template, and when I try to put in paragraph spaces (returns) or indents the program refuses to see them, even in the preview pane. Please help.
I am trying to place this form on top of a bckground image placed at the center. the image is inside a coloumn of a table. I want to indent the form so that it\s completely inside the image, n all to its left.
You are supposed to use padding for such purposes, not any characters, if I understand your intentions correctly. Try adding this css property for the form:
padding-left: Xpx;
With X being your desired number of pixels for indentation.

Best practices: displaying text that was input via multi-line text box

I have a multi-line text box. When users simply type away, the text box wraps the text, and it's saved as a single line. It's also possible that users may enter line breaks, for example when entering a "bulleted" lists like:
Here are some suggestions:
- fix this
- remove that
- and another thing
Now, the problem occurs when I try to display the value of this field. In order to preserve the formatting, I currently wrap the presentation in <pre> - this works to preserve user-supplied breaks, but when there's a lot of text saved as a single line, it displays the whole text block as single line, resulting in horizontal scrolling being needed to see everything.
Is there a graceful way to handle both of these cases?
The easiest way of dealing with this is turning all line breaks \n into <br> line breaks. In PHP for example, this is done using the nl2br() function.
If you want something a bit more fancy - like the list you quote getting converted into an actual HTML <ul> for example - you could consider a simple "language" like Markdown that SO uses. It comes with natural, simple rules like
# Heading 1
## Heading 2
### Heading 3
* Unordered List item
* Unordered List item
1. Numbered List item
2. Numbered List item
etc....
You can use the php function nl2br() It transforms line breaks into elements
Convert newline characters to <br /> tags explicitly, and let the browser word-wrap the text normally. That preserves the breaks the visitor entered, without harming other paragraphs.
You could replace line breaks with HTML line breaks.
Replace "\r\n" or "\n" (depending on the browser and platform, check first for longer one) with <br/>.
I would normally replace all CR/LF with LF, and then replace all LF with <br />. You can then render this text inside any HTML container you want and let it flow naturally.