Using Sphinx, I'm editing pylearn documentation content at https://bitbucket.org/omidraha/pylearn/.
All paragraphs are Right-to-Left (because of Persian language) and code samples between text, rendered incorrectly.
Generally I'm looking for a way to apply bi-directionality algorithms of unicode or microsoft on a web page.
Is there a way to set css style of codes, to be LTR inside of a RTL paragraph? if not, how could I modify sphinx source to do seperate code samples, for example in a frame or something like that?
If you want to specify the direction in which the test is displayed, use the "dir" attribute.
See: http://reference.sitepoint.com/html/core-attributes/dir
Related
Take this text as an example:
ππππππΏπππππππππ
If you make an HTML file copy and paste the above text directly in your text editor from StackOverflow, it will show up on the webpage with that font. Why isn't this the standard way for using fonts in HTML and instead most people just use font color when they could simply use ASCII?
For one thing, these specific characters have very specific meanings beyond just the font. See Mathematical Alphanumeric Symbols on Wikipedia and its Unicode chart.
Secondly, presentation and content are separate matters. When the appearance of text has no bearing on the meaning of the text, then the appearance should be controlled by CSS, not the text itself. (Plus, why would you sacrifice all manner of flexibility by hardcoding the appearance in the content itself?)
I'm working on an online audio book whose content comes from a WORD file. Of course my content is Unicode (Persian font, similar to arabic). Texts copied from Word document and pasted into my application, show small differences in terms of character/word space and/or justify rules. I'm going make my HTML exactly the same as my WORD file (I've applied correct padding in my HTML in order to simulate WORD margins, also WORD document is in a DIN-A4 paper which its size is emulated in my DIV element). What are the best practices for having the best-achievable similarity between the two?
Rather than re-inventing the wheel, there are a large number of online Word >> HTML converters available - many of which are free! I would suggest leaning on these to at least get the baseline of your HTML and then make any further enhancements on top of this.
Personally I've used https://cloudconvert.com/doc-to-html before, they have an API also so you could automate the conversion.
Hope this helps!
In normal case, I can separate the text and the style, but how should I do it, when the text is dynamic (it is editable by the admin user)? The user of course wants to use bold, italic, etc, but if I put a common html-editor (I think) I broke the rule of the separation, because there will be html elements in the text. (I can use BB codes, but it is the same.)
In a long term I think it can cause problems when I want to use the text in any non-html environment. Of course I can strip the html tags, but it is not the way I would like to use (not because it won't work, but the original theoretical issues).
In some cases I can break apart the sentences to solve this problem, but I think it's a bad way, because the parts are pointless alone, and it won't be so easily editable too.
Is there any good solution for this?
That's perfectly ok.
You give the user the oppertuniny to set some attributes for the text (BBCodes recomended).
That is content. Then it's part of the design to interpret the attributes and style it.
For example you may provide the feature to let the user define something like [headline]MyHeadline[/headline]. This is pure content.
How to replace [headline] with HTML and how to style the resulting text is up to the design.
Edit: I recommend BBCodes to provide a closed set of features. That may be easier to deal with. You could just use them in another context and interpret them, instead of stripping out HTML.
If the tags entered are semantic, ie they are using an <i> tag for italic, rather than style="font-style:italic", then your design and content are still separate.
Separating design and content is about separating a site's presentation from the readable code, rather than removing the markup altogether.
I'd advise you focus on Semantic HTML.
I'm writing a stylesheet to process RSS / Atom feeds on Dreamwidth.org (a LiveJournal-based blogging site).
One of the feeds I've got insists on prefixing paragraphs with " Text ..." to create an indented paragraph effect. I prefer my paragraphs aligning flush with the left of the page. I don't have the ability to rewrite the content or write Javascript to deal with this, and prevailing on arbitrary bloggers to change their habits seems somewhat untenable ...
My understanding of CSS is that HTML entities and characters cannot themselves be used as selectors.
Update: the site I'm styling is here: http:// dredmorbius.dreamwidth.org/read/
The specific feed in question is James Howard Kunstler's piquantly named blog, and this entry in particular has the non-breaking-space paragraph indents.
For a comparative rendering on DreamWidth see here.
Your understanding is correct. HTML entities are regular characters, simply expressed in a different HTML syntax, so as far as CSS is concerned they are the same thing and cannot be targeted with a selector.
You're going to have to use text-indent in the paragraphs that you're styling and experiment with different negative values to get as close to a perfect reverse indent (or outdent) as possible, depending on the font that the text is being rendered in.
I want to know, it's possible to show superscript character in the tool tip of html control
for ex.
$(tblth).attr("title","name <sup>a</sup>");
As it's not HTML (it's natively rendered and depends on the OS), no you can't do that.
The usual solution is to do your own tooltip (or use one of the numerous libraries). The good news is that's easy.