Exporting tiddler with header(*.h) file format

Dear all,

I would like to ask you about the following feature that I want to implement. I want to export my tiddler as header file(*.h) format which is not availabe now. How can I add a button that can implement this task sothat this file format will appear with the existing file formats like JSON file, STATIC HTML…? I am grateful for your help.

Regards,

Kidanu

You can start here https://tiddlywiki.com/#Creating%20a%20custom%20export%20format or I can give more details tomorrow (+12-18 hours)

I don’t know what a .h file is but I expect plain text will work as in the example given.

By the way welcome @Kidanu_Maegel to the forum!

Hi @Kidanu_Maegel and welcome.

Could you give an example of the content/format of the *.h files?

Thank you @TW_Tones and @jeremyruston for welcoming. I have tiddler file to generate a a specific task. I can export it as STATIC HTML file format and then copy over the content and save as header file like in notepad i.e. with .h extension. But, want to export this tiddler as *.h file while I perform the export tiddler option. I hope this helps in figuring out my question.

I assume you want to export a .h file for the C programming language to define function headers. right?

I think what Jeremy wanted to know, is: How does the text and or fields of a tiddler look like and how should the exported .h file look like.

TW export is done using templates so we will need to know the tiddler content to be able to export to a “special” format

Thank you @pmario that is what am looking for. I have one tiddler created with a few contents. I want to export one of the contents as header file for software application(*.h). So, when I go to “More actions” -“export tiddler” I want to get header file exporter option. And the file should look like as follows:

/*******************************************************************************
File Generation Information:
Engineer : Personal information
Date : --/--/202-
Time : to be specified
Version : first draft
Datasheet : latest datasheet
Comments : Settings
PDM Ref : document number

Integrity Source Repository Configuration Information:
Name : $Id$
Version : $Revision$
Author : $Author$
Date : $Date$
State : $State$
Location : $ProjectName$
Baseline : $ProjectRevision$
******************************************************************************

Copy write statement

(C) company

*******************************************************************************/

#ifndef _PSU_HW_CFG_H_
#define _PSU_HW_CFG_H_

#include "Platform_Types.h"

#define PSU_REG_DEVCFG0 0x00 /* Device configuration 0 *R2) */
#define PSU_REG_DEVCFG1 0x01 /* Device configuration 1 *R0) */
#define PSU_REG_DEVCFG2 0x02 /* Device configuration 2 *R2) */
#define PSU_REG_PROTCFG 0x03 /* Protection register *R2) */
#define PSU_REG_SYSPCFG0 0x04 /* Protected System configuration request 0 *R1) */
#define PSU_REG_SYSPCFG1 0x05 /* Protected System configuration request 1 *R2) */
#define PSU_REG_WDCFG0 0x06 /* Protected Watchdog configuration request 0 *R2) */
#define PSU_REG_WDCFG1 0x07 /* Protected Watchdog configuration request 1 *R2) */
#define PSU_REG_FWDCFG 0x08 /* Protected Functional watchdog configuration request *R2) */
#define PSU_REG_WWDCFG0 0x09 /* Protected Window watchdog configuration request 0 *R2) */
#define PSU_REG_WWDCFG1 0x0A /* Protected Window watchdog configuration request 1 *R2) */

/*shortened by mario (admin)*/

#define PSU_REG_CONFIG_SIZE 40U

/* Power Supply Configuration */
#define PSU_REG_CONFIG_INITIALISER \
{ \
{PSU_REG_DEVCFG0 , 0x48}, \
{PSU_REG_DEVCFG1 , 0x01}, \
{PSU_REG_DEVCFG2 , 0x60}, \
{PSU_REG_SYSPCFG0 , 0x81}, \
{PSU_REG_SYSPCFG1 , 0x0C}, \
{PSU_REG_WDCFG0 , 0x68}, \
{PSU_REG_WDCFG1 , 0x0A}, \

/*shortened by mario (admin)*/

}

#endif

Just save the tiddler as a plain text with a dot h extension as described in my previous link. I can prepare one for you if you need?

Thank you @TW_Tones. I would be happy if you can create one for me!

@Kidanu_Maegel … I did shorten your text a little bit and I did cover it in tripple backticks, so it’s shown as code.

```
your code comes here
```

Exporting a tiddler as a text file using a different extension is definitely the first step and should be OK if you are good with it.

My question is about the header info. Should this info be created dynamically from TW?

/*******************************************************************************
File Generation Information:
Engineer : Personal information
Date : --/--/202-                    <- should this info be filled automatically
Time : to be specified               using content from tiddler fields?
Version : first draft
<snip>

Integrity Source Repository Configuration Information:
Name : $Id$               <- This info look like it's filled from a preprocessor
Version : $Revision$         Is that right, or is this the stuff that should be filled by TW?
Author : $Author$
<snip>

See the comments in the text above.
Just curious?
-m

Import this to a wiki and then use the Toolbar menu > Export > Export as .h file header file exporter.json (346 Bytes)

However I suspect given;

  • You may be wanting to set values such as $Date$ $State$ etc… in which case you need to introduce a template, and identify what is default, what values are set where etc… but as you have not provided this detail it suggests you may still have work to do.


This is screenshot of the tiddler content that is created. I want to export this content as it is and want to have for example as filename.h instead of the availabe options like filename.html for STATIC HTML option. I am not sure if this futher could help in figuring out my intention.

That is what I just gave you in a single tiddler you can modify to your taste see here

Kindly could you tell more how to create the tags because I couldn’t find the mentioned tag/ Exporter? Thank you @TW_Tones !

After installing the tiddler I gave you go to the menu as in your screen shot and the option will be there, however I don’t know what tags you mean?

  • I do think you need to explain what you want more, its hard to work out from what you have said.

I can see tiddler contents can be exported as html files. But, can I save/export same tiddler file content automatically compatible for c/c++ programming?.i.e upon saving/exporting it must have same contents as seen in the screen shot and with *.h file extension.

The solution I have you should do that already.