Allow richer styling of questions/answers
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | Ubuntu Help App |
High
|
Daniel Holbach | ||
Bug Description
Our workflow is quite special, we use
- po4a for extracting strings for translation from markdown files
- Launchpad to get translated .po files
- po4a again to produce translated markdown files
- pelican to produce HTML from those markdown files
Everything is glued together in translations.py.
To allow richer styling (think of it as Q&A classes, ie: "short", "long", "with picture", etc.) we will need to specify this in the markdown somewhere, make sure it doesn't get broken through translations, then use some mechanism to inject styling into the resulting HTML.
The current plan for this is:
- use some kind of special markdown to indicate what kind of question and answer we have
- save it in a .pot comment
- massage translations into markdown, re-add styling markers
- maybe use a markdown extension for generating the html we need(?)
Current work items:
- David: figure out individual theming bits
- Daniel: investigate options wrt. pot comments and markdown extensions
Here is some info about creating a Pelican plugin: http://
Related branches
- David Planella: Needs Fixing on 2015-03-16
-
Diff: 9029 lines (+2726/-2425)19 files modifiededit-here/content/pages/apps.md (+17/-15)
edit-here/content/pages/basic.md (+9/-8)
edit-here/content/pages/index.md (+2/-2)
edit-here/content/pages/scopes.md (+4/-3)
edit-here/content/pages/security.md (+8/-7)
edit-here/content/pages/settings.md (+8/-7)
edit-here/content/pages/store.md (+4/-3)
edit-here/content/pages/ui.md (+10/-9)
edit-here/pelicanconf.py (+9/-1)
edit-here/po/de.po (+392/-364)
edit-here/po/es.po (+394/-366)
edit-here/po/fr.po (+392/-364)
edit-here/po/help.pot (+171/-168)
edit-here/po/it.po (+392/-364)
edit-here/po/pt.po (+392/-367)
edit-here/po/ro.po (+392/-364)
edit-here/q-and-a.py (+77/-0)
edit-here/tests/test_translations.py (+6/-4)
edit-here/translations.py (+47/-9)
| Changed in help-app: | |
| importance: | Undecided → High |
| status: | New → Confirmed |
| David Planella (dpm) wrote : | #1 |
| David Planella (dpm) wrote : | #2 |
Apart from raw HTML markup, another option to have more control over the layout is to add class information to the original sources, which will be translated into HTML markup by Pelican. This can be done via python-markdown extensions, in particular via attribute lists [1] (which are enabled by default in Pelican).
As an example, if I add the following to index.md:
# Header 1 {: .myclass}
Pelican will create this markup in index.html
<h1 class="
This has the challenge that {: .myclass} will be put into the .pot file too. Daniel devised a plan to move it to the translator comments and then put it back in the index.$LANG.md files too, which could work well.
However, while attribute lists give us more control over CSS classes, I'm not sure we've got a definite use case for using them yet.
[1] https:/
| description: | updated |
| Daniel Holbach (dholbach) wrote : | #3 |
lp:~dholbach/help-app/1430735 is my work-in-progress. It's based on lp:~dpm/help-app/attr-lists-and-embedded-html
| Daniel Holbach (dholbach) wrote : | #4 |
<dholbach> dpm, so... to implement this, I think it'd make sense to always assume something like ".textonly"
as it's likely going to be the primary way how we present questions and answers
so for cases where we add a picture, we could add something like ".image"
or ".highlight" in case we ever want to do that
and add the statement to both question and answer line
so the extension knows what to do and what to replace it with
does that generally make sense?
<dpm> right, yeah. But perhaps we'd need to use some other notation to distinguish it from the python-markdown attribute lists
what I mean is that we use {: .someclass} to add a class to an element
<dholbach> dpm, I was actually thinking of dropping the attr-list extension again
<dpm> but with this new extension we'd be wrapping divs around the questions
<dholbach> as we don't necessarily use it right now
<dpm> dholbach, sounds good to me if we're not using it, yeah
* dholbach nods
| Changed in help-app: | |
| status: | Confirmed → In Progress |
| Daniel Holbach (dholbach) wrote : | #5 |
!!I we are going to postpone to 0.2 - this is bug 1432710.
| Changed in help-app: | |
| assignee: | nobody → Daniel Holbach (dholbach) |
| milestone: | none → 0.1 |
| Changed in help-app: | |
| status: | In Progress → Fix Released |

I think markup that could work for at least the web theme would be:
For text-only questions:
<div class="row">
<div class="eight-col last-col">
<!-- question & answer -->
</div>
</div>
For text and picture questions:
<div class="row">
<div class="eight-col">
<!-- question & answer -->
</div>
<div class="four-col last-col">
<!-- question & answer -->
</div>
</div>
An option that would work would be to add that additional markup to the .md files. However, that makes them more difficult to edit, and we'd have to remove the markup from the .pot file and re-add it to the translated .md files, which might prove to be too complex.