Markdown Hosing - Register Now!
Home > Authoring > Guide > Embedder | Japanese
The Live Data Embedder is a preprocessor run as a filter or handler under Apache web server for each page request. It reads a source text and dynamically replaces a special markings called macro variable with a value stored in a data table such as an SQL database table a CSV file.
There is another type of macro called button macro. You can embedd button macros in the source text to allow the user to view a list of data, type and submit new data, and update and delete the data.
The Embedder allows you to handle data in a row-by-column table. This is called data table.
Example data table:
Date | Customer | Apple | Orange | Kui |
---|---|---|---|---|
20-05-01 | yamada | 10 | 10 | 0 |
20-05-03 | suzuki | 10 | 0 | 10 |
20-05-10 | yamada | 0 | 0 | 20 |
With an Embedder-assisted web page, you can:
In Markdown you write an HTML table using vertical bars (|). When using the Embedder, you can write a single line of a table row template used to render every row data in a database table.
Change the first vertical bar with $|
and the last one to |$
to indicate that row is a row template.
| Date | Customer | Apple | Orange | Kui | |
|--|--|--|--|--|--|
$| $(date) | $(customer) | $(apple) | $(orange) | $(kui) | $(!edit) |$
A syntax of the form $(name) is called a display variable and denotes a value of column name in a data row should be displayed in place of it. If the data table contains multiple rows, column values of each row are displayed.
The row template when applied to the previous table produces the following output:
Date | Customer | Apple | Orange | Kui | |
---|---|---|---|---|---|
20-05-01 | yamada | 10 | 10 | 0 | [Edit] |
20-05-03 | suzuki | 10 | 0 | 10 | [Edit] |
20-05-10 | yamada | 0 | 0 | 20 | [Edit] |
The last column of the table, [Edit], is described in the next section.
An HTML form is used to send items of data to the web server. The following construct is an Embedder way of describing an HTML form. It can be used to write a row of data to a data table on the server.
$form$
Date: $(?date)
Name: $(?customer)
Apple: $(?apple)
Orange: $(?orange)
Kui: $(?kui)
$(!update) $(!delete)
$(!add) $(!reset)
$end$
The $forms
and $end$
markers indicate lines between them should be handled by Embedder to construct an HTML form suitable for data table operation.
The $(?name) syntax (question mark in front of variable name) is called entry variable or entry macro and it will be replaced with an HTML input field of the value.
The $(!action) syntax (exclamation mark in front of action name) is one type of button macro and called action macro. It corresponds to a submit button in an HTML form or a link button elsewhere in the page. Clicking this button requests an action on the web server and a page is reloaded.
Page actions include: add, update, delete, edit and reset.
The above form will look like:
Date: [ ]
Name: [ ]
Apple: [ ]
Orange: [ ]
Kui: [ ]
[Update] [Delete]
[Add] [Reset]
Presented by Kobu.Com
2020-may-09 project started
2020-jun-05 documents for the first working implementation
2020-aug-23 published to github