Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-12-18 09:22:48

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

[resolved] Insert Textile notes between doc elements

I want to be able to insert a Textile notes list as the second to last element in a ‘blog’ article. The last element will be a short note to readers automatically appended via the article form. In other words, the notes are part of the article’s topic proper, while the message is not, thus the last place position.

For example, in the article form:

. . .
<txp:body />

<section class="yo">
 <header> . . . </header>
 <p> . . . </p>
</section>

The problem is, Textile notes (foot or end) can’t be added the same way (via the article form) because you need custom notes on an article by article basis, and I’m not about to create a separate pageless article or new form for every instance of an article’s notes, and that would probably break Textile anyway.

Textile aside a minute, I’d imagine with extended custom fields (ECFs) it will be a cinch to structure a custom doc in the Write panel like this, where each item except Title (text) is a textarea field:

  • Title
  • Body
  • Notes
  • Message

Or something more elaborate:

  • Title
  • [Front Matter Element]
  • Contents
  • Body
  • Notes
  • [Back Matter Element]

And maybe even more granular still, by breaking up the body into separate chunks like this?

  • Part [text field]
    • Chapter
    • Chapter
    • etc
  • Part [text field]
    • Chapter
    • Chapter
    • etc
  • etc [text field]

But will Textile notes ever be able to read across textareas like that? I think I hear the resounding No!. But it would sure be cool. I could export directly from Scrivner to Txp. :)

Maybe in Textup markup?

Last edited by Destry (2020-12-18 12:23:52)

Offline

#2 2020-12-18 09:29:33

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

Re: [resolved] Insert Textile notes between doc elements

Oh, just realized, for now, I can use the excerpt field for the ending message, since I’m not using excerpts in the origin domain. Though that sill requires having to remember to add the message every time, even if via a tag.

I think I’m getting confused on how this can be done. :/

Is there a way to universally prefill an excerpt with static content?

Btw, I don’t need those complicated structures theorized above, but I could imagine making use of them.

Last edited by Destry (2020-12-18 09:36:55)

Offline

#3 2020-12-18 11:19:44

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,451
Website

Re: [resolved] Insert Textile notes between doc elements

What will that “message” be containing? ie,

  • will it be the same for all articles
  • will it be different for each article
  • will it be one from a selection of a number of pre-set messages?

Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#4 2020-12-18 12:07:33

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

Re: [resolved] Insert Textile notes between doc elements

colak wrote #327606:

  • will it be the same for all articles

Yes, ‘static content’, which is why I originally thought to add it to the content article form.

But I can’t do that automatically if I use Textile notes, which are different and case-by-case, so can’t be automatically added. Thus I can’t add the static message and always count on the same position at end of an article.

Thus the question in the second post, is it possible to automatically prefill the excerpt field with static content? (I.e. not have to add it manually every time).

If so, then I can use the excerpt field for the message and my problem is solved. If not, I’ll have to decided how important the message is to warrant adding it manually every time.

Probably what I need is a plugin that doesn’t exist.

Last edited by Destry (2020-12-18 12:09:53)

Offline

#5 2020-12-18 12:23:30

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

Re: [resolved] Insert Textile notes between doc elements

I know what I’ll do.. Create a draft article with all the bits prefilled and just duplicate that each time.

Done.

Last edited by Destry (2020-12-18 14:15:24)

Offline

#6 2020-12-18 12:45:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,977
Website

Re: [resolved] Insert Textile notes between doc elements

I could maybe write a plugin to help inject default content. That might grow into something bigger over time (e.g. Start a new article of type ‘abc’) but your approach of making a draft and cloning it will work admirably in the meantime.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2020-12-18 12:51:52

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,451
Website

Re: [resolved] Insert Textile notes between doc elements

Destry wrote #327617:

Yes, ‘static content’, which is why I originally thought to add it to the content article form.

Unless you go the plugin way, you could do a short-code:

In a miscellaneous form, named msg.

<p>Your text here</p>

Where you want it in your article: ==<txp::msg />==


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#8 2020-12-18 14:19:26

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

Re: [resolved] Insert Textile notes between doc elements

Thanks, gents. I’m okay with the duplicating article bonanza.

Instead of using the excerpt as first ker-thunk, I’m just writing the block right into the dedicated page template. Since these will always be in the Notes section only (until I tire of the game), it doesn’t have to be conditional. Then it’s just add Textile notes as usual and all is good.

Offline

Board footer

Powered by FluxBB