How to indent a block of text *without* using <p> tags?

This forum is for all Flare issues not related to any of the other categories.
Post Reply
cdemaagd
Jr. Propeller Head
Posts: 7
Joined: Fri Jun 07, 2019 2:05 pm

How to indent a block of text *without* using <p> tags?

Post by cdemaagd »

First things first: SORRY IF THIS HAS BEEN ASKED AND ANSWERED ALREADY!

Hi,

I want to indent a block of code-y text in my document. It looks like this:

Code: Select all

CASE[Select a Date Level]
WHEN 'Year' THEN DATENAME('year', [Order Date])
WHEN 'Quarter' THEN DATENAME('quarter', [Order Date])
WHEN 'Month' THEN DATENAME('month', [Order Date])
END
I'd like to move it about 5 spaces in; regardless, though, what I don't want to use to accomplish it is <p> tags, as I don't want a line of space before or after it--keeping it w/i the confines of the <li> tags provides plenty of space.
What'll accomplish this? <span class="code_indent">, <div="indent">, <div="code_indent">--none of 'em work.
Any ideas? I'm all eyes!
Thanks,
CEdM
robdocsmith
Sr. Propeller Head
Posts: 248
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: How to indent a block of text *without* using <p> tags?

Post by robdocsmith »

Hard to tell from the info you've given. There are many ways to format code examples.
What are defined in the classes of DIV and SPAN you've listed? I'm not sure about your reference to LI tags. Is this example nested inside a bulleted list?

A PRE tag will use a fixed width font and preserve spaces and line breaks. Useful for code examples. You could add a margin-left to that tag to provide the indent you require. Or you could have a 'code' class of P tag that provides whatever indent you require and resets the margin/padding of a general P tag to zero. If inside a bulleted list you'd probably want to embed the code example inside a DIV. If doing that your DIV would need a padding-left inside it to give you the indent you want. For my code examples I set up a DIV with a specific 'code' class so I can put code examples in a shaded box with border to separate it from surrounding text.

Rob
cdemaagd
Jr. Propeller Head
Posts: 7
Joined: Fri Jun 07, 2019 2:05 pm

Re: How to indent a block of text *without* using <p> tags?

Post by cdemaagd »

Hi Rob,

This is an example in a numbered procedure. It's presently coded like so:

Code: Select all

<br /><span class="code">CASE</span><span class="parameter">[Select a Date Level]</span>
<br /><span class="code">WHEN</span> '<span class="parenthetical">Year</span>' <span class="code">THEN</span> <span class="function">DATENAME</span>('<span class="parenthetical">year</span>', <span class="field">[Order Date]</span>)
<br /><span class="code">WHEN</span> '<span class="parenthetical">Quarter</span>' <span class="code">THEN</span> <span class="function">DATENAME</span>('<span class="parenthetical">quarter</span>', <span class="field">[Order Date]</span>)
<br /><span class="code">WHEN</span> '<span class="parenthetical">Month</span>' <span class="code">THEN</span> <span class="function">DATENAME</span>('<span class="parenthetical">month</span>', <span class="field">[Order Date]</span>)
<br /><span class="code">END</span>
There is a P tag we frequently use, <p class="code_indent">, but I don't want to use that b/c I don't want to move the text any further below the step it's attached to. So, I'm looking for a different solution.
robdocsmith
Sr. Propeller Head
Posts: 248
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: How to indent a block of text *without* using <p> tags?

Post by robdocsmith »

So... you'd like something like:

Code: Select all

1.   Do something
2.   Do something else:
     CASE[Select a Date Level]
        WHEN 'Year' THEN DATENAME('year', [Order Date])
        WHEN 'Quarter' THEN DATENAME('quarter', [Order Date])
        WHEN 'Month' THEN DATENAME('month', [Order Date])
     END
3.  Then go make a cup of tea.
My code at the simplest level if I were to represent that would look something like:

Code: Select all

        <ol>
            <li>Do something</li>
            <li>Do something else:<pre>   CASE[Select a Date Level]
      WHEN 'Year' THEN DATENAME('year', [Order Date])
      WHEN 'Quarter' THEN DATENAME('quarter', [Order Date])
      WHEN 'Month' THEN DATENAME('month', [Order Date])
   END</pre></li>
            <li>Then go make a cup of tea.</li>
        </ol>
That would be the simplest way to do it. The PRE keeps the indent of the LI element and supplements that indent with any spaces within the PRE tags. I'd remove all the <br /> statements as the PRE takes into account line breaks in the code. I'm guessing all the "code" "parameter" "parenthetical" etc span classes are either an import artifact or they are used to colour code or otherwise format your output?

As I said, hard to say without knowing what are in your style definitions.
cdemaagd
Jr. Propeller Head
Posts: 7
Joined: Fri Jun 07, 2019 2:05 pm

Re: How to indent a block of text *without* using <p> tags?

Post by cdemaagd »

Hi Rob,

Thanks! I'll try your PRE solution. And I'll remember to remove the BR tags. And I'll report back w/ results.

Yes, all the "code" etc. span classes are used to color the code.

Best,

CEdM
robdocsmith
Sr. Propeller Head
Posts: 248
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: How to indent a block of text *without* using <p> tags?

Post by robdocsmith »

Have you tried using the code snippet tool to highlight code? Insert -> Code Snippet and select the appropriate language. SQL is one of those. It will box your code example and handle the colour coding and preservation of indentation. See https://www.madcapsoftware.com/blog/mad ... et-editor/ for more info. A code snippet can be embedded in a list element and it will be indented at the same level as the list item.

Cheers,
Rob
Post Reply