in restructuredtext format, how to create a document title which is centered and not enumerated - restructuredtext

for example
==================
Title Document
==================
will create a left aligned title with enumeration such as
Title Document
I'm loooking form something to center the title in middle of the page and remove the enumeration

There is no such thing in RST, as the details of formatting aren't of concern to the language itself. It's a text-structuring language with formatting hints, not a typesetting markup.
You don't even know how your RST is going to be rendered -- as HTML page? As series of slides? As PDF document? As built-in help for some programming tools?
Formatting is typically done by the respective renderer and is largely up to that renderer's discretion. Many popular renderers allow you, however, to supply style information externally (e.g. HTML renderers might allow you to supply CSS files that take care of beautifying things).

Related

How to style content coming from a Headless CMS?

Last month I read about Headless CMS for the first time, and I just felt in loved with that approach.
But just right after, I wondered how could I format and/or add style to the content if some day I worked with this technology.
By styling the content, I mean words within a title, paragraph and so on; not a whole paragraph, which is quite obvious it can be done.
It seems to me that it is impossible, since you only get a JSON with no HTML whatsoever; just raw texts. So it looks like this is the major downside of consuming content through a Headless CMS from a Front End perspective.
Formatting text is just fundamental, specially when dealing with large content. And I am sure I cannot be the first one concerned about not being able to add some bold and/or italics to a text to emphasize the important parts of it.
But I can't find any website discussing this topic, just "how to model the content" and whatnot.
Does really no one care about it?
I would appreciate if anyone could shed some light about this question.
Diving into the Headless CMS #RicoHancock has pointed out, I've learnt that it is completely feasible to store rich text and strucuted content within a JSON that can be converted to HTML following some specifications I wasn't aware of.
In the particular case of DatoCMS, they use a specification called dast.
To learn more about it, visit their docs (the following link contains very illustrative code examples):
https://www.datocms.com/docs/structured-text/dast
Paraphrasing their own words:
Structured Text format adheres to the Unified collective, which offers a big ecosystem of utilities to parse, transform, manipulate, convert and serialize content of any kind.
The "Unified collective" is a collective of free and open source packages to work with content as structured data with plugins. In order to create the syntax trees, Unified uses UNIST nodes.
UNIST is a specification, and stands for "UNiversal Syntax Tree".
More info about the UNIST spec and the Unified ecosystem:
https://github.com/syntax-tree/unist
https://unifiedjs.com/learn/guide/introduction-to-unified/
https://unifiedjs.com/learn/guide/using-unified/
TLDR: Markdown.
The company I work for uses DatoCMS. We have a blog, and each blog post is created in our CMS by our copywriting team. DatoCMS allows us (the developers) to create "blocks" that make up the blog post. We have image blocks and content blocks that are rendered by a template file on our frontend. The content blocks support Markdown, so italics, bold, and links work. When our copywriting/marketing team want to make a new blog post, they go to the CMS, create a new post, add a title, slug, and blocks, and then save.
I don't have much experience with other Headless CMS', so not sure if Markdown will work there, but I don't know why it wouldn't, Markdown is all over the internet. (In fact, this answer is Markdown XD)

How to implement specific functionality in a custom text object in pyQt?

I need to implement a specific text object in QEdit PyQt. I need rich objects that will content special information, capture the keyboard arrow keys only when cursor text is on these objects. They need support selection and copy / paste operations also. Outside of them, the cursor must act as normal behavior. At this time, the object does not need to show images or svg etc. Is only for capture text cursor purposes and to store specific information related with the object.
I read that I can implement a customized text object with this example:
textobject.py
but the example does not contain information about implement new html tags, how to capture focus, etc.
My questions are:
How can I add a new html tag related with my custom object for loading and saving documents?
How can I detect when text cursor is on the custom object to modify keyboard cursor behavior?
PyQt documentation says:
"Copy and Paste operations ignore custom text objects."
So is no way to implement copy / paste functionality?
How can I access to my custom object content?
I want to have specifics methods to navigate within the information contained in the object. I could save this information in another object, but I need to synchronize the information with the cursor because a document can contain many of these objects.
Context for my application: I'm developping a very specific application for blind users. I am blind myself. I need to make very specifics customizations to the Richttext area for accessibility. The goal is to develop an accessible math equation editor. For this, I need to add support for mathMl tag. I will process mathMl content inside these tags in my custom object, this part is already implemented at basic level without using any GUI framework. At this time I don't need to show the equation in the screen, I let to screen readers interact with my editor via a COM object. At this time, the equation box is functional, but I need to integrate this functionality in a rich text area. the idea is, a document can contain N math expressions that can be read, modified and saved in a document.
I plan to implement accessibility for sighted people also in the equation editor, but it is beyond my skills and is not a priority right now.
Also I need to accessibilize tables in rich text area, currently tables are not accesible in QT. Then I think to extend qt table functionality. Style elements like headings etc, does not exist in pyQt. OK, you can write a paragraph with heading style, but screen readers can't detect it. So I need to develop this functionality. I could solve it with customized objects I think.
Currently it need to work in windows only. Maybe later I'll consider other platforms.
I started to program in pyQt yesterday, but I already read a lot of documentation. I wrote a basic rich text editor to test my requirements.
I already tried to implement this application with wxPython phoenix because I've been using WX for a long time. But I couldn't implement custom text objects and I didn't find documentation about it.
If pyQt is limited for my requirements, could you recoment another gui framework?
Y could consider another languages, I chose Python because Python has many math tools like sympy or numpy, and implement user scripting functionality in the app is very easy.
Sorry for my bad english.

WordML templating with XML Schema and OpenXML SDK

I'm trying to use a docx read in via the OpenXML SDK as template in a .Net web app for form letters (essentially). I have a docx with the formatting I want, marked up with XML Schema tags defined from a xsd (whatever they're called, the help is exceedingly useless on this).
The only thing similar I found on Google was what seemed to be replacing the CustomXmlBlock elements with text elements with the desired data. This seems... messy and fragile.
I also have the added complication that some of the data is hierarchical, with elements for sections, and then items in that section. This would seem to completely break the above method.
So, can someone point me in the right direction for doing this, or suggest a better way to handle templating form letters?
There are a number of choices:
What you're doing, XSD Schema mapping. This was introduced in Word 2003. It was really only truly active in that version of Word as when Word 2007 came out, the preferred new method of forms became #2.
Content Controls. More on this below.
Tried and true are Bookmarks. If you're interested, there is an article here.
For Content Controls 1, the concept is simple: wrap your content controls in the hierarchy needed. That is to say, for example, have a Date Picker Content Control and a Rich Text Content Control and then group them. Then inside the Rich Text Content Control, place a Combo Box Content Control. Eric White has written a great starter article on this at retrieving content from inside of Content Controls at Processing all Content Parts in an Open XML WordprocessingML Document. This article is a much more comprehensive introduction to Content Controls in it's links Using Open XML WordprocessingML Documents as Data Sources.
More links on Content Controls:
Brian Jones' site has a lot of great articles. I believe these were his first: The Easy Way to Assemble Multiple Word Documents and Create a rich Word document based on your own custom XML (without the need for XSLT).
The Word Content Control Toolkit. Probably the best tool around for working with Content Controls.
Visual How To Content. Many articles here deal with Content Controls.
1 To work with Content Controls manually in the Word client, enable the "Developer" Ribbon from Options and then insert Content Controls and set their properties from the left-hand section of the Controls group in the Developer Ribbon.

Structuring an email message for display on multiple devices/clients

I'm using System.Net.Mail to send an email message and want to make sure it appears properly from anything from a text-only cellphone to a rich client on Mac, Suse Linux/Evolution, or Windows.
I gather there are a few points to consider when sending a message with such a broad reach. Here is my list so far:
Plain text header: For text only clients, preface the entire message with plain text that says "to view this message click this link". This text should be readable even if the message hits the spam folder.
Layout: For the html portion of the message, should I use CSS or HTML Tables?
Doctype: What is the proper doctype to use XHTML, HTML5?
Images: What is the best image format to use? .. should I take any special considerations when embedding it? I'd prefer for the existence of an image to not give the message an "attachment" icon
MIME types: Is there any special MIME type I should use for the plain text or html part... or should I just preface the HTML with my text, and then hide that text with CSS style?
I'm sure there are more things to consider, or ways to rethink the above. What other items should I keep in mind when generating such an email that needs to understood by many devices?
This guide to css support is invaluable. In general, write your html like it's the year 2000. You'll be using a lot of tables for layout. CSS support is decent, but you have to use inline styles. That's because gmail strips styles in the header and no mail client links to external style sheets. The referenced guide does a great job of explaining all the guidelines.
As far as html and text, the best practice is to send them both. You do this by adding an alternate text view. See this article for an example. There are many such tutorials if you google "send html and text with .NET" or something similar.
This might sound trite, but if you want your email to display properly on any system, why not just send a plain-text email?
Is there some compelling feature of rich HTML that you really need?
Me, when a web site presents the option to choose text over HTML for their communications, I always choose plain text. It requires less bandwidth, is easier to read, doesn't have any obnoxious images, requires less processing power, etc etc.
If you only use the lowest common denominator, you will have the broadest device support.
That said, using multipart/alternative with a text/html part should work just fine on any reasonable device. The things not supporting HTML will display the text and the other devices will display the HTML. Use only a simple set of HTML - don't go overboard with fancy CSS features.

Using QT to build a WYSIWYG Editor for a Custom Markup Language

I'm new to QT, and am trying to figure out the best means of creating a WYSIWYG editor widget for a custom markup language that displays simple text, images, and links. I need to be able to propagate changes from the WYSIWYG editor to the custom markup representation.
As a concrete example of the problem domain, imagine that the custom markup might have a "player" tag which contains a player name and a team name. The markup could look like this:
Last week, <player id="1234"><name>Aaron Rodgers</name><team>Packers</team></player> threw a pass.
This text would display in the editor as:
Last week, Aaron Rodgers of the Packers threw a pass.
The player name and the team name would be editable directly within the editor in standard WYSIWYG fashion, so that my users do not have to learn any markup. Also, when the player name is moused-over, a details pop-up will appear about that player, and similarly for the team.
With that long introduction, I'm trying to figure out where to start with QT. It seems that the most logical option would be the Rich Text API using a QTextDocument. This approach seems less than ideal given the limitations of a QTextDocument:
I can't figure out how to capture navigation events from clicking on links.
Following links on click seems to only be enabled when the QTextEdit is readonly.
Custom objects that implement QTextObjectInterface are ignored in copy-and-paste operations
Any HTML-based markup that is passed to it as Rich Text is retranslated into a series of span tags and lots of other junk, making it extremely difficult to propagate changes from the editor back to the original custom markup.
A second option appears to be QWebKit, which allows for live editing of HTML5 markup, so I could specify a two-way translation between the custom markup and HTML5. I'm not clear on how one would propagate changes from the editor back to the original markup in real-time without re-translating the entire document on every text change. The QWebKit solutions looks like awfully bulky to me (Learning WebKit along with QT) to what should be a relatively simple problem.
I have also considered implementing the WYSIWYG with a custom class using native QT containers, labels, images, and other widgets manually. This seems like the most flexible approach, and the one most likely not to run into unresolvable problems. However, I'm pretty sure that implementing all the details of a normal text editor (selecting text, font changes, cut-and-paste support, undo/redo, dragging of objects, cursor placement, etc.) will be incredibly time consuming.
So, finally, my question: are there any QT gurus out there with some advice on where to start with this sort of project?
BTW, I am using QT because the application is a desktop application that needs platform independence.
Given that I got no advice here, I decided to go with the QTextEdit approach, although I'm actually using a QTextBrowser that is set to be editable so that I can capture link navigation events. I will be using QTextCharFormat's with the link names set to unique identifiers in order to convert from the QTextEdit back to the custom markup. The QTextEdit supports images already, so I won't have to deal with those.
I think I will hit the biggest roadblocks with the fact that I need to be able to insert/grow/shrink tables whose cells can have Excel-style functionality. I have not yet figured that whole process out.

Resources