Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 08-05-2013, 04:31 AM   #1
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,023
Karma: 10963125
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Assigning paragraph class to multiple paragraphs

I'm using a favourite css for my ebooks, containing a "standard" paragraph style with indented first line. There is also a paragraph class for some specific text as poetry etc. with no indenting, italics etc. Opening a book, for example in html, all text is, first of all, assigned to the standard paragraph style, also the poetry. As there are usually many linebreaks, every line appears as separate paragraph, each one indented etc. Until now I manually changed every line, assigning the "poetry" class to all. This is much work.

Is there a way to assign this specific paragraph style to the "bunch" of lines that contain poetry at once, removing the standard pareagraph style? I think this should be possible, but I simply don't find the trick.

Sorry for my difficulties in explaining the problem in English!
Leonatus is offline   Reply With Quote
Old 08-05-2013, 05:42 AM   #2
mzmm
Groupie
mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.
 
mzmm's Avatar
 
Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
it would help if you could post some of the code you're working with, but from what i understand of your question, you could assign styles to the children (<p> tags) of a container (a <div>) to save yourself some typing:

css:

Code:
.myDiv p {
	text-indent:0;
	font-style:italic;
}
html:

Code:
<div class="myDiv">
	<p>Some Text</p> <!-- this will have the styles from .myDiv p -->
</div>
mzmm is offline   Reply With Quote
Advert
Old 08-05-2013, 05:52 AM   #3
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Leonatus View Post
Is there a way to assign this specific paragraph style to the "bunch" of lines that contain poetry at once, removing the standard paragraph style?!
You could wrap unformatted lines in a <div> section with the desired class or simply globally replace the old class name with the new name.
(In Code View, you can also select Mark Text from the Context menu to limit search and replace operations to the selected text.)
Doitsu is offline   Reply With Quote
Old 08-05-2013, 10:19 AM   #4
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
If your "special" lines are not already marked in some way then you will have to manually go through the book to make changes. However, you can create a "clip" using the clip editor that will make this process much easier. All you need to do is highlight all the lines you want to "bundle" and then click on the clip to wrap the bundled lines in a container.

I use several but here are a couple of examples:

Div: <div class="">\1</div>
Block: <blockquote class="">\1</blockquote>

Once I use the clip then I just fill in the class I want to use between the quote marks. I definitely use MZMM's technique:

CSS (styled as you desire)
.poetry {margin:2em}
.poetry p {font-style:italic; text-indent:0}

HTML
<div class="poetry">
<p>line 1</p>
<p>line 2</p>
<p>line 3</p>
...
</div>
Turtle91 is online now   Reply With Quote
Old 08-05-2013, 12:23 PM   #5
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,023
Karma: 10963125
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Quote:
Originally Posted by mzmm View Post
css:

Code:
.myDiv p {
	text-indent:0;
	font-style:italic;
}
html:

Code:
<div class="myDiv">
	<p>Some Text</p> <!-- this will have the styles from .myDiv p -->
</div>
This is what I have, more or less. The point is that, linking my css to the html text, all paragraphs are formatted as "p". When there is a poem in the text, due to the line breaks, every line is separately formatted as "p", and I had to change, line by line, into ".p1" paragraph class, where I have my poem "specifics".

@Doitsu: How could I achieve the poems becoming unformatted, without changing the formatting manually, line by line? The effect is almost the same as described above.

@Turtle91: Clip Editor, aha, that's probably what I need (first I have to look what is the German translation).

Thanks to all! I really appreciate!
Leonatus is offline   Reply With Quote
Advert
Old 08-05-2013, 12:28 PM   #6
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
For poetry I tend to make a full stanza into one paragraph. I use <br /> for line breaks within the paragraph. This minimizes the need to adjust a large number of paragraphs. But it also minimizes the control you have over formatting but for me it works fine for the occasional poem or lyric in a prose document.

Dale
DaleDe is offline   Reply With Quote
Old 08-05-2013, 12:38 PM   #7
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,023
Karma: 10963125
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
@mzmm: Reading it again, I think I now understood right the container trick. I'll try it soon.
Leonatus is offline   Reply With Quote
Old 08-05-2013, 12:42 PM   #8
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Leonatus View Post
This is what I have, more or less. The point is that, linking my css to the html text, all paragraphs are formatted as "p". When there is a poem in the text, due to the line breaks, every line is separately formatted as "p", and I had to change, line by line, into ".p1" paragraph class, where I have my poem "specifics".
What mzmm means is that you could change the CSS, so that instead of ".p1" you have "div.poetry p". That way you don't have to apply any specific style to poetry lines, as long as they are enclosed in a "<div class="poetry">" block, as the "div.poetry p" selector applies to any <p> inside such a block, with or without class.

Quote:
Originally Posted by DaleDe View Post
For poetry I tend to make a full stanza into one paragraph. I use <br /> for line breaks within the paragraph. This minimizes the need to adjust a large number of paragraphs. But it also minimizes the control you have over formatting but for me it works fine for the occasional poem or lyric in a prose document.
Sure, the whole point of wrapping each line in a block element is allowing nice linebreaks by using negative text-indents, otherwise I guess you can get pretty much the same result with just <br>.

By the way, I wouldn't recommend using <p> for poetry lines because they are in fact not paragraphs. One could argue that stanzas are sort of paragraphs, but not lines. I'd use <div> or <span> (with display:block). The latter is closer to the real semantics, the former has the advantage of displaying nicely even with CSS disabled (and the disadvantage that you cannot use <p> for stanzas with that). My usual setup:

Code:
<div class="poetry">
  <div class="stanza">
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
  </div>
  <div class="stanza">
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
  </div>
</div>
("line" and "line2" have different left margins, to create the desired indent patterns, when needed.)

A bit too verbose, and one could dispose of the class="line" through CSS, but it's usually quite easy to apply this formatting to all kinds of poetry fragments.
Jellby is online now   Reply With Quote
Old 08-05-2013, 02:40 PM   #9
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,023
Karma: 10963125
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Quote:
Originally Posted by Jellby View Post
What mzmm means is that you could change the CSS, so that instead of ".p1" you have "div.poetry p". That way you don't have to apply any specific style to poetry lines, as long as they are enclosed in a "<div class="poetry">" block, as the "div.poetry p" selector applies to any <p> inside such a block, with or without class.


By the way, I wouldn't recommend using <p> for poetry lines because they are in fact not paragraphs. One could argue that stanzas are sort of paragraphs, but not lines. I'd use <div> or <span> (with display:block). The latter is closer to the real semantics, the former has the advantage of displaying nicely even with CSS disabled (and the disadvantage that you cannot use <p> for stanzas with that). My usual setup:

Code:
<div class="poetry">
  <div class="stanza">
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
  </div>
  <div class="stanza">
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
  </div>
</div>
("line" and "line2" have different left margins, to create the desired indent patterns, when needed.)

A bit too verbose, and one could dispose of the class="line" through CSS, but it's usually quite easy to apply this formatting to all kinds of poetry fragments.
That seems conclusive, and your explanation is very instructive. Thanks a lot!
Leonatus is offline   Reply With Quote
Old 08-06-2013, 07:50 AM   #10
mzmm
Groupie
mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.
 
mzmm's Avatar
 
Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
this is a bit tangential, but i'm actually kind of surprised that there's no plan to include semantic markup for poetry in HTML5. just came across this article which outlines different markup solutions for poetry, and proposes a, albeit kind of idealistic, set of poetry elements.

i'd actually also agree with Jellby that his <div class="stanza"><div class="line"> arrangement is semantically closer to poetic form than using paragraph elements.

anyone tried concrete poetry with <pre/>? maybe i give it a go later on.
mzmm is offline   Reply With Quote
Old 08-06-2013, 09:25 AM   #11
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Div, P will reflow, maintaining the style

I feel that Pre turn into total hash if a reflow is needed.
theducks is offline   Reply With Quote
Old 08-06-2013, 01:33 PM   #12
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,023
Karma: 10963125
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Quote:
Originally Posted by Turtle91 View Post
Div: <div class="">\1</div>
Block: <blockquote class="">\1</blockquote>
Could you, please, still explain to me the signification of "\1"?

I already read, but don't actually remember the meaning of "blockquote".
Thanks in advance!
Leonatus is offline   Reply With Quote
Old 08-06-2013, 01:54 PM   #13
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Leonatus View Post
Could you, please, still explain to me the signification of "\1"?

I already read, but don't actually remember the meaning of "blockquote".
Thanks in advance!
\1 is the first captured item in a REGEX replacement

"The Moon is Blue not very often"
Code:
Search: The (.+) is (.+) (not) 
Replace: The Sun is Red,  \2 is \3 the color of the \1&nbsp;
theducks is offline   Reply With Quote
Old 08-06-2013, 02:12 PM   #14
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,168
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Quote:
Originally Posted by Leonatus View Post
Could you, please, still explain to me the signification of "\1"?

I already read, but don't actually remember the meaning of "blockquote".
Thanks in advance!
From the Sigil Manual http://web.sigil.googlecode.com/git/...ext/clips.html
Quote:
Using Clips to Format Text

Clips provide a way to paste text before and after selected text – to give you a basic ability to format your text.

If you define a clip using "\1" in the text then Clips will treat this as a Regex replacement command. When you paste the clip, the "\1" will be replaced with whatever text was selected.
PeterT is offline   Reply With Quote
Old 08-06-2013, 02:22 PM   #15
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Nothing like me missing the correct context of the question

Basically using the \1 in the middle of a clip, wraps the clip around the selected text (AFAIK you can't multi select so \2> is not valid)
theducks is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Paragraphs in a Border teh603 Sigil 5 08-01-2013 04:41 PM
How to remove multiple class attribute from div lrui Recipes 4 08-13-2012 09:47 PM
Replace multiple matching instances within paragraph? murphycc Conversion 2 02-23-2012 09:53 AM
assigning styles to headings kamanza Sigil 9 11-14-2011 04:41 AM
Paragraph indent-size should not applied to centered paragraphs? ShellShock Calibre 3 01-16-2010 11:54 AM


All times are GMT -4. The time now is 02:43 PM.


MobileRead.com is a privately owned, operated and funded community.