mirror of
https://github.com/Django-LiveView/docs.git
synced 2025-12-31 05:32:23 +01:00
Replace submodule with direct copy of one.el fork for Docker compatibility
This commit is contained in:
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,4 +0,0 @@
|
||||
[submodule "one.el"]
|
||||
path = one.el
|
||||
url = git@github.com:tanrax/one.el.git
|
||||
branch = add-table-support
|
||||
1
one.el
1
one.el
Submodule one.el deleted from 19605b02b2
674
one.el/LICENSE
Normal file
674
one.el/LICENSE
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
16
one.el/README.org
Normal file
16
one.el/README.org
Normal file
@@ -0,0 +1,16 @@
|
||||
~one.el~ a simple Static Site Generator for Emacs Lisp programmers and
|
||||
org-mode users.
|
||||
|
||||
Check the docs: https://one.tonyaldon.com.
|
||||
|
||||
Note that the docs are built using ~one.el~ itself. To build them,
|
||||
visit [[./docs/docs.org]] and call ~one-build~ command. This will build the
|
||||
docs under ~./docs/public/~ subdirectory.
|
||||
|
||||
To run the tests, visit [[./one-tests.el]] and call the ~eval-buffer~
|
||||
and ~ert~ commands like this:
|
||||
|
||||
- M-x eval-buffer
|
||||
- M-x ert RET RET
|
||||
|
||||
Check the [[./LICENSE]].
|
||||
15
one.el/docker/Dockerfile
Normal file
15
one.el/docker/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM debian:12-slim
|
||||
|
||||
# set work directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Print output
|
||||
RUN export TERM=xterm
|
||||
|
||||
# install software
|
||||
RUN apt update
|
||||
RUN apt install -y emacs-nox
|
||||
|
||||
# Build
|
||||
COPY build.el .
|
||||
ENTRYPOINT emacs --batch --script build.el
|
||||
8
one.el/docker/build.el
Normal file
8
one.el/docker/build.el
Normal file
@@ -0,0 +1,8 @@
|
||||
(progn
|
||||
(require 'package)
|
||||
(add-to-list 'package-archives
|
||||
'("melpa" . "https://melpa.org/packages/") t)
|
||||
(package-initialize)
|
||||
(package-refresh-contents)
|
||||
(package-install 'one)
|
||||
(one-build))
|
||||
8
one.el/docker/compose.yaml
Normal file
8
one.el/docker/compose.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
services:
|
||||
|
||||
one-el:
|
||||
build: .
|
||||
restart: "no"
|
||||
volumes:
|
||||
- .:/usr/src/app/
|
||||
BIN
one.el/docs/assets/img/keep-learning.png
Normal file
BIN
one.el/docs/assets/img/keep-learning.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
499
one.el/docs/assets/one.css
Normal file
499
one.el/docs/assets/one.css
Normal file
@@ -0,0 +1,499 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400&family=Noto+Sans:wght@400;700&display=swap');
|
||||
|
||||
html, body, p, ol, ul, li, dl, dt, dd,
|
||||
blockquote, figure, fieldset, legend, textarea,
|
||||
pre, iframe, hr, h1, h2, h3, h4, h5, h6 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
p, blockquote, ul, ol, code,
|
||||
dl, table, pre, details {
|
||||
margin-bottom: 16px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 2em;
|
||||
list-style: disc;
|
||||
}
|
||||
|
||||
ul ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
ol {
|
||||
padding-left: 2em;
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
li p:first-of-type {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
li p {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
li code {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-padding-top: 4rem; /* because we use a sticky header */
|
||||
}
|
||||
|
||||
body {
|
||||
background: #151515;
|
||||
color: #dedede;
|
||||
font-family: "Noto Sans",sans-serif;
|
||||
font-size: 106%;
|
||||
line-height: 1.5;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
h2, h3, h4, h5, h6 {
|
||||
padding-bottom: 0.3em;
|
||||
margin-top: 24px;
|
||||
margin-bottom: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
h2, h3 {
|
||||
border-bottom: 1px solid #1d272b;
|
||||
}
|
||||
|
||||
h2 {font-size: 2em;}
|
||||
h3 {font-size: 1.5em;}
|
||||
h4 {font-size: 1.25em;}
|
||||
h5 {font-size: 1em;}
|
||||
h6 {font-size: .875em;}
|
||||
|
||||
a {
|
||||
color: #ffd787;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #ffd787;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/* ------- '.one' classes used by 'one-ox' org backend ------- */
|
||||
|
||||
.one-hl {
|
||||
font-family: 'Fira Mono', monospace;
|
||||
font-size: 80%;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.one-hl-inline {
|
||||
background: #31424a;
|
||||
padding: 0.2em 0.4em;
|
||||
margin: 0;
|
||||
white-space: break-spaces;
|
||||
}
|
||||
|
||||
.one-hl-block {
|
||||
background: #161f22;
|
||||
color: #c5c5c5;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
padding: 16px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.one-blockquote {
|
||||
background: #202d31;
|
||||
border-left: 0.3em solid #31424a;
|
||||
margin: 0px auto 16px;
|
||||
padding: 1em 1em;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.one-blockquote > p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.one-hl-results {
|
||||
background: #202d31 ;
|
||||
border-left: 2px solid #c5c5c5;
|
||||
display: block;
|
||||
margin: auto;
|
||||
padding: 0.5em 1em;
|
||||
overflow: auto;
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
.one-hl-negation-char { color: #ff6c60} /* font-lock-negation-char-face */
|
||||
.one-hl-warning { color: #fd971f} /* font-lock-warning-face */
|
||||
.one-hl-variable-name { color: #fd971f} /* font-lock-variable-name-face */
|
||||
.one-hl-doc { color: #d3b2a1} /* font-lock-doc-face */
|
||||
.one-hl-doc-string { color: #d3b2a1} /* font-lock-doc-string-face */
|
||||
.one-hl-string { color: #d3b2a1} /* font-lock-string-face */
|
||||
.one-hl-function-name { color: #02d2da} /* font-lock-function-name-face */
|
||||
.one-hl-builtin { color: #b2a1d3} /* font-lock-builtin-face */
|
||||
.one-hl-type { color: #457f8b} /* font-lock-type-face */
|
||||
.one-hl-keyword { color: #f92672} /* font-lock-keyword-face */
|
||||
.one-hl-preprocessor { color: #f92672} /* font-lock-preprocessor-face */
|
||||
.one-hl-comment-delimiter { color: #8c8c8c} /* font-lock-comment-delimiter-face */
|
||||
.one-hl-comment { color: #8c8c8c} /* font-lock-comment-face */
|
||||
.one-hl-constant { color: #f5ebb6} /* font-lock-constant-face */
|
||||
.one-hl-reference { color: #f5ebb6} /* font-lock-reference-face */
|
||||
.one-hl-regexp-grouping-backslash { color: #966046} /* font-lock-regexp-grouping-backslash */
|
||||
.one-hl-regexp-grouping-construct { color: #aa86ee} /* font-lock-regexp-grouping-construct */
|
||||
.one-hl-number { color: #eedc82} /* font-lock-number-face */
|
||||
|
||||
.one-hl-sh-quoted-exec { color: #62bd9c} /* sh-quoted-exec */
|
||||
|
||||
.one-hl-ta-colon-keyword {color: #62b5e0;} /* ta-colon-keyword-face */
|
||||
|
||||
|
||||
.one-hl-org-code { color: #dedede; background: #31424a; }
|
||||
.one-hl-org-block { color: #c5c5c5 ; background: #31424a; }
|
||||
.one-hl-org-block-begin-line { color: #c3957e; }
|
||||
.one-hl-org-block-end-line { color: #c3957e; }
|
||||
.one-hl-org-meta-line { color: #8c8c8c;}
|
||||
.one-hl-org-quote { color: #c5c5c5}
|
||||
.one-hl-org-drawer { color: #d3b2a1; font-size: 0.9em; }
|
||||
.one-hl-org-special-keyword { color: #c3957e; font-size: 0.9em; }
|
||||
.one-hl-org-property-value { color: #d2934a; font-size: 0.9em; }
|
||||
.one-hl-org-level-1 { font-size: 1.7em; text-decoration: underline; }
|
||||
.one-hl-org-level-2 { font-size: 1.4em; text-decoration: underline; }
|
||||
.one-hl-org-level-3 { font-size: 1.2em; text-decoration: underline; }
|
||||
.one-hl-org-level-4 { font-size: 1.1em; text-decoration: underline; }
|
||||
.one-hl-org-level-5 { font-size: 1.0em; text-decoration: underline; }
|
||||
.one-hl-org-level-6 { font-size: 1.0em; text-decoration: underline; }
|
||||
.one-hl-org-level-8 { font-size: 1.0em; text-decoration: underline; }
|
||||
.one-hl-org-level-8 { font-size: 1.0em; text-decoration: underline; }
|
||||
|
||||
|
||||
/* -------- scrollbar -------- */
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #202d31;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #31424a;
|
||||
border-radius: 0.5em;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #31424a;
|
||||
}
|
||||
|
||||
/* -------- specific to the default render functions -------- */
|
||||
|
||||
.header {
|
||||
color: #ffffff;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
padding: 0 16px 0 16px;
|
||||
background: #151515;
|
||||
width: 100%;
|
||||
height: 3.5rem;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-bottom: 1px solid #1d272b;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header > a {
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.header > a:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin: 3.5rem auto;
|
||||
padding-top: 1.8rem;
|
||||
max-width: 740px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
padding: 1.8rem 0;
|
||||
}
|
||||
|
||||
.title-empty {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
/* -------- one-default-home -------- */
|
||||
|
||||
#home {
|
||||
margin: 5rem 0 1.5rem 0;
|
||||
}
|
||||
|
||||
/* -------- one-default-home-list-pages -------- */
|
||||
|
||||
#home-list-pages {
|
||||
margin: 5rem 0 1.5rem 0;
|
||||
}
|
||||
|
||||
#pages ul {
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#pages a {
|
||||
display: block;
|
||||
line-height: 1.2em;
|
||||
font-size: 1.2em;
|
||||
color: #dedede;
|
||||
border-bottom: 1px solid #1d272b;
|
||||
padding: 1em 0.3em;
|
||||
}
|
||||
|
||||
#pages a:hover {
|
||||
text-decoration: none;
|
||||
background: #31424a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* -------- one-default, one-default-with-toc, one-default-with-sidebar, one-default-doc -------- */
|
||||
|
||||
.nav {
|
||||
border-top: 1px solid #c5c5c5;
|
||||
margin-top: 3em;
|
||||
padding: 2em 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nav a {
|
||||
display: block;
|
||||
background: #dedede;
|
||||
border-radius: 6px;
|
||||
padding: 0.2em 0.8em;
|
||||
color: #151515;
|
||||
width: 20%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width:600px) {
|
||||
.nav a {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------- one-default-with-toc, one-default-doc -------- */
|
||||
|
||||
.toc {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 1.8rem;
|
||||
color: #d1d1d1;
|
||||
}
|
||||
|
||||
.toc > div {
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
.toc a {
|
||||
color: #d1d1d1;
|
||||
}
|
||||
|
||||
.toc > div > div:first-child {
|
||||
text-decoration: underline 1px;
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* --------- one-default-with-sidebar, one-default-doc --------- */
|
||||
|
||||
#sidebar-header {
|
||||
color: #ffffff;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
padding: 0 16px 0 16px;
|
||||
background: #151515;
|
||||
width: 100%;
|
||||
height: 3.5rem;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-bottom: 1px solid #1d272b;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#sidebar-header > a {
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#sidebar-header > a:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#hamburger {
|
||||
cursor: pointer;
|
||||
height: 1em;
|
||||
fill: #dedede;
|
||||
display: none;
|
||||
font-weight: normal;
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
|
||||
#sidebar-content {
|
||||
margin: 3.5rem auto;
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 1140px;
|
||||
width: 100%;
|
||||
padding: 1em 16px;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
border-right: 2px solid #31424a;
|
||||
top: 4.5rem;
|
||||
position: sticky;
|
||||
padding-top: 2.2em;
|
||||
padding-bottom: 6em;
|
||||
width: 250px;
|
||||
max-height: 100vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#sidebar a {
|
||||
display: block;
|
||||
color: #dedede;
|
||||
}
|
||||
|
||||
#sidebar a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#sidebar ul {
|
||||
list-style: none;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#sidebar li {
|
||||
padding: 0.5em 0.6em;
|
||||
}
|
||||
|
||||
#sidebar li:hover {
|
||||
background: #31424a;
|
||||
}
|
||||
|
||||
article {
|
||||
padding: 0 1.5em;
|
||||
max-width: 640px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#sidebar-left {
|
||||
width: 0;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
z-index: 3;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transition: 0.25s;
|
||||
background: #2c444f;
|
||||
overflow: hidden; /* to make the children disappear when width is 0 */
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#sidebar-left > div:first-child {
|
||||
height: 3.5rem;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid #b8b8b8;
|
||||
padding-left: 16px;
|
||||
margin-bottom: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#sidebar-left > ul {
|
||||
padding: 0 16px 0 16px;
|
||||
}
|
||||
|
||||
#sidebar-left > ul ul {
|
||||
padding-left: 0.8em;
|
||||
margin-left: 3px;
|
||||
border-left: 1px solid #b8b8b8;
|
||||
}
|
||||
|
||||
#sidebar-left a {
|
||||
color: #dedede;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#sidebar-left li {
|
||||
padding: 0.5em 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#sidebar-main {
|
||||
display: none;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
background: #080808;
|
||||
opacity: 0.80;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
@media (max-width: 840px) {
|
||||
#hamburger {
|
||||
display: block;
|
||||
}
|
||||
#sidebar {
|
||||
display: none;
|
||||
}
|
||||
#sidebar-content {
|
||||
justify-content: center;
|
||||
}
|
||||
#sidebar-header {
|
||||
justify-content: left;
|
||||
}
|
||||
article {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
1790
one.el/docs/docs.org
Normal file
1790
one.el/docs/docs.org
Normal file
File diff suppressed because it is too large
Load Diff
26
one.el/docs/onerc.el
Normal file
26
one.el/docs/onerc.el
Normal file
@@ -0,0 +1,26 @@
|
||||
;; We do this because we want org-mode links in source block
|
||||
;; (with org-mode content) to be visible (link and description parts).
|
||||
;; You can use (remove-hook 'org-mode-hook #'visible-mode) to remove it.
|
||||
(add-hook 'org-mode-hook #'visible-mode)
|
||||
|
||||
(require 'ol)
|
||||
|
||||
(defun one-ox-link-youtube (link description type info)
|
||||
"Export youtube link `[[youtube:youtube-id]]'."
|
||||
(let ((youtube-embed-link (concat "https://www.youtube.com/embed/" link)))
|
||||
(jack-html
|
||||
`(:iframe
|
||||
(@
|
||||
:style "width:100%;aspect-ratio: 16 / 9;"
|
||||
:src ,(concat youtube-embed-link "?"
|
||||
;; "autoplay=1"
|
||||
"&fs=1" ; show the fullscreen button
|
||||
"&modestbranding=1" ; don't show YouTube logo in bottom right
|
||||
"&rel=0" ; show only related video from my channel
|
||||
"&widget_referrer=https://one.tonyaldon.com" ; analytics
|
||||
)
|
||||
:title "YouTube video player playing "
|
||||
:frameborder "0"
|
||||
:allow "fullscreen;accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture;web-share")))))
|
||||
|
||||
(org-link-set-parameters "youtube" :export #'one-ox-link-youtube)
|
||||
128
one.el/docs/public/docs/getting-started/index.html
Normal file
128
one.el/docs/public/docs/getting-started/index.html
Normal file
@@ -0,0 +1,128 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>Getting started</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>Getting started</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#one-fff84715f6">Start a new project</a></li>
|
||||
<li><a href="#one-ced66c2cf7">Modify the content with live reloading</a></li>
|
||||
<li><a href="#one-ad763b19d6">CSS style sheet</a>
|
||||
<ul>
|
||||
<li><a href="#one-7485554214">Modify the CSS style sheet with live reloading</a></li>
|
||||
<li><a href="#one-1aac4eaf20">Source blocks</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div></div></div><div></div>
|
||||
<div><h2 id="one-fff84715f6">Start a new project</h2><div><p>By calling <code class="one-hl one-hl-inline">one-default-new-project</code> command (preferably in an empty
|
||||
directory) we produce a new <code class="one-hl one-hl-inline">one.el</code> project with the following
|
||||
structure:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">.
|
||||
├── assets
|
||||
│ └── one.css
|
||||
└── one.org</code></pre>
|
||||
|
||||
<p>Once done we can build the website under the directory <code class="one-hl one-hl-inline">./public/</code>
|
||||
by calling <code class="one-hl one-hl-inline">one-build</code> command while we are in the file <code class="one-hl one-hl-inline">one.org</code>. Our
|
||||
project's structure is now:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">.
|
||||
├── assets
|
||||
│ └── one.css
|
||||
├── one.org
|
||||
└── public
|
||||
├── blog
|
||||
│ ├── default
|
||||
│ │ └── index.html
|
||||
│ ├── default-home-list-pages
|
||||
│ │ └── index.html
|
||||
│ ├── one-default-doc
|
||||
│ │ └── index.html
|
||||
│ ├── one-default-with-sidebar
|
||||
│ │ └── index.html
|
||||
│ └── one-default-with-toc
|
||||
│ └── index.html
|
||||
├── index.html
|
||||
└── one.css</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-ced66c2cf7">Modify the content with live reloading</h2><div><p>To get our website up and running, we serve the files in <code class="one-hl one-hl-inline">./public/</code>
|
||||
subdirectory using <a href="https://browsersync.io">brower-sync</a> (any webserver serving files is OK).
|
||||
Once we have it installed, to start a webserver with live reloading,
|
||||
we run the following commands (in a terminal):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">$ cd public
|
||||
$ browser-sync start -s -w --files "*"</code></pre>
|
||||
|
||||
<p>Assuming the port <code class="one-hl one-hl-inline">3000</code> isn't used we have our website served at
|
||||
<code class="one-hl one-hl-inline">http://localhost:3000</code>.
|
||||
</p>
|
||||
|
||||
<p>Now we can modify the content of <code class="one-hl one-hl-inline">one.org</code> file and see the changes
|
||||
reflected in the browser after we rebuild/re-render the whole website
|
||||
or part of it using the following commands <code class="one-hl one-hl-inline">one-build</code>, <code class="one-hl one-hl-inline">one-render-pages</code>
|
||||
and <code class="one-hl one-hl-inline">one-render-page-at-point</code> or the asynchronous version of those
|
||||
commands <code class="one-hl one-hl-inline">one-build-async</code>, <code class="one-hl one-hl-inline">one-render-pages-async</code> and
|
||||
<code class="one-hl one-hl-inline">one-render-page-at-point-async</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-ad763b19d6">CSS style sheet</h2><div><p>When we call <code class="one-hl one-hl-inline">one-build</code> (or <code class="one-hl one-hl-inline">one-build-async</code>) command the pages of the
|
||||
website are rendered in the directory <code class="one-hl one-hl-inline">./public/</code> and the files in
|
||||
<code class="one-hl one-hl-inline">./assets/</code> directory are copied into <code class="one-hl one-hl-inline">./public/</code> subdirectory.
|
||||
</p>
|
||||
|
||||
<p>When we build a <code class="one-hl one-hl-inline">one.el</code> website with the default render functions and
|
||||
the default CSS style sheet (this is the case if we used
|
||||
<code class="one-hl one-hl-inline">one-default-new-project</code> as we did above) the style sheet that applies
|
||||
is <code class="one-hl one-hl-inline">./public/one.css</code> file which is a copy of <code class="one-hl one-hl-inline">./assets/one.css</code> file.
|
||||
</p>
|
||||
|
||||
<p>So in that case, to modify the website's layout we just have to modify
|
||||
the file <code class="one-hl one-hl-inline">./assets/one.css</code> and copy it in <code class="one-hl one-hl-inline">./public/</code> directory either
|
||||
with <code class="one-hl one-hl-inline">one-build</code>, <code class="one-hl one-hl-inline">one-build-async</code> or <code class="one-hl one-hl-inline">one-copy-assets-to-public</code>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-7485554214">Modify the CSS style sheet with live reloading</h3><div><p>To get the file <code class="one-hl one-hl-inline">./assets/one.css</code> copied into <code class="one-hl one-hl-inline">./public/</code> directory each
|
||||
time we modify it we can use <a href="https://eradman.com/entrproject/">entr</a> utility like this (being at the root
|
||||
of our project):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">$ ls assets/one.css | entr -s 'cp assets/one.css public/'</code></pre>
|
||||
|
||||
<p>Combined with <code class="one-hl one-hl-inline">browser-sync</code> live reloading I think we get a decent
|
||||
programmer experience.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-1aac4eaf20">Source blocks</h3><div><p>When we use the default render functions and the default CSS style
|
||||
sheet, the org content is exported into HTML strings using <code class="one-hl one-hl-inline">one-ox</code> org
|
||||
export backend. Consequently, <code class="one-hl one-hl-inline">src-block</code> elements are highlighted
|
||||
using <a href="https://github.com/hniksic/emacs-htmlize">htmlize</a>.
|
||||
</p>
|
||||
|
||||
<p>See <a href="/docs/one-ox-src-block/">one-ox | src-block</a> for more information.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/install-one-el/">PREV</a><a href="/docs/how-does-one-el-work/">RANDOM</a><a href="/docs/how-does-one-el-work/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
118
one.el/docs/public/docs/how-does-one-el-work/index.html
Normal file
118
one.el/docs/public/docs/how-does-one-el-work/index.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>How does one.el work?</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>How does one.el work?</h1></div><div><p>In an org file containing all the pages of our website we can build
|
||||
the website under <code class="one-hl one-hl-inline">./public/</code> subdirectory by calling either <code class="one-hl one-hl-inline">one-build</code>
|
||||
or <code class="one-hl one-hl-inline">one-render-pages</code> commands.
|
||||
</p>
|
||||
|
||||
<p>The only difference between those two commands is that before
|
||||
producing the HTML pages calling <code class="one-hl one-hl-inline">one-render-pages</code>, <code class="one-hl one-hl-inline">one-build</code> command
|
||||
cleans the subdirectory <code class="one-hl one-hl-inline">./public/</code> and copies the content of <code class="one-hl one-hl-inline">./assets/</code>
|
||||
subdirectory into <code class="one-hl one-hl-inline">./public/</code> subdirectory.
|
||||
</p>
|
||||
|
||||
<p>So let's focus on <code class="one-hl one-hl-inline">one-render-pages</code> command.
|
||||
</p>
|
||||
|
||||
<p>For each page of our website, the function <code class="one-hl one-hl-inline">one-render-pages</code> uses
|
||||
the render function set in <code class="one-hl one-hl-inline">ONE</code> org property of the page to produce the
|
||||
HTML string representing the page and stores it in an <code class="one-hl one-hl-inline">index.html</code> file
|
||||
whom path is determined by <code class="one-hl one-hl-inline">CUSTOM_ID</code> org property of the page.
|
||||
</p>
|
||||
|
||||
<p>Render functions are at the heart of <code class="one-hl one-hl-inline">one.el</code> mechanism. They
|
||||
determined how pages are rendered. Specifically, render functions are
|
||||
regular Elisp functions that takes 3 arguments
|
||||
</p>
|
||||
|
||||
<ul><li><p><code class="one-hl one-hl-inline">page-tree</code>: corresponding to the parsed tree of the org entry defining
|
||||
the page,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">pages</code>: the list of pages,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">global</code>: a plist of global informations that are computed once
|
||||
in <code class="one-hl one-hl-inline">one-render-pages</code> (see <code class="one-hl one-hl-inline">one-add-to-global</code>) before rendering the
|
||||
pages
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>and return HTML strings.
|
||||
</p>
|
||||
|
||||
<p>For instance, the following <code class="one-hl one-hl-inline">hello-world</code> function
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">defun</span> <span class="one-hl-function-name">hello-world</span> (page-tree pages global)
|
||||
<span class="one-hl-doc">"<h1>Hello world!</h1>"</span>)</code></pre>
|
||||
|
||||
<p>defines a valid render function. We can use it to build a website
|
||||
like this. In an empty directory, we create a file named <code class="one-hl one-hl-inline">one.org</code> with
|
||||
the following content:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-level-1">* The home page</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">hello-world</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
<span class="one-hl-org-level-1">* Blog post 1</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">hello-world</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span><span class="one-hl-org-property-value"><span class="one-hl-italic">blog/page-1</span></span><span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span></code></pre>
|
||||
|
||||
<p>We visit that file and call <code class="one-hl one-hl-inline">one-build</code> command. It produces the
|
||||
following files
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">.
|
||||
├── one.org (already there)
|
||||
└── public
|
||||
├── blog
|
||||
│ └── page-1
|
||||
│ └── index.html
|
||||
└── index.html</code></pre>
|
||||
|
||||
<p>and both files <code class="one-hl one-hl-inline">./public/blog/page-1/index.html</code> and
|
||||
<code class="one-hl one-hl-inline">./public/index.html</code> have the same content:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">h1</span>><span class="one-hl-underline"><span class="one-hl-bold">Hello world!</span></span></<span class="one-hl-function-name">h1</span>></code></pre>
|
||||
|
||||
<p>Therefore if we serve the website in <code class="one-hl one-hl-inline">./public/</code> directory at
|
||||
<code class="one-hl one-hl-inline">http://localhost:3000</code> we can access the two "Hello world!" pages
|
||||
at <code class="one-hl one-hl-inline">http://localhost:3000/blog/page-1/</code> and <code class="one-hl one-hl-inline">http://localhost:3000</code>.
|
||||
</p>
|
||||
|
||||
<p>That's it! This is how <code class="one-hl one-hl-inline">one.el</code> works under the hood.
|
||||
</p>
|
||||
|
||||
<p><code class="one-hl one-hl-inline">one.el</code> comes with predefined render functions, a custom CSS style
|
||||
sheet and a custom <a href="/docs/one-ox/">org export backend</a> which are used all together to
|
||||
build that documentation for instance.
|
||||
</p>
|
||||
|
||||
<p>See <a href="/docs/getting-started/">Getting started</a> to start a new project with those defaults.
|
||||
</p>
|
||||
|
||||
<p>See <a href="/docs/one-default-render-function/">one-default render function</a> to take inspiration and write your own
|
||||
render functions.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/getting-started/">PREV</a><a href="/docs/one-ox-links/">RANDOM</a><a href="/docs/one-default-render-function/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
67
one.el/docs/public/docs/install-one-el/index.html
Normal file
67
one.el/docs/public/docs/install-one-el/index.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>Install one.el</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>Install one.el</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#one-ac20279584">Manually</a></li>
|
||||
<li><a href="#one-eaf4ae9ecb">With package-install</a></li>
|
||||
<li><a href="#one-a1187fba35">With straight.el</a></li>
|
||||
<li><a href="#one-1534c0c759">Let's go</a></li>
|
||||
</ul>
|
||||
</div></div></div><div></div>
|
||||
<div><h2 id="one-ac20279584">Manually</h2><div><p><code class="one-hl one-hl-inline">one.el</code> depends on <a href="https://jack.tonyaldon.com/">jack</a> and <a href="https://github.com/hniksic/emacs-htmlize">htmlize</a> packages that are available on
|
||||
<a href="https://melpa.org/">Melpa</a>. Once you have them installed you can add <code class="one-hl one-hl-inline">one.el</code> to your
|
||||
<code class="one-hl one-hl-inline">load-path</code> and require it like this:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(add-to-list 'load-path <span class="one-hl-string">"/path/to/one.el/"</span>)
|
||||
(<span class="one-hl-keyword">require</span> '<span class="one-hl-constant">one</span>)</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-eaf4ae9ecb">With package-install</h2><div><p><code class="one-hl one-hl-inline">one.el</code> is also available on <a href="https://melpa.org/">Melpa</a> so you can install it like this:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">M-x package-install <RET> one <RET></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-a1187fba35">With straight.el</h2><div><p>If you're using <a href="https://github.com/radian-software/straight.el">straight.el</a>, to install <code class="one-hl one-hl-inline">one.el</code> you just have to add
|
||||
this sexp to your init file:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(straight-use-package
|
||||
'(one <span class="one-hl-ta-colon-keyword">:type</span> git <span class="one-hl-ta-colon-keyword">:host</span> github <span class="one-hl-ta-colon-keyword">:repo</span> <span class="one-hl-string">"tonyaldon/one.el"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:build</span> (<span class="one-hl-ta-colon-keyword">:not</span> compile)))</code></pre>
|
||||
|
||||
<p>Note that <code class="one-hl one-hl-inline">:build (:not compile)</code> is important. It tells <code class="one-hl one-hl-inline">straight.el</code>
|
||||
not to byte compile <code class="one-hl one-hl-inline">one.el</code>. Something happened in <code class="one-hl one-hl-inline">straight.el</code>
|
||||
between commits <code class="one-hl one-hl-inline">3eca39d</code> and <code class="one-hl one-hl-inline">b3760f5</code> which broke byte compilation of
|
||||
<code class="one-hl one-hl-inline">one.el</code> if done by <code class="one-hl one-hl-inline">straight.el</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-1534c0c759">Let's go</h2><div><p>Now you can create a new website by calling <code class="one-hl one-hl-inline">one-default-new-project</code>
|
||||
(preferably in an empty directory) and you can build it by calling
|
||||
<code class="one-hl one-hl-inline">one-build</code> command.
|
||||
</p>
|
||||
|
||||
<p>If this is the first time you try <code class="one-hl one-hl-inline">one.el</code> reading <a href="/docs/getting-started/">Getting started</a>
|
||||
page might be helpful.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/">PREV</a><a href="/docs/one-ox-fixed-width-and-example-block/">RANDOM</a><a href="/docs/getting-started/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
380
one.el/docs/public/docs/miscellaneous/index.html
Normal file
380
one.el/docs/public/docs/miscellaneous/index.html
Normal file
@@ -0,0 +1,380 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>Miscellaneous</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>Miscellaneous</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#one-7849b76119">Page at point</a></li>
|
||||
<li><a href="#one-5e7668f9">onerc.el file</a></li>
|
||||
<li><a href="#one-add-to-global">one-add-to-global</a></li>
|
||||
<li><a href="#one-2bb1fb9f9c">one-hook</a>
|
||||
<ul>
|
||||
<li><a href="#one-4b5c864e3">feed.xml example</a></li>
|
||||
<li><a href="#one-b384e1a8d3">robot.txt and sitemap.txt</a>
|
||||
<ul>
|
||||
<li><a href="#one-cec93f2132">robot.txt</a></li>
|
||||
<li><a href="#one-79c7819a9f">sitemap.txt</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#one-aea745fd2f">Async commands</a></li>
|
||||
<li><a href="#extend-one-ox-org-backend">Extend one-ox org backend</a>
|
||||
<ul>
|
||||
<li><a href="#one-b24de69c14">Extend one-ox with horizontal-rule org elements</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div></div></div><div></div>
|
||||
<div><h2 id="one-7849b76119">Page at point</h2><div><p>If we need to render only the page at point, meaning the headline of
|
||||
level 1 with <code class="one-hl one-hl-inline">ONE</code> and <code class="one-hl one-hl-inline">CUSTOM_ID</code> org properties set, we can use the
|
||||
commands <code class="one-hl one-hl-inline">one-render-page-at-point</code> and <code class="one-hl one-hl-inline">one-render-page-at-point-async</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-5e7668f9">onerc.el file</h2><div><p>We can use an Emacs Lisp file called <code class="one-hl one-hl-inline">onerc.el</code> to customize our
|
||||
website. It must be in the same directory of the org file containing
|
||||
the content of our website.
|
||||
</p>
|
||||
|
||||
<p>This file is loaded first in <code class="one-hl one-hl-inline">one-render-pages</code> before rendering the
|
||||
webpages.
|
||||
</p>
|
||||
|
||||
<p>This is a good place to set <code class="one-hl one-hl-inline">one-add-to-global</code> and <code class="one-hl one-hl-inline">one-hook</code> variables
|
||||
or to define our own render functions.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-add-to-global">one-add-to-global</h2><div><p>Render functions takes 3 arguments:
|
||||
</p>
|
||||
|
||||
<ul><li><p><code class="one-hl one-hl-inline">page-tree</code>: the parsed tree of the page being rendered,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">pages</code>: the list of pages,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">global</code>: a plist of global informations that are computed once
|
||||
in <code class="one-hl one-hl-inline">one-render-pages</code> before rendering the pages using
|
||||
<code class="one-hl one-hl-inline">one-add-to-global</code> variable.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>That means that if a render function needs extra informations, we can
|
||||
use <code class="one-hl one-hl-inline">one-add-to-global</code> variable to pass those informations to the
|
||||
render function.
|
||||
</p>
|
||||
|
||||
<p>Specifically, elements in <code class="one-hl one-hl-inline">one-add-to-global</code> list are plist with the
|
||||
following properties:
|
||||
</p>
|
||||
|
||||
<ul><li><p><code class="one-hl one-hl-inline">:one-global-property</code>: a keyword that is used as proprety
|
||||
in the <code class="one-hl one-hl-inline">global</code> argument passed to the render functions,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">:one-global-function</code>: a function that takes two arguments <code class="one-hl one-hl-inline">pages</code>
|
||||
(list of pages, see <code class="one-hl one-hl-inline">one-list-pages</code>) and <code class="one-hl one-hl-inline">tree</code>
|
||||
(see <code class="one-hl one-hl-inline">one-parse-buffer</code>). That function is called once in
|
||||
<code class="one-hl one-hl-inline">one-render-pages</code> and its result is used as the value of
|
||||
the property <code class="one-hl one-hl-inline">:one-global-property</code> in the <code class="one-hl one-hl-inline">global</code> argument
|
||||
passed to the render functions.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>For instance, if <code class="one-hl one-hl-inline">one-add-to-global</code> is set to
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">((<span class="one-hl-ta-colon-keyword">:one-global-property</span> <span class="one-hl-ta-colon-keyword">:one-tree</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-global-function</span> (<span class="one-hl-keyword">lambda</span> (pages tree) tree)))</code></pre>
|
||||
|
||||
<p>then <code class="one-hl one-hl-inline">global</code> local variable will be set to
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">((<span class="one-hl-ta-colon-keyword">:one-tree</span> tree))</code></pre>
|
||||
|
||||
<p>where <code class="one-hl one-hl-inline">tree</code> is the value returned by <code class="one-hl one-hl-inline">one-parse-buffer</code> function.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-2bb1fb9f9c">one-hook</h2><div><p>Each function in <code class="one-hl one-hl-inline">one-hook</code> is called once in <code class="one-hl one-hl-inline">one-render-pages</code>.
|
||||
</p>
|
||||
|
||||
<p>Those functions take three arguments:
|
||||
</p>
|
||||
|
||||
<ul><li><p><code class="one-hl one-hl-inline">pages</code>: list of pages (see <code class="one-hl one-hl-inline">one-list-pages</code>),
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">tree</code>: see <code class="one-hl one-hl-inline">one-parse-buffer</code>,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">global</code>: see <a href="/docs/miscellaneous/#one-add-to-global">one-add-to-global</a>.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>As those functions take <code class="one-hl one-hl-inline">global</code> argument they are called after
|
||||
that argument has been let binded using <code class="one-hl one-hl-inline">one-add-to-global</code>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-4b5c864e3">feed.xml example</h3><div><p>This hook is used to build <code class="one-hl one-hl-inline">feed.xml</code> file of <a href="https://minibuffer.tonyaldon.com">minibuffer.tonyaldon.com</a>
|
||||
website. You can check <code class="one-hl one-hl-inline">onerc.el</code> file of
|
||||
<a href="https://github.com/tonyaldon/minibuffer.tonyaldon.com">tonyaldon/minibuffer.tonyaldon.com</a> repository to see how it is done.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-b384e1a8d3">robot.txt and sitemap.txt</h3><div><p>If we want to add a <code class="one-hl one-hl-inline">sitemap.txt</code> file to our website we can do so using
|
||||
<code class="one-hl one-hl-inline">one-hook</code>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div><h4 id="one-cec93f2132">robot.txt</h4><div><p>First we need to indicate in a <code class="one-hl one-hl-inline">robots.txt</code> where our <code class="one-hl one-hl-inline">sitemap.txt</code> is
|
||||
located.
|
||||
</p>
|
||||
|
||||
<p>Assuming our website is <code class="one-hl one-hl-inline">https://example.com</code> and our <code class="one-hl one-hl-inline">sitemap.txt</code> file
|
||||
is at the root of it, we can add the following <code class="one-hl one-hl-inline">robots.txt</code> file in the
|
||||
<code class="one-hl one-hl-inline">assets</code> directory (<code class="one-hl one-hl-inline">./assets/robots.txt</code>):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">User-Agent: *
|
||||
Allow: /
|
||||
Sitemap: https://domain.com/sitemap.txt</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h4 id="one-79c7819a9f">sitemap.txt</h4><div><p>Now in <code class="one-hl one-hl-inline">onerc.el</code> file:
|
||||
</p>
|
||||
|
||||
<ol><li><p>we set our domain with protocol in the variable <code class="one-hl one-hl-inline">domain</code>,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>then we define <code class="one-hl one-hl-inline">make-sitemap</code> function which will create the file
|
||||
<code class="one-hl one-hl-inline">sitemap.txt</code> in the <code class="one-hl one-hl-inline">public</code> directory (<code class="one-hl one-hl-inline">./public/sitemap.txt</code>) each
|
||||
time be build our website,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>Finally, to tell <code class="one-hl one-hl-inline">one.el</code> to actually create <code class="one-hl one-hl-inline">sitemap.txt</code> file using
|
||||
<code class="one-hl one-hl-inline">make-sitemap</code> function each time be build our website, we add it
|
||||
to <code class="one-hl one-hl-inline">one-hook</code>:
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">defvar</span> <span class="one-hl-variable-name">domain</span> <span class="one-hl-string">"https://example.com"</span>
|
||||
<span class="one-hl-doc">"Domain with protocol to be used to produce sitemap file.
|
||||
|
||||
See `</span><span class="one-hl-doc"><span class="one-hl-constant">make-sitemap</span></span><span class="one-hl-doc">'."</span>)
|
||||
|
||||
(<span class="one-hl-keyword">defun</span> <span class="one-hl-function-name">make-sitemap</span> (pages tree global)
|
||||
<span class="one-hl-doc">"Produce file ./public/sitemap.txt
|
||||
|
||||
Global variable `</span><span class="one-hl-doc"><span class="one-hl-constant">domain</span></span><span class="one-hl-doc">' is used as domain with protocol.
|
||||
This function is meant to be added to `</span><span class="one-hl-doc"><span class="one-hl-constant">one-hook</span></span><span class="one-hl-doc">'."</span>
|
||||
(<span class="one-hl-keyword">with-temp-file</span> <span class="one-hl-string">"./public/sitemap.txt"</span>
|
||||
(insert
|
||||
(mapconcat 'identity
|
||||
(mapcar
|
||||
(<span class="one-hl-keyword">lambda</span> (page)
|
||||
(<span class="one-hl-keyword">let*</span> ((path (plist-get page <span class="one-hl-ta-colon-keyword">:one-path</span>))
|
||||
(link (concat domain path)))
|
||||
link))
|
||||
pages)
|
||||
<span class="one-hl-string">"\n"</span>))))
|
||||
|
||||
(add-hook 'one-hook 'make-sitemap)</code></pre>
|
||||
|
||||
<p>Thanks <a href="https://github.com/tanrax">@tanrax</a> for the code snippet (see <a href="https://github.com/tonyaldon/one.el/issues/6">issue #6</a>).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-aea745fd2f">Async commands</h2><div><p>The function <code class="one-hl one-hl-inline">one-render-pages-async</code> and <code class="one-hl one-hl-inline">one-build-async</code> spawn an
|
||||
<code class="one-hl one-hl-inline">emacs</code> subprocess in order to build html pages asynchronously. The
|
||||
arguments passed to <code class="one-hl one-hl-inline">emacs</code> depends on <code class="one-hl one-hl-inline">one-emacs-cmd-line-args-async</code> value.
|
||||
</p>
|
||||
|
||||
<p>By default, when <code class="one-hl one-hl-inline">one-emacs-cmd-line-args-async</code> is <code class="one-hl one-hl-inline">nil</code>, we run <code class="one-hl one-hl-inline">emacs</code>
|
||||
in "batch mode", we load the user's initialization file and we
|
||||
evaluate a specific sexp that builds html pages. Specifically, we
|
||||
pass the following <code class="one-hl one-hl-inline">command</code> (<code class="one-hl one-hl-inline">emacs</code> file name followed by command line
|
||||
arguments) to <code class="one-hl one-hl-inline">make-process</code> function like this:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">let*</span> ((emacs (file-truename
|
||||
(expand-file-name invocation-name invocation-directory)))
|
||||
(command `(,emacs <span class="one-hl-string">"--batch"</span>
|
||||
<span class="one-hl-string">"-l"</span> ,user-init-file
|
||||
<span class="one-hl-string">"--eval"</span> ,sexp))
|
||||
(sexp ...))
|
||||
(make-process
|
||||
<span class="one-hl-ta-colon-keyword">:name</span> ...
|
||||
<span class="one-hl-ta-colon-keyword">:buffer</span> ...
|
||||
<span class="one-hl-ta-colon-keyword">:command</span> command))</code></pre>
|
||||
|
||||
<p>If <code class="one-hl one-hl-inline">one-emacs-cmd-line-args-async</code> is non-nil, we no longer load the user's
|
||||
initialization file and replace <code class="one-hl one-hl-inline">"-l" ,user-init-file</code> in <code class="one-hl one-hl-inline">command</code> above
|
||||
by the elements of <code class="one-hl one-hl-inline">one-emacs-cmd-line-args-async</code>. For instance, if
|
||||
<code class="one-hl one-hl-inline">one-emacs-cmd-line-args-async</code> is equal to
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">'(<span class="one-hl-string">"-l"</span> <span class="one-hl-string">"/path/to/some-elisp-file.el"</span>)</code></pre>
|
||||
|
||||
<p>then <code class="one-hl one-hl-inline">command</code> becomes
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">let*</span> (...
|
||||
(command `(,emacs <span class="one-hl-string">"--batch"</span>
|
||||
<span class="one-hl-string">"-l"</span> <span class="one-hl-string">"/path/to/some-elisp-file.el"</span>
|
||||
<span class="one-hl-string">"--eval"</span> ,sexp))
|
||||
...)
|
||||
...)</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="extend-one-ox-org-backend">Extend one-ox org backend</h2><div><p>When we use the default render functions, the org content of the
|
||||
webpages is exported using <a href="/docs/one-ox/">one-ox</a> org backend like this
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(org-export-data-with-backend
|
||||
(org-element-contents page-tree)
|
||||
'one-ox nil)</code></pre>
|
||||
|
||||
<p>where <code class="one-hl one-hl-inline">page-tree</code> is the parsed tree of the headline containing the page
|
||||
being rendered (see <a href="/docs/one-default-render-function/">one-default render function</a>).
|
||||
</p>
|
||||
|
||||
<p>While <code class="one-hl one-hl-inline">one-ox</code> exports enough org elements for my use cases (see <a href="/#why">Why
|
||||
one.el?</a>) this might not be the case for you.
|
||||
</p>
|
||||
|
||||
<p>I think this is not a big problem because we can extend <code class="one-hl one-hl-inline">one-ox</code>
|
||||
(precisely we can derive a new org backend from <code class="one-hl one-hl-inline">one-ox</code> org backend)
|
||||
with other transcoder functions for the org elements that miss
|
||||
transcoder functions.
|
||||
</p>
|
||||
|
||||
<p>Let's see how we can do that with an example.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-b24de69c14">Extend one-ox with horizontal-rule org elements</h3><div><p>Lines consisting of only dashes (at least 5) are parsed by the org
|
||||
parser as <code class="one-hl one-hl-inline">horizontal-rule</code> org elements. <code class="one-hl one-hl-inline">one-ox</code> doesn't provide a
|
||||
transcoder function for <code class="one-hl one-hl-inline">horizontal-rule</code> so we can't use it directly if
|
||||
we want to have them exported as <code class="one-hl one-hl-inline"><hr></code> tags in our website.
|
||||
</p>
|
||||
|
||||
<p>In that section we see how to derived an org backend <code class="one-hl one-hl-inline">one-ox-with-hr</code>
|
||||
from <code class="one-hl one-hl-inline">one-ox</code> org backend that exports <code class="one-hl one-hl-inline">horizontal-rule</code> org elements
|
||||
with <code class="one-hl one-hl-inline"><hr></code> tags.
|
||||
</p>
|
||||
|
||||
<p>To do that we define a transcoder function <code class="one-hl one-hl-inline">my-horizontal-rule</code> which
|
||||
takes 3 arguments (not used) and return the string <code class="one-hl one-hl-inline">"<hr>"</code>:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">defun</span> <span class="one-hl-function-name">my-horizontal-rule</span> (_ _ _) <span class="one-hl-doc">"<hr>"</span>)</code></pre>
|
||||
|
||||
<p>Then we use that function in the <code class="one-hl one-hl-inline">:translate-alist</code> alist in the body of
|
||||
the function <code class="one-hl one-hl-inline">org-export-define-derived-backend</code> to define <code class="one-hl one-hl-inline">one-ox-with-hr</code>
|
||||
org backend:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(org-export-define-derived-backend 'one-ox-with-hr 'one-ox
|
||||
<span class="one-hl-ta-colon-keyword">:translate-alist</span>
|
||||
'((horizontal-rule . my-horizontal-rule)))</code></pre>
|
||||
|
||||
<p>Then we can export the org content of the webpages (including the
|
||||
<code class="one-hl one-hl-inline">horizontal-rule</code>) using <code class="one-hl one-hl-inline">one-ox-with-hr</code> org backend like this
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(org-export-data-with-backend
|
||||
(org-element-contents page-tree)
|
||||
'one-ox-with-hr nil)</code></pre>
|
||||
|
||||
<p>where <code class="one-hl one-hl-inline">page-tree</code> is the parsed tree of the headline containing the page
|
||||
being rendered.
|
||||
</p>
|
||||
|
||||
<p>Now that we saw how to derive <code class="one-hl one-hl-inline">one-ox-with-hr</code> org backend and use it,
|
||||
let's build a website with only a home page with two <code class="one-hl one-hl-inline">horizontal-rule</code>.
|
||||
</p>
|
||||
|
||||
<p>In an empty directory let's add the following files:
|
||||
</p>
|
||||
|
||||
<ul><li><p><code class="one-hl one-hl-inline">one.org</code>:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-level-1">* Home page</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">my-render-function</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
|
||||
foo
|
||||
|
||||
-----
|
||||
|
||||
bar
|
||||
|
||||
-----
|
||||
|
||||
baz</code></pre>
|
||||
</li>
|
||||
|
||||
<li><p><code class="one-hl one-hl-inline">onerc.el</code>:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">defun</span> <span class="one-hl-function-name">my-horizontal-rule</span> (_ _ _) <span class="one-hl-doc">"<hr>"</span>)
|
||||
|
||||
(org-export-define-derived-backend 'one-ox-with-hr 'one
|
||||
<span class="one-hl-ta-colon-keyword">:translate-alist</span>
|
||||
'((horizontal-rule . my-horizontal-rule)))
|
||||
|
||||
(<span class="one-hl-keyword">defun</span> <span class="one-hl-function-name">my-render-function</span> (page-tree pages _global)
|
||||
<span class="one-hl-doc">""</span>
|
||||
(<span class="one-hl-keyword">let*</span> ((title (org-element-property <span class="one-hl-ta-colon-keyword">:raw-value</span> page-tree))
|
||||
(content (org-export-data-with-backend
|
||||
(org-element-contents page-tree)
|
||||
'one-ox-with-hr
|
||||
nil)))
|
||||
(jack-html
|
||||
<span class="one-hl-string">"<!DOCTYPE html>"</span>
|
||||
`(<span class="one-hl-ta-colon-keyword">:html</span>
|
||||
(<span class="one-hl-ta-colon-keyword">:head</span> (<span class="one-hl-ta-colon-keyword">:title</span> ,title))
|
||||
(<span class="one-hl-ta-colon-keyword">:body</span>
|
||||
(<span class="one-hl-ta-colon-keyword">:h1</span> ,title)
|
||||
,content)))))</code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Now while visiting <code class="one-hl one-hl-inline">one.org</code> file we call <code class="one-hl one-hl-inline">one-build</code> to build our website
|
||||
with <code class="one-hl one-hl-inline"><hr></code> tags.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/one-default-render-function/">PREV</a><a href="/docs/one-ox-links/">RANDOM</a><a href="/docs/one-ox/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
417
one.el/docs/public/docs/one-default-render-function/index.html
Normal file
417
one.el/docs/public/docs/one-default-render-function/index.html
Normal file
@@ -0,0 +1,417 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one-default render function</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>one-default render function</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#one-98bda5c128">The org document</a></li>
|
||||
<li><a href="#one-e0c89f6e70">Build the website</a></li>
|
||||
<li><a href="#one-4096561a3f">Home</a></li>
|
||||
<li><a href="#one-a951b43a69">Page 1</a></li>
|
||||
<li><a href="#one-db11f70f7d">Page 2</a></li>
|
||||
<li><a href="#one-320b450199">How was "Page 1" built?</a></li>
|
||||
</ul>
|
||||
</div></div></div><div><p>In <a href="/docs/how-does-one-el-work/">How does one.el work?</a> page we saw that render functions are at
|
||||
the heart of <code class="one-hl one-hl-inline">one.el</code> mechanism. They determine how pages are
|
||||
rendered.
|
||||
</p>
|
||||
|
||||
<p>We saw that
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">defun</span> <span class="one-hl-function-name">hello-world</span> (page-tree pages global)
|
||||
<span class="one-hl-doc">"<h1>Hello world!</h1>"</span>)</code></pre>
|
||||
|
||||
<p>defines a valid render function that can be used to render pages of a
|
||||
<code class="one-hl one-hl-inline">one.el</code> website by setting <code class="one-hl one-hl-inline">ONE</code> org property to <code class="one-hl one-hl-inline">hello-world</code> like this
|
||||
for instance:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-level-1">* The home page</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">hello-world</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
<span class="one-hl-org-level-1">* Blog post 1</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">hello-world</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span><span class="one-hl-org-property-value"><span class="one-hl-italic">blog/page-1</span></span><span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span></code></pre>
|
||||
|
||||
<p><code class="one-hl one-hl-inline">one.el</code> comes with several default render functions that can be used
|
||||
instead of the dummy <code class="one-hl one-hl-inline">hello-world</code> function:
|
||||
</p>
|
||||
|
||||
<ul><li><p><code class="one-hl one-hl-inline">one-default-home</code>: org content,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">one-default-home-list-pages</code>: org content followed by the list in
|
||||
reverse order of the pages of the website,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">one-default</code>: org content with navigation buttons at the bottom to go
|
||||
to the previous page, the next page or a random one,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">one-default-with-toc</code>: same as <code class="one-hl one-hl-inline">one-default</code> but with a table of
|
||||
content at the top of the page and
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">one-default-with-sidebar</code>: same as <code class="one-hl one-hl-inline">one-default</code> but with a sidebar
|
||||
listing all the pages in the website,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">one-default-doc</code>: same as <code class="one-hl one-hl-inline">one-default-with-sidebar</code> but with a table
|
||||
of content at the top of the page.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Those default render functions use <a href="/docs/one-ox/">one-ox</a> custom org export backend and
|
||||
<code class="one-hl one-hl-inline">one-default-css</code> custom CSS style sheet.
|
||||
</p>
|
||||
|
||||
<p>If we want to start a new project using these defaults, we can use
|
||||
<code class="one-hl one-hl-inline">one-default-new-project</code> command (see <a href="/docs/getting-started/">Getting started</a>).
|
||||
</p>
|
||||
|
||||
<p>If you plan to write your own render functions you may find the
|
||||
following sections interesting.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-98bda5c128">The org document</h3><div><p>Let's consider the following org document in a file named <code class="one-hl one-hl-inline">one.org</code> for
|
||||
instance:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-level-1">* Home</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">one-default-home</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
<span class="one-hl-org-level-1">* Page 1</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">one-default</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span><span class="one-hl-org-property-value"><span class="one-hl-italic">blog/page-1</span></span><span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
<span class="one-hl-org-level-2">** Headline foo 1</span>
|
||||
|
||||
<span class="one-hl-org-link"><a href="#/blog/page-2/">[[#/blog/page-2/][Link to Page 2]]</a></span>
|
||||
|
||||
<span class="one-hl-org-level-2">** Headline foo 2</span>
|
||||
<span class="one-hl-org-level-3">*** Headline bar</span>
|
||||
|
||||
Some content.
|
||||
|
||||
<span class="one-hl-org-level-3">*** Headline baz</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/blog/page-1/#baz</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
|
||||
<span class="one-hl-org-block-begin-line">#+BEGIN_SRC emacs-lisp
|
||||
</span><span class="one-hl-org-block">(message </span><span class="one-hl-org-block"><span class="one-hl-string">"foo bar baz"</span></span><span class="one-hl-org-block">)
|
||||
</span><span class="one-hl-org-block-end-line">#+END_SRC
|
||||
</span>
|
||||
<span class="one-hl-org-level-1">* Page 2</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">one-default</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span><span class="one-hl-org-property-value"><span class="one-hl-italic">blog/page-2</span></span><span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
|
||||
<span class="one-hl-org-link"><a href="#/blog/page-1/#baz">[[#/blog/page-1/#baz][Link to Headline baz in Page 1]]</a></span>
|
||||
</code></pre>
|
||||
|
||||
<p>Let's generate the file <code class="one-hl one-hl-inline">./assets/one.css</code> that contains the content of
|
||||
<code class="one-hl one-hl-inline">one-default-css</code> string by calling <code class="one-hl one-hl-inline">one-default-add-css-file</code> command.
|
||||
</p>
|
||||
|
||||
<p>Our project structure is now:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">.
|
||||
├── assets
|
||||
│ └── one.css
|
||||
└── one.org</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-e0c89f6e70">Build the website</h3><div><p>Now, while vising the file <code class="one-hl one-hl-inline">one.org</code> we call <code class="one-hl one-hl-inline">one-build</code> which builds
|
||||
"Home", "Page 1" and "Page 2" pages under the directory <code class="one-hl one-hl-inline">./public/</code> such
|
||||
that our project tree is now:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">.
|
||||
├── assets
|
||||
│ └── one.css
|
||||
├── one.org
|
||||
└── public
|
||||
├── blog
|
||||
│ ├── page-1
|
||||
│ │ └── index.html
|
||||
│ └── page-2
|
||||
│ └── index.html
|
||||
├── index.html
|
||||
└── one.css</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-4096561a3f">Home</h3><div><p>The page "Home" has been generated:
|
||||
</p>
|
||||
|
||||
<ul><li><p>in the file <code class="one-hl one-hl-inline">./public/index.html</code> respecting the path information <code class="one-hl one-hl-inline">/</code> in
|
||||
<code class="one-hl one-hl-inline">CUSTOM_ID</code> org property and
|
||||
</p>
|
||||
</li>
|
||||
<li><p>its HTML content has been created using <code class="one-hl one-hl-inline">one-default-home</code> render
|
||||
function specified in <code class="one-hl one-hl-inline">ONE</code> org property.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p><code class="one-hl one-hl-inline">./public/index.html</code> (pretty printed for the demonstration):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-keyword">!DOCTYPE</span> html>
|
||||
<<span class="one-hl-function-name">html</span>>
|
||||
<<span class="one-hl-function-name">head</span>>
|
||||
<<span class="one-hl-function-name">meta</span> <span class="one-hl-variable-name">name</span>=<span class="one-hl-string">"viewport"</span> <span class="one-hl-variable-name">content</span>=<span class="one-hl-string">"width=device-width,initial-scale=1"</span> />
|
||||
<<span class="one-hl-function-name">link</span> <span class="one-hl-variable-name">rel</span>=<span class="one-hl-string">"stylesheet"</span> <span class="one-hl-variable-name">type</span>=<span class="one-hl-string">"text/css"</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/one.css"</span> />
|
||||
<<span class="one-hl-function-name">title</span>><span class="one-hl-underline"><span class="one-hl-bold">Home</span></span></<span class="one-hl-function-name">title</span>>
|
||||
</<span class="one-hl-function-name">head</span>>
|
||||
<<span class="one-hl-function-name">body</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"header"</span>>Home</<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"content"</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">id</span>=<span class="one-hl-string">"home"</span>><<span class="one-hl-function-name">div</span>></<span class="one-hl-function-name">div</span>></<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">body</span>>
|
||||
</<span class="one-hl-function-name">html</span>></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-a951b43a69">Page 1</h3><div><p>The page "Page 1" has been generated:
|
||||
</p>
|
||||
|
||||
<ul><li><p>in the file <code class="one-hl one-hl-inline">./public/blog/page-1/index.html</code> respecting the path
|
||||
information <code class="one-hl one-hl-inline">/blog/page-1/</code> in <code class="one-hl one-hl-inline">CUSTOM_ID</code> org property and
|
||||
</p>
|
||||
</li>
|
||||
<li><p>its HTML content has been created using <code class="one-hl one-hl-inline">one-default</code> render function
|
||||
specified in <code class="one-hl one-hl-inline">ONE</code> org property.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p><code class="one-hl one-hl-inline">./public/blog/page-1/index.html</code> (pretty printed for the demonstration):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-keyword">!DOCTYPE</span> html>
|
||||
<<span class="one-hl-function-name">html</span>>
|
||||
<<span class="one-hl-function-name">head</span>>
|
||||
<<span class="one-hl-function-name">meta</span> <span class="one-hl-variable-name">name</span>=<span class="one-hl-string">"viewport"</span> <span class="one-hl-variable-name">content</span>=<span class="one-hl-string">"width=device-width,initial-scale=1"</span> />
|
||||
<<span class="one-hl-function-name">link</span> <span class="one-hl-variable-name">rel</span>=<span class="one-hl-string">"stylesheet"</span> <span class="one-hl-variable-name">type</span>=<span class="one-hl-string">"text/css"</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/one.css"</span> />
|
||||
<<span class="one-hl-function-name">title</span>><span class="one-hl-underline"><span class="one-hl-bold">Page 1</span></span></<span class="one-hl-function-name">title</span>>
|
||||
</<span class="one-hl-function-name">head</span>>
|
||||
<<span class="one-hl-function-name">body</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"header"</span>><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/"</span>>Home</<span class="one-hl-function-name">a</span>></<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"content"</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"title"</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"title"</span>><<span class="one-hl-function-name">h1</span>><span class="one-hl-underline"><span class="one-hl-bold">Page 1</span></span></<span class="one-hl-function-name">h1</span>></<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">div</span>></<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">h2</span> <span class="one-hl-variable-name">id</span>=<span class="one-hl-string">"one-df8f0f16cc"</span>><span class="one-hl-underline"><span class="one-hl-bold-italic">Headline foo 1</span></span></<span class="one-hl-function-name">h2</span>>
|
||||
<<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">p</span>><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/blog/page-2/"</span>>Link to Page 2</<span class="one-hl-function-name">a</span>></<span class="one-hl-function-name">p</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
|
||||
<<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">h2</span> <span class="one-hl-variable-name">id</span>=<span class="one-hl-string">"one-9c2f3b8536"</span>><span class="one-hl-underline"><span class="one-hl-bold-italic">Headline foo 2</span></span></<span class="one-hl-function-name">h2</span>>
|
||||
<<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">h3</span> <span class="one-hl-variable-name">id</span>=<span class="one-hl-string">"one-fe469dd578"</span>><span class="one-hl-underline"><span class="one-hl-italic">Headline bar</span></span></<span class="one-hl-function-name">h3</span>>
|
||||
<<span class="one-hl-function-name">div</span>><<span class="one-hl-function-name">p</span>>Some content.</<span class="one-hl-function-name">p</span>></<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
|
||||
<<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">h3</span> <span class="one-hl-variable-name">id</span>=<span class="one-hl-string">"baz"</span>><span class="one-hl-underline"><span class="one-hl-italic">Headline baz</span></span></<span class="one-hl-function-name">h3</span>>
|
||||
<<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>>(message <<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-string"</span>>"foo bar baz"</<span class="one-hl-function-name">span</span>>)</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"nav"</span>>
|
||||
<<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/"</span>>PREV</<span class="one-hl-function-name">a</span>><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/"</span>>RANDOM</<span class="one-hl-function-name">a</span>
|
||||
><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/blog/page-2/"</span>>NEXT</<span class="one-hl-function-name">a</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">body</span>>
|
||||
</<span class="one-hl-function-name">html</span>></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-db11f70f7d">Page 2</h3><div><p>The page "Page 2" has been generated:
|
||||
</p>
|
||||
|
||||
<ul><li><p>in the file <code class="one-hl one-hl-inline">./public/blog/page-2/index.html</code> respecting the path
|
||||
information <code class="one-hl one-hl-inline">/blog/page-2/</code> in <code class="one-hl one-hl-inline">CUSTOM_ID</code> org property and
|
||||
</p>
|
||||
</li>
|
||||
<li><p>its HTML content has been created using <code class="one-hl one-hl-inline">one-default</code> render function
|
||||
specified in <code class="one-hl one-hl-inline">ONE</code> org property.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p><code class="one-hl one-hl-inline">./public/blog/page-2/index.html</code> (pretty printed for the demonstration):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-keyword">!DOCTYPE</span> html>
|
||||
<<span class="one-hl-function-name">html</span>>
|
||||
<<span class="one-hl-function-name">head</span>>
|
||||
<<span class="one-hl-function-name">meta</span> <span class="one-hl-variable-name">name</span>=<span class="one-hl-string">"viewport"</span> <span class="one-hl-variable-name">content</span>=<span class="one-hl-string">"width=device-width,initial-scale=1"</span> />
|
||||
<<span class="one-hl-function-name">link</span> <span class="one-hl-variable-name">rel</span>=<span class="one-hl-string">"stylesheet"</span> <span class="one-hl-variable-name">type</span>=<span class="one-hl-string">"text/css"</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/one.css"</span> />
|
||||
<<span class="one-hl-function-name">title</span>><span class="one-hl-underline"><span class="one-hl-bold">Page 2</span></span></<span class="one-hl-function-name">title</span>>
|
||||
</<span class="one-hl-function-name">head</span>>
|
||||
<<span class="one-hl-function-name">body</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"header"</span>><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/"</span>>Home</<span class="one-hl-function-name">a</span>></<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"content"</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"title"</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"title"</span>><<span class="one-hl-function-name">h1</span>><span class="one-hl-underline"><span class="one-hl-bold">Page 2</span></span></<span class="one-hl-function-name">h1</span>></<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">p</span>><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/blog/page-1/#baz"</span>>Link to Headline baz in Page 1</<span class="one-hl-function-name">a</span>></<span class="one-hl-function-name">p</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
<<span class="one-hl-function-name">div</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"nav"</span>>
|
||||
<<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/blog/page-1/"</span>>PREV</<span class="one-hl-function-name">a</span>><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/"</span>>RANDOM</<span class="one-hl-function-name">a</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">div</span>>
|
||||
</<span class="one-hl-function-name">body</span>>
|
||||
</<span class="one-hl-function-name">html</span>></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-320b450199">How was "Page 1" built?</h3><div><p>When we called <code class="one-hl one-hl-inline">one-build</code> in <code class="one-hl one-hl-inline">one.org</code> buffer, the whole buffer was
|
||||
parsed with the function <code class="one-hl one-hl-inline">one-parse-buffer</code> and a list of pages was
|
||||
built from that parsed tree and looked like this:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">((<span class="one-hl-ta-colon-keyword">:one-title</span> <span class="one-hl-string">"Home"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-path</span> <span class="one-hl-string">"/"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-render-page-function</span> one-default-home
|
||||
<span class="one-hl-ta-colon-keyword">:one-page-tree</span> (headline (<span class="one-hl-ta-colon-keyword">:raw-value</span> <span class="one-hl-string">"Home"</span> ...) ...))
|
||||
(<span class="one-hl-ta-colon-keyword">:one-title</span> <span class="one-hl-string">"Page 1"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-path</span> <span class="one-hl-string">"/blog/page-1/"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-render-page-function</span> one-default
|
||||
<span class="one-hl-ta-colon-keyword">:one-page-tree</span> (headline (<span class="one-hl-ta-colon-keyword">:raw-value</span> <span class="one-hl-string">"Page 1"</span> ...) ...))
|
||||
(<span class="one-hl-ta-colon-keyword">:one-title</span> <span class="one-hl-string">"Page 2"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-path</span> <span class="one-hl-string">"/blog/page-2/"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-render-page-function</span> one-default
|
||||
<span class="one-hl-ta-colon-keyword">:one-page-tree</span> (headline (<span class="one-hl-ta-colon-keyword">:raw-value</span> <span class="one-hl-string">"Page 2"</span> ...) ...)))</code></pre>
|
||||
|
||||
<p>Let's call <code class="one-hl one-hl-inline">pages</code> that list of pages.
|
||||
</p>
|
||||
|
||||
<p>Then for each <code class="one-hl one-hl-inline">page</code> in <code class="one-hl one-hl-inline">pages</code> the function <code class="one-hl one-hl-inline">one-render-page</code> was called
|
||||
with <code class="one-hl one-hl-inline">page</code>, <code class="one-hl one-hl-inline">pages</code> and <code class="one-hl one-hl-inline">global</code> (see <code class="one-hl one-hl-inline">one-add-to-global</code> variable) as
|
||||
arguments.
|
||||
</p>
|
||||
|
||||
<p>Finally, in <code class="one-hl one-hl-inline">one-render-page</code> the function <code class="one-hl one-hl-inline">one-default</code> or
|
||||
<code class="one-hl one-hl-inline">one-default-home</code> was called with the arguments <code class="one-hl one-hl-inline">page-tree</code>, <code class="one-hl one-hl-inline">pages</code> and
|
||||
<code class="one-hl one-hl-inline">global</code> to create the HTML content of each page whom path under the
|
||||
directory <code class="one-hl one-hl-inline">./public/</code> was determined by the value of <code class="one-hl one-hl-inline">:one-path</code> property
|
||||
in <code class="one-hl one-hl-inline">page</code> and <code class="one-hl one-hl-inline">page-tree</code> was the value of <code class="one-hl one-hl-inline">:one-page-tree</code> property in
|
||||
<code class="one-hl one-hl-inline">page</code>.
|
||||
</p>
|
||||
|
||||
<p>Focusing on "Page 1", the function <code class="one-hl one-hl-inline">one-default</code> was called with the
|
||||
arguments <code class="one-hl one-hl-inline">page-tree</code>, <code class="one-hl one-hl-inline">page</code> and <code class="one-hl one-hl-inline">global</code> with <code class="one-hl one-hl-inline">page-tree</code> being the
|
||||
following parsed tree of the headline defining "Page 1":
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(headline
|
||||
(<span class="one-hl-ta-colon-keyword">:raw-value</span> <span class="one-hl-string">"Page 1"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:CUSTOM_ID</span> <span class="one-hl-string">"/blog/page-1/"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:ONE</span> <span class="one-hl-string">"one-default"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:parent</span> (org-data ...)
|
||||
<span class="one-hl-ta-colon-keyword">:one-internal-id</span> <span class="one-hl-string">"one-9c81c230b6"</span>
|
||||
...)
|
||||
(section (...) (property-drawer ...))
|
||||
(headline
|
||||
(<span class="one-hl-ta-colon-keyword">:raw-value</span> <span class="one-hl-string">"Headline foo 1"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-internal-id</span> <span class="one-hl-string">"one-4df8d962d9"</span>
|
||||
...)
|
||||
(section (...) (paragraph ...)))
|
||||
(headline
|
||||
(<span class="one-hl-ta-colon-keyword">:raw-value</span> <span class="one-hl-string">"Headline foo 2"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-internal-id</span> <span class="one-hl-string">"one-9d89da8271"</span>
|
||||
...)
|
||||
(headline
|
||||
(<span class="one-hl-ta-colon-keyword">:raw-value</span> <span class="one-hl-string">"Headline bar"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-internal-id</span> <span class="one-hl-string">"one-95fa001487"</span>
|
||||
...)
|
||||
(section
|
||||
(...)
|
||||
(paragraph (...) #(<span class="one-hl-string">"Some content. "</span> 0 14 (<span class="one-hl-ta-colon-keyword">:parent</span> #4)))))
|
||||
(headline
|
||||
(<span class="one-hl-ta-colon-keyword">:raw-value</span> <span class="one-hl-string">"Headline baz"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:CUSTOM_ID</span> <span class="one-hl-string">"/blog/page-1/#baz"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:one-internal-id</span> <span class="one-hl-string">"baz"</span>
|
||||
...)
|
||||
(section
|
||||
(...)
|
||||
(property-drawer ...)
|
||||
(src-block
|
||||
(<span class="one-hl-ta-colon-keyword">:language</span> <span class="one-hl-string">"emacs-lisp"</span>
|
||||
<span class="one-hl-ta-colon-keyword">:value</span> <span class="one-hl-string">"(message \"foo bar baz\")"</span>
|
||||
...))))))</code></pre>
|
||||
|
||||
<p>In <code class="one-hl one-hl-inline">one-default</code> the org content of "Page 1" was exported into a HTML
|
||||
string using <code class="one-hl one-hl-inline">org-export-data-with-backend</code> and <a href="/docs/one-ox/">one-ox</a> custom org export
|
||||
backend. Then this HTML string was used in a data structure
|
||||
representing the HTML page. Finally, <code class="one-hl one-hl-inline">jack-html</code> (see <a href="https://jack.tonyaldon.com/">jack</a>) transformed
|
||||
that data structure into a HTML string which was written on the file
|
||||
<code class="one-hl one-hl-inline">./public/blog/page-1/index.html</code>:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">defun</span> <span class="one-hl-function-name">one-default</span> (page-tree pages _global)
|
||||
<span class="one-hl-doc">"Default render function.
|
||||
|
||||
See `</span><span class="one-hl-doc"><span class="one-hl-constant">one-is-page</span></span><span class="one-hl-doc">', `</span><span class="one-hl-doc"><span class="one-hl-constant">one-render-pages</span></span><span class="one-hl-doc">' and `</span><span class="one-hl-doc"><span class="one-hl-constant">one-default-css</span></span><span class="one-hl-doc">'."</span>
|
||||
(<span class="one-hl-keyword">let*</span> ((title (org-element-property <span class="one-hl-ta-colon-keyword">:raw-value</span> page-tree))
|
||||
(path (org-element-property <span class="one-hl-ta-colon-keyword">:CUSTOM_ID</span> page-tree))
|
||||
(content (org-export-data-with-backend
|
||||
(org-element-contents page-tree)
|
||||
'one-ox nil))
|
||||
(website-name (one-default-website-name pages))
|
||||
(nav (one-default-nav path pages)))
|
||||
(jack-html
|
||||
<span class="one-hl-string">"<!DOCTYPE html>"</span>
|
||||
`(<span class="one-hl-ta-colon-keyword">:html</span>
|
||||
(<span class="one-hl-ta-colon-keyword">:head</span>
|
||||
(<span class="one-hl-ta-colon-keyword">:meta</span> (@ <span class="one-hl-ta-colon-keyword">:name</span> <span class="one-hl-string">"viewport"</span> <span class="one-hl-ta-colon-keyword">:content</span> <span class="one-hl-string">"width=device-width,initial-scale=1"</span>))
|
||||
(<span class="one-hl-ta-colon-keyword">:link</span> (@ <span class="one-hl-ta-colon-keyword">:rel</span> <span class="one-hl-string">"stylesheet"</span> <span class="one-hl-ta-colon-keyword">:type</span> <span class="one-hl-string">"text/css"</span> <span class="one-hl-ta-colon-keyword">:href</span> <span class="one-hl-string">"/one.css"</span>))
|
||||
(<span class="one-hl-ta-colon-keyword">:title</span> ,title))
|
||||
(<span class="one-hl-ta-colon-keyword">:body</span>
|
||||
(<span class="one-hl-ta-colon-keyword">:div.header</span> (<span class="one-hl-ta-colon-keyword">:a</span> (@ <span class="one-hl-ta-colon-keyword">:href</span> <span class="one-hl-string">"/"</span>) ,website-name))
|
||||
(<span class="one-hl-ta-colon-keyword">:div.content</span>
|
||||
(<span class="one-hl-ta-colon-keyword">:div.title</span>
|
||||
,(<span class="one-hl-keyword">if</span> (not (string= path <span class="one-hl-string">"/"</span>))
|
||||
`(<span class="one-hl-ta-colon-keyword">:div.title</span> (<span class="one-hl-ta-colon-keyword">:h1</span> ,title))
|
||||
'(<span class="one-hl-ta-colon-keyword">:div.title-empty</span>)))
|
||||
,content
|
||||
,nav))))))</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/how-does-one-el-work/">PREV</a><a href="/docs/one-ox-quote-block/">RANDOM</a><a href="/docs/miscellaneous/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
@@ -0,0 +1,160 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one-ox | fixed-width and example-block</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>one-ox | fixed-width and example-block</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#one-bd8a958e87">Description</a></li>
|
||||
<li><a href="#one-ba25cabf48">Example</a></li>
|
||||
</ul>
|
||||
</div></div></div><div></div>
|
||||
<div><h2 id="one-bd8a958e87">Description</h2><div><p>A line starting with a colon <code class="one-hl one-hl-inline">:</code> followed by a space defines a
|
||||
<code class="one-hl one-hl-inline">fixed-width</code> element. A <code class="one-hl one-hl-inline">fixed-width</code> element can span several
|
||||
lines.
|
||||
</p>
|
||||
|
||||
<p>Blocks defined with <code class="one-hl one-hl-inline">#+BEGIN_EXAMPLE ... #+END_EXAMPLE</code> pattern are
|
||||
<code class="one-hl one-hl-inline">example-block</code> elements.
|
||||
</p>
|
||||
|
||||
<p>Both <code class="one-hl one-hl-inline">fixed-width</code> and <code class="one-hl one-hl-inline">example-block</code> blocks are treated as <a href="/docs/one-ox-src-block/">src-block</a> in
|
||||
<code class="one-hl one-hl-inline">text-mode</code>. So:
|
||||
</p>
|
||||
|
||||
<ol><li><p>they are highlighted as <code class="one-hl one-hl-inline">text-mode</code> would do,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>they are exported in <code class="one-hl one-hl-inline"><pre><code>...</code></pre></code> components
|
||||
(indentation and newlines are respected) and
|
||||
</p>
|
||||
</li>
|
||||
<li><p>the CSS classes used depend on the block's type:
|
||||
</p>
|
||||
|
||||
<ul><li><p>normal blocks use <code class="one-hl one-hl-inline">one-hl one-hl-block</code> CSS classes and
|
||||
</p>
|
||||
</li>
|
||||
<li><p>result blocks use <code class="one-hl one-hl-inline">one-hl one-hl-results</code> CSS classes (see <a href="/docs/one-ox-src-block/#org-keywords-results-and-attr_one_results">org
|
||||
keyword RESULTS</a>).
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-ba25cabf48">Example</h2><div><p>The following org snippet
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">Here is a ~<span class="one-hl-org-code">fixed-width</span>~ element (one line):
|
||||
|
||||
<span class="one-hl-org-code">: I'm a fixed-width element
|
||||
</span>
|
||||
~<span class="one-hl-org-code">fixed-width</span>~ elements can also be used within lists:
|
||||
|
||||
- item 1
|
||||
|
||||
<span class="one-hl-org-code">: fixed-width element
|
||||
</span>
|
||||
- item 2
|
||||
|
||||
<span class="one-hl-org-block-begin-line"> #+BEGIN_SRC bash :results output
|
||||
</span><span class="one-hl-org-block"> </span><span class="one-hl-org-block"><span class="one-hl-builtin">printf</span></span><span class="one-hl-org-block"> </span><span class="one-hl-org-block"><span class="one-hl-string">'multiline fixed-width element\nthat is also a result block,\nso has a different style.'</span></span><span class="one-hl-org-block">
|
||||
</span><span class="one-hl-org-block-end-line"> #+END_SRC
|
||||
</span>
|
||||
<span class="one-hl-org-meta-line"> #+RESULTS:</span>
|
||||
<span class="one-hl-org-code">: multiline fixed-width element
|
||||
</span> <span class="one-hl-org-code">: that is also a result block,
|
||||
</span> <span class="one-hl-org-code">: so has a different style.
|
||||
</span>
|
||||
Although I don't often use ~<span class="one-hl-org-code">example-block</span>~ elements, here is one:
|
||||
|
||||
<span class="one-hl-org-block-begin-line">#+BEGIN_EXAMPLE
|
||||
</span><span class="custom">This is
|
||||
an example!
|
||||
</span><span class="one-hl-org-block-end-line">#+END_EXAMPLE</span></code></pre>
|
||||
|
||||
<p>is exported by <code class="one-hl one-hl-inline">one</code> as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">p</span>>Here is a <<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-inline"</span>>fixed-width</<span class="one-hl-function-name">code</span>> element (one line):
|
||||
</<span class="one-hl-function-name">p</span>>
|
||||
|
||||
<<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>>I'm a fixed-width element</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>>
|
||||
|
||||
|
||||
<<span class="one-hl-function-name">p</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-inline"</span>>fixed-width</<span class="one-hl-function-name">code</span>> elements can also be used within lists:
|
||||
</<span class="one-hl-function-name">p</span>>
|
||||
|
||||
<<span class="one-hl-function-name">ul</span>><<span class="one-hl-function-name">li</span>><<span class="one-hl-function-name">p</span>>item 1
|
||||
</<span class="one-hl-function-name">p</span>>
|
||||
|
||||
<<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>>fixed-width element</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
|
||||
<<span class="one-hl-function-name">li</span>><<span class="one-hl-function-name">p</span>>item 2
|
||||
</<span class="one-hl-function-name">p</span>>
|
||||
|
||||
<<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>><<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-builtin"</span>>printf</<span class="one-hl-function-name">span</span>> <<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-string"</span>>'multiline fixed-width element\nthat is also a result block,\nso has a different style.'</<span class="one-hl-function-name">span</span>></<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>>
|
||||
|
||||
<<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-results"</span>>multiline fixed-width element
|
||||
that is also a result block,
|
||||
so has a different style.</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
</<span class="one-hl-function-name">ul</span>>
|
||||
|
||||
<<span class="one-hl-function-name">p</span>>Although I don<span class="one-hl-variable-name">&apos;</span>t often use <<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-inline"</span>>example-block</<span class="one-hl-function-name">code</span>> elements, here is one:
|
||||
</<span class="one-hl-function-name">p</span>>
|
||||
|
||||
<<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>>This is
|
||||
an example!</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>></code></pre>
|
||||
|
||||
<p>and looks like this:
|
||||
</p>
|
||||
|
||||
<p>Here is a <code class="one-hl one-hl-inline">fixed-width</code> element (one line):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">I'm a fixed-width element</code></pre>
|
||||
|
||||
|
||||
<p><code class="one-hl one-hl-inline">fixed-width</code> elements can also be used within lists:
|
||||
</p>
|
||||
|
||||
<ul><li><p>item 1
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">fixed-width element</code></pre>
|
||||
</li>
|
||||
|
||||
<li><p>item 2
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-builtin">printf</span> <span class="one-hl-string">'multiline fixed-width element\nthat is also a result block,\nso has a different style.'</span></code></pre>
|
||||
|
||||
<pre><code class="one-hl one-hl-results">multiline fixed-width element
|
||||
that is also a result block,
|
||||
so has a different style.</code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Although I don't often use <code class="one-hl one-hl-inline">example-block</code> elements, here is one:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">This is
|
||||
an example!</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/one-ox-quote-block/">PREV</a><a href="/docs/how-does-one-el-work/">RANDOM</a><a href="/docs/one-ox-links/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
23
one.el/docs/public/docs/one-ox-headline/index.html
Normal file
23
one.el/docs/public/docs/one-ox-headline/index.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one-ox | headline</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>one-ox | headline</h1></div><div><p>Note that markups and links are not exported if used in headlines, only
|
||||
the raw value string.
|
||||
</p>
|
||||
|
||||
<p>So don't use them in headlines.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/one-ox/">PREV</a><a href="/docs/how-does-one-el-work/">RANDOM</a><a href="/docs/one-ox-src-block/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
256
one.el/docs/public/docs/one-ox-links/index.html
Normal file
256
one.el/docs/public/docs/one-ox-links/index.html
Normal file
@@ -0,0 +1,256 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one-ox | links</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>one-ox | links</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#one-2bea83ecbc">http, https, mailto links</a></li>
|
||||
<li><a href="#one-a551af055">Custom ID links</a>
|
||||
<ul>
|
||||
<li><a href="#one-9caab9873">Example of a link to a page</a></li>
|
||||
<li><a href="#one-6ab746be35">Example of a link to a heading in a page</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#one-c464a1328c">Fuzzy links</a></li>
|
||||
<li><a href="#one-608eaed84f">File links</a>
|
||||
<ul>
|
||||
<li><a href="#one-c03ea6102f">Links to local files in assets and public directories</a></li>
|
||||
<li><a href="#one-eda2a74e6f">Local file links that raise one-link-broken error</a></li>
|
||||
<li><a href="#one-325ea8bc56">Links to images</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div></div></div><div></div>
|
||||
<div><h2 id="one-2bea83ecbc">http, https, mailto links</h2><div><p>Web links (starting by <code class="one-hl one-hl-inline">http</code> or <code class="one-hl one-hl-inline">https</code>) and links to message
|
||||
composition (starting by <code class="one-hl one-hl-inline">mailto</code>) are exported as we expect.
|
||||
</p>
|
||||
|
||||
<p>For instance the following link
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="http://tonyaldon.com">http://tonyaldon.com</a></span></code></pre>
|
||||
|
||||
<p>is exported as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"http://tonyaldon.com"</span>>http://tonyaldon.com</<span class="one-hl-function-name">a</span>></code></pre>
|
||||
|
||||
<p>and rendered like this: <a href="http://tonyaldon.com">http://tonyaldon.com</a>.
|
||||
</p>
|
||||
|
||||
<p>This following link with a description
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="https://tonyaldon.com">[[https://tonyaldon.com][Tony Aldon (https)]]</a></span></code></pre>
|
||||
|
||||
<p>is exported as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"https://tonyaldon.com"</span>>Tony Aldon (https)</<span class="one-hl-function-name">a</span>></code></pre>
|
||||
|
||||
<p>and rendered like this: <a href="https://tonyaldon.com">Tony Aldon (https)</a>.
|
||||
</p>
|
||||
|
||||
<p>This <code class="one-hl one-hl-inline">mailto</code> link
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="mailto:tony@tonyaldon.com">[[mailto:tony@tonyaldon.com][send me an email]]</a></span></code></pre>
|
||||
|
||||
<p>is exported as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"mailto:tony@tonyaldon.com"</span>>send me an email</<span class="one-hl-function-name">a</span>></code></pre>
|
||||
|
||||
<p>and rendered like this: <a href="mailto:tony@tonyaldon.com">send me an email</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-a551af055">Custom ID links</h2><div><p>In <code class="one-hl one-hl-inline">one.el</code>, <code class="one-hl one-hl-inline">CUSTOM_ID</code> org property is used to defined the path of pages
|
||||
or the path to specific heading in pages.
|
||||
</p>
|
||||
|
||||
<p>Considering the following org document
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-level-1">* Home Page</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">one-default-home</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
|
||||
- <span class="one-hl-org-link"><a href="#/blog/page-1/">[[#/blog/page-1/]]</a></span>
|
||||
- <span class="one-hl-org-link"><a href="#/blog/page-1/#headline-1">[[#/blog/page-1/#headline-1]]</a></span>
|
||||
|
||||
<span class="one-hl-org-level-1">* Page 1</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">one-default</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span><span class="one-hl-org-property-value"><span class="one-hl-italic">blog/page-1</span></span><span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
<span class="one-hl-org-level-2">** headline 1 in Page 1</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/blog/page-1/#headline-1</span>
|
||||
<span class="one-hl-org-drawer">:END:</span></code></pre>
|
||||
|
||||
<p>the link <code class="one-hl one-hl-inline">[[#/blog/page-1/]]</code> in "Home Page" targets "Page 1" page
|
||||
and the link <code class="one-hl one-hl-inline">[[#/blog/page-1/#headline-1]]</code> in "Home Page" targets the
|
||||
heading "headline 1 in page Page 1" in the "Page 1" page.
|
||||
</p>
|
||||
|
||||
<p>Those paths define valid web urls starting at the root of the website
|
||||
if we respect the following rules for <code class="one-hl one-hl-inline">CUSTOM_ID</code> values:
|
||||
</p>
|
||||
|
||||
<ol><li><p>we use only url-encoded characters,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>we start them with a <code class="one-hl one-hl-inline">/</code> and end them with <code class="one-hl one-hl-inline">/</code> excepted for the home
|
||||
page which is a single <code class="one-hl one-hl-inline">/</code>,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>we use <code class="one-hl one-hl-inline">#</code> character to start the last part of the path when we are
|
||||
targeting a heading tag with its <code class="one-hl one-hl-inline">id</code> being the last part after the <code class="one-hl one-hl-inline">#</code>
|
||||
character.
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>The benefits of these "rules/conventions" are:
|
||||
</p>
|
||||
|
||||
<ol><li><p>when we export <code class="one-hl one-hl-inline">custom-id</code> links using <code class="one-hl one-hl-inline">one-ox</code> org backend we can
|
||||
leave them as they are and
|
||||
</p>
|
||||
</li>
|
||||
<li><p>the navigation between pages inside emacs using <code class="one-hl one-hl-inline">custom-id</code> links
|
||||
works out-of-the-box.
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-9caab9873">Example of a link to a page</h3><div><p>The following link
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="#/docs/one-ox-plain-list/">[[#/docs/one-ox-plain-list/][one-ox | plain-list]]</a></span></code></pre>
|
||||
|
||||
<p>is exported to this anchor tag that links to the page <code class="one-hl one-hl-inline">/docs/one-ox-plain-list/</code>:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/docs/one-ox-plain-list/"</span>>one-ox | plain-list</<span class="one-hl-function-name">a</span>></code></pre>
|
||||
|
||||
<p>and is rendered like this <a href="/docs/one-ox-plain-list/">one-ox | plain-list</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-6ab746be35">Example of a link to a heading in a page</h3><div><p>The following link
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="#/docs/one-ox-plain-list/#unordered-lists">[[#/docs/one-ox-plain-list/#unordered-lists][unordered lists heading in the page about plain-list]]</a></span></code></pre>
|
||||
|
||||
<p>is exported to this anchor tag that links to the heading with the <code class="one-hl one-hl-inline">id</code>
|
||||
set to <code class="one-hl one-hl-inline">unordered-lists</code> on the page <code class="one-hl one-hl-inline">/docs/one-ox-plain-list/</code>:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/docs/one-ox-plain-list/#unordered-lists"</span>>unordered lists heading in the page about plain-list</<span class="one-hl-function-name">a</span>></code></pre>
|
||||
|
||||
<p>and is rendered like this <a href="/docs/one-ox-plain-list/#unordered-lists">unordered lists heading in the page about
|
||||
plain-list</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-c464a1328c">Fuzzy links</h2><div><p>I don't use <code class="one-hl one-hl-inline">fuzzy</code> links. So, if there is a <code class="one-hl one-hl-inline">fuzzy</code> link
|
||||
in the document, that means I wrote the link wrong.
|
||||
</p>
|
||||
|
||||
<p>Broken links are bad user experience. I don't like them.
|
||||
</p>
|
||||
|
||||
<p>So I decided that <code class="one-hl one-hl-inline">one-ox</code> raises an error (hard-coded) when we try to
|
||||
export a fuzzy link to HTML.
|
||||
</p>
|
||||
|
||||
<p>For instance, the following <code class="one-hl one-hl-inline">fuzzy</code> link:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="fuzzy search">[[fuzzy search]]</a></span></code></pre>
|
||||
|
||||
<p>raise an error like the following:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(one-link-broken <span class="one-hl-string">"fuzzy search"</span> <span class="one-hl-string">"fuzzy links not supported"</span> <span class="one-hl-string">"goto-char: 5523"</span>)</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-608eaed84f">File links</h2><div><h3 id="one-c03ea6102f">Links to local files in assets and public directories</h3><div><p>Links to local files in <code class="one-hl one-hl-inline">./assets/</code> and <code class="one-hl one-hl-inline">./public/</code> directories like
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="./assets/foo/bar.txt">[[./assets/foo/bar.txt][Bar file]]</a></span>
|
||||
<span class="one-hl-org-link"><a href="./public/foo/baz.txt">[[./public/foo/baz.txt][Baz file]]</a></span></code></pre>
|
||||
|
||||
<p>are exported with the prefixes <code class="one-hl one-hl-inline">./assets</code> and <code class="one-hl one-hl-inline">./public</code> of the path
|
||||
removed like this:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/foo/bar.txt"</span>>Bar file</<span class="one-hl-function-name">a</span>>
|
||||
<<span class="one-hl-function-name">a</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/foo/baz.txt"</span>>Baz file</<span class="one-hl-function-name">a</span>></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-eda2a74e6f">Local file links that raise one-link-broken error</h3><div><p>Any file link that doesn't point to a file in <code class="one-hl one-hl-inline">./assets/</code> or <code class="one-hl one-hl-inline">./public/</code>
|
||||
subdirectories raises an <code class="one-hl one-hl-inline">one-link-broken</code> error when we try to
|
||||
export it with <code class="one-hl one-hl-inline">one-ox</code> org backend
|
||||
</p>
|
||||
|
||||
<p>For instance if we try to export using <code class="one-hl one-hl-inline">one-ox</code> org backend the
|
||||
following link to the file <code class="one-hl one-hl-inline">foo.txt</code> in the directory <code class="one-hl one-hl-inline">/tmp/</code>
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="/tmp/foo.txt">[[/tmp/foo.txt]]</a></span></code></pre>
|
||||
|
||||
<p>which is not in <code class="one-hl one-hl-inline">./public/</code> subdirectory nor in <code class="one-hl one-hl-inline">./assets/</code> subdirectory
|
||||
we will get an error like the following:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(one-link-broken <span class="one-hl-string">"/tmp/"</span> <span class="one-hl-string">"goto-char: 26308"</span>)</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-325ea8bc56">Links to images</h3><div><p>Links to local files in <code class="one-hl one-hl-inline">./assets/</code> and <code class="one-hl one-hl-inline">./public/</code> directories whom path
|
||||
matches <code class="one-hl one-hl-inline">one-ox-link-image-extensions</code> regexp are exported with an <code class="one-hl one-hl-inline">img</code>
|
||||
tag.
|
||||
</p>
|
||||
|
||||
<p>For instance the following link to an image in <code class="one-hl one-hl-inline">./assets/img/</code> directory
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-link"><a href="./assets/img/keep-learning.png">[[./assets/img/keep-learning.png][Keep Learning]]</a></span></code></pre>
|
||||
|
||||
<p>is exported as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">img</span> <span class="one-hl-variable-name">href</span>=<span class="one-hl-string">"/img/keep-learning.png"</span> <span class="one-hl-variable-name">alt</span>=<span class="one-hl-string">"Keep Learning"</span>></<span class="one-hl-function-name">a</span>></code></pre>
|
||||
|
||||
<p>and rendered like this
|
||||
</p>
|
||||
|
||||
<p><p><img src="/img/keep-learning.png" alt="Keep Learning" /></p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/one-ox-fixed-width-and-example-block/">PREV</a><a href="/">RANDOM</a><a href="/docs/one-ox-plain-list/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
99
one.el/docs/public/docs/one-ox-plain-list/index.html
Normal file
99
one.el/docs/public/docs/one-ox-plain-list/index.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one-ox | plain-list and item</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>one-ox | plain-list and item</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#unordered-lists">Unordered lists</a></li>
|
||||
<li><a href="#one-178f5c37b0">Ordered list</a></li>
|
||||
</ul>
|
||||
</div></div></div><div><p>Only unordered and ordered lists are supported.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div><h2 id="unordered-lists">Unordered lists</h2><div><p>The following org snippet (unordered list):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">- a thing,
|
||||
- another thing,
|
||||
- and the last one.</code></pre>
|
||||
|
||||
<p>is exported by <code class="one-hl one-hl-inline">one-ox</code> as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">ul</span>>
|
||||
<<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">p</span>>a thing,</<span class="one-hl-function-name">p</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">p</span>>another thing,</<span class="one-hl-function-name">p</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">p</span>>and the last one.</<span class="one-hl-function-name">p</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
</<span class="one-hl-function-name">ul</span>></code></pre>
|
||||
|
||||
<p>and is rendered like this:
|
||||
</p>
|
||||
|
||||
<ul><li><p>a thing,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>another thing,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>and the last one.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-178f5c37b0">Ordered list</h2><div><p>The following org snippet (unordered list):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">1. first,
|
||||
2. second,
|
||||
3. third.</code></pre>
|
||||
|
||||
<p>is exported by <code class="one-hl one-hl-inline">one-ox</code> as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">ol</span>>
|
||||
<<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">p</span>>a thing,</<span class="one-hl-function-name">p</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">p</span>>another thing,</<span class="one-hl-function-name">p</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">p</span>>and the last one.</<span class="one-hl-function-name">p</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
</<span class="one-hl-function-name">ol</span>></code></pre>
|
||||
|
||||
<p>and is rendered like this:
|
||||
</p>
|
||||
|
||||
<ol><li><p>first,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>second,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>third.
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav"><a href="/docs/one-ox-links/">PREV</a><a href="/docs/one-ox-src-block/">RANDOM</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
43
one.el/docs/public/docs/one-ox-quote-block/index.html
Normal file
43
one.el/docs/public/docs/one-ox-quote-block/index.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one-ox | quote-block</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>one-ox | quote-block</h1></div><div><p>Blocks defined with <code class="one-hl one-hl-inline">#+BEGIN_QUOTE ... #+END_QUOTE</code> pattern are
|
||||
quote-block.
|
||||
</p>
|
||||
|
||||
<p>They are exported by <code class="one-hl one-hl-inline">one-ox</code> in a <code class="one-hl one-hl-inline"><blockquote>...</blockquote></code>
|
||||
component with the CSS class <code class="one-hl one-hl-inline">one-blockquote</code>.
|
||||
</p>
|
||||
|
||||
<p>The following org snippet:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-block-begin-line">#+BEGIN_QUOTE
|
||||
</span><span class="one-hl-org-quote">A quitter never wins and a winner never quits. —Napoleon Hill
|
||||
</span><span class="one-hl-org-block-end-line">#+END_QUOTE</span></code></pre>
|
||||
|
||||
<p>defines a quote and is exported by <code class="one-hl one-hl-inline">one-ox</code> as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">blockquote</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-blockquote"</span>><<span class="one-hl-function-name">p</span>>A quitter never wins and a winner never quits. —Napoleon Hill</<span class="one-hl-function-name">p</span>></<span class="one-hl-function-name">blockquote</span>></code></pre>
|
||||
|
||||
<p>and looks like this
|
||||
</p>
|
||||
|
||||
<blockquote class="one-blockquote"><p>A quitter never wins and a winner never quits. —Napoleon Hill
|
||||
</p>
|
||||
</blockquote>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/one-ox-src-block/">PREV</a><a href="/docs/one-ox/">RANDOM</a><a href="/docs/one-ox-fixed-width-and-example-block/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
232
one.el/docs/public/docs/one-ox-src-block/index.html
Normal file
232
one.el/docs/public/docs/one-ox-src-block/index.html
Normal file
@@ -0,0 +1,232 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one-ox | src-block</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>one-ox | src-block</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#one-e397ac483d">Code highlighting with htmlize</a>
|
||||
<ul>
|
||||
<li><a href="#one-1d3f76fa94">Description</a></li>
|
||||
<li><a href="#one-2d60f2860a">Example with Bash code</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org-keywords-results-and-attr_one_results">Org keyword RESULTS</a>
|
||||
<ul>
|
||||
<li><a href="#one-c6cbf12259">Example using org keyword 'RESULTS'</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#one-28a24e07d1">Code blocks inside list</a></li>
|
||||
</ul>
|
||||
</div></div></div><div></div>
|
||||
<div><h2 id="one-e397ac483d">Code highlighting with htmlize</h2><div><h3 id="one-1d3f76fa94">Description</h3><div><p><code class="one-hl one-hl-inline">one-ox</code> highlights code via the function <code class="one-hl one-hl-inline">one-ox-htmlize</code> that uses
|
||||
<a href="https://github.com/hniksic/emacs-htmlize">htmlize</a> to do the work.
|
||||
</p>
|
||||
|
||||
<p>For a given piece of code <code class="one-hl one-hl-inline">X</code> in a certain language <code class="one-hl one-hl-inline">Y</code>, <code class="one-hl one-hl-inline">X</code> will be
|
||||
highlighted as it would be in the emacs mode <code class="one-hl one-hl-inline">Z</code> used to edit <code class="one-hl one-hl-inline">Y</code> code.
|
||||
</p>
|
||||
|
||||
<p>For instance, <code class="one-hl one-hl-inline">clojure-mode</code> is used to highlight Clojure code and
|
||||
<code class="one-hl one-hl-inline">sh-mode</code> is used to highlight Bash code.
|
||||
</p>
|
||||
|
||||
<p>Attributes of a face (like <code class="one-hl one-hl-inline">background-color</code> or <code class="one-hl one-hl-inline">foreground-color</code>)
|
||||
are not taken directly. A generated name for the face is produced and
|
||||
used as the CSS class for the parts of the code <code class="one-hl one-hl-inline">X</code> that are highlighted
|
||||
with that face.
|
||||
</p>
|
||||
|
||||
<p>For instance, in <code class="one-hl one-hl-inline">sh-mode</code>, the word <code class="one-hl one-hl-inline">echo</code> is highlighted with the face
|
||||
<code class="one-hl one-hl-inline">font-lock-builtin-face</code>. So, the word <code class="one-hl one-hl-inline">echo</code> in a piece of Shell (or
|
||||
Bash) code will be transformed into:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-builtin"</span>>echo</<span class="one-hl-function-name">span</span>></code></pre>
|
||||
|
||||
<p>The whole piece of code <code class="one-hl one-hl-inline">X</code>, once the previously described operations
|
||||
have been done, is wrapped:
|
||||
</p>
|
||||
|
||||
<ol><li><p>for a normal block with the component:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>>...</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>></code></pre>
|
||||
</li>
|
||||
|
||||
<li><p>for a result block with the component:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-results"</span>>...</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>></code></pre>
|
||||
|
||||
<p>See section <a href="/docs/one-ox-src-block/#org-keywords-results-and-attr_one_results">org keyword RESULTS</a>.
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-2d60f2860a">Example with Bash code</h3><div><p>For instance, the following org src-block, containing some <code class="one-hl one-hl-inline">bash</code> code:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-block-begin-line">#+BEGIN_SRC bash
|
||||
</span><span class="one-hl-org-block"><span class="one-hl-builtin">echo</span></span><span class="one-hl-org-block"> </span><span class="one-hl-org-block"><span class="one-hl-string">"list file's extensions in current dir:"</span></span><span class="one-hl-org-block">
|
||||
</span><span class="one-hl-org-block"><span class="one-hl-keyword">for</span></span><span class="one-hl-org-block"> f</span><span class="one-hl-org-block"><span class="one-hl-keyword"> in</span></span><span class="one-hl-org-block"> </span><span class="one-hl-org-block"><span class="one-hl-sh-quoted-exec">`ls`</span></span><span class="one-hl-org-block">; </span><span class="one-hl-org-block"><span class="one-hl-keyword">do</span></span><span class="one-hl-org-block">
|
||||
</span><span class="one-hl-org-block"><span class="one-hl-builtin">echo</span></span><span class="one-hl-org-block"> ${</span><span class="one-hl-org-block"><span class="one-hl-variable-name">f</span></span><span class="one-hl-org-block">##*.}
|
||||
</span><span class="one-hl-org-block"><span class="one-hl-keyword">done</span></span><span class="one-hl-org-block">
|
||||
</span><span class="one-hl-org-block-end-line">#+END_SRC</span></code></pre>
|
||||
|
||||
<p>is exported as follow:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>><<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-builtin"</span>>echo</<span class="one-hl-function-name">span</span>> <<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-string"</span>>"list file's extensions in current dir:"</<span class="one-hl-function-name">span</span>>
|
||||
<<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-keyword"</span>>for</<span class="one-hl-function-name">span</span>> f<<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-keyword"</span>> in</<span class="one-hl-function-name">span</span>> <<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-sh-quoted-exec"</span>>`ls`</<span class="one-hl-function-name">span</span>>; <<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-keyword"</span>>do</<span class="one-hl-function-name">span</span>>
|
||||
<<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-builtin"</span>>echo</<span class="one-hl-function-name">span</span>> ${<<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-variable-name"</span>>f</<span class="one-hl-function-name">span</span>>##*.}
|
||||
<<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-keyword"</span>>done</<span class="one-hl-function-name">span</span>></<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>>
|
||||
</<span class="one-hl-function-name">div</span>></code></pre>
|
||||
|
||||
<p>and rendered like this:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-builtin">echo</span> <span class="one-hl-string">"list file's extensions in current dir:"</span>
|
||||
<span class="one-hl-keyword">for</span> f<span class="one-hl-keyword"> in</span> <span class="one-hl-sh-quoted-exec">`ls`</span>; <span class="one-hl-keyword">do</span>
|
||||
<span class="one-hl-builtin">echo</span> ${<span class="one-hl-variable-name">f</span>##*.}
|
||||
<span class="one-hl-keyword">done</span></code></pre>
|
||||
|
||||
<p>Note that <code class="one-hl one-hl-inline">one-ox-htmlize</code> has produced and used the following CSS
|
||||
classes (listed with their corresponding emacs faces):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"># from font-lock
|
||||
one-hl-builtin --> font-lock-builtin-face
|
||||
one-hl-keyword --> font-lock-keyword-face
|
||||
one-hl-string --> font-lock-string-face
|
||||
one-hl-variable-name --> font-lock-variable-name-face
|
||||
|
||||
# specific to sh-mode
|
||||
one-hl-sh-quoted-exec --> sh-quoted-exec</code></pre>
|
||||
|
||||
<p>You might have notice the pattern used for <code class="one-hl one-hl-inline">font-lock</code> faces and the one
|
||||
used for mode specific faces.
|
||||
</p>
|
||||
|
||||
<p><code class="one-hl one-hl-inline">one.el</code> provides a default style sheet (<code class="one-hl one-hl-inline">one-default-css</code>) that has the
|
||||
CSS classes defined for all the <code class="one-hl one-hl-inline">font-lock</code> faces (faces starting by
|
||||
<code class="one-hl one-hl-inline">font-lock-</code>) but not the specific faces used by each prog mode.
|
||||
</p>
|
||||
|
||||
<p>You can add the CSS classes specific to the prog modes you use as you
|
||||
go and need them.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="org-keywords-results-and-attr_one_results">Org keyword RESULTS</h2><div><p>Result blocks are preceded by a line starting with <code class="one-hl one-hl-inline">#+RESULTS:</code>. Blocks
|
||||
that are not result blocks are normal blocks.
|
||||
</p>
|
||||
|
||||
<p>When exported, normal blocks and result blocks differ only by their
|
||||
CSS classes:
|
||||
</p>
|
||||
|
||||
<ul><li><p><code class="one-hl one-hl-inline">one-hl one-hl-block</code> for normal blocks,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><code class="one-hl one-hl-inline">one-hl one-hl-results</code> for result blocks.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>This way result blocks can be rendered with a different style
|
||||
than normal blocks as we can see in the following example.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div><h3 id="one-c6cbf12259">Example using org keyword 'RESULTS'</h3><div><p>The following org snippet:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-block-begin-line">#+BEGIN_SRC bash :results output
|
||||
</span><span class="one-hl-org-block">ls
|
||||
</span><span class="one-hl-org-block-end-line">#+END_SRC
|
||||
</span>
|
||||
<span class="one-hl-org-meta-line">#+RESULTS:</span>
|
||||
<span class="one-hl-org-code">: assets
|
||||
: docs.org
|
||||
: public</span></code></pre>
|
||||
|
||||
<p>is exported by <code class="one-hl one-hl-inline">one-ox</code> as follow:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>>ls</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>>
|
||||
<<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-results"</span>>assets
|
||||
docs.org
|
||||
public</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>></code></pre>
|
||||
|
||||
<p>and is rendered by <code class="one-hl one-hl-inline">one-ox</code> with the first block (normal block) having a
|
||||
different style from second block (result block):
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">ls</code></pre>
|
||||
|
||||
<pre><code class="one-hl one-hl-results">assets
|
||||
docs.org
|
||||
public</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="one-28a24e07d1">Code blocks inside list</h2><div><p>Lists can contain source blocks as we can see in the following org
|
||||
snippet
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">1. item 1
|
||||
|
||||
<span class="one-hl-org-block-begin-line"> #+BEGIN_SRC emacs-lisp
|
||||
</span><span class="one-hl-org-block"> (message </span><span class="one-hl-org-block"><span class="one-hl-string">"src-block in item 1"</span></span><span class="one-hl-org-block">)
|
||||
</span><span class="one-hl-org-block-end-line"> #+END_SRC
|
||||
</span>
|
||||
2. item 2
|
||||
3. item 3</code></pre>
|
||||
|
||||
<p>which is exported by <code class="one-hl one-hl-inline">one</code> as follow
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><<span class="one-hl-function-name">ol</span>>
|
||||
<<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">p</span>>item 1</<span class="one-hl-function-name">p</span>>
|
||||
<<span class="one-hl-function-name">pre</span>><<span class="one-hl-function-name">code</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl one-hl-block"</span>>(message <<span class="one-hl-function-name">span</span> <span class="one-hl-variable-name">class</span>=<span class="one-hl-string">"one-hl-string"</span>>"src-block in item 1"</<span class="one-hl-function-name">span</span>>)</<span class="one-hl-function-name">code</span>></<span class="one-hl-function-name">pre</span>>
|
||||
</<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">li</span>><<span class="one-hl-function-name">p</span>>item 2</<span class="one-hl-function-name">p</span>></<span class="one-hl-function-name">li</span>>
|
||||
<<span class="one-hl-function-name">li</span>><<span class="one-hl-function-name">p</span>>item 3</<span class="one-hl-function-name">p</span>></<span class="one-hl-function-name">li</span>>
|
||||
</<span class="one-hl-function-name">ol</span>></code></pre>
|
||||
|
||||
<p>and is rendered by <code class="one-hl one-hl-inline">one-ox</code> like this:
|
||||
</p>
|
||||
|
||||
<ol><li><p>item 1
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(message <span class="one-hl-string">"src-block in item 1"</span>)</code></pre>
|
||||
</li>
|
||||
|
||||
<li><p>item 2
|
||||
</p>
|
||||
</li>
|
||||
<li><p>item 3
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/one-ox-headline/">PREV</a><a href="/docs/one-ox-headline/">RANDOM</a><a href="/docs/one-ox-quote-block/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
129
one.el/docs/public/docs/one-ox/index.html
Normal file
129
one.el/docs/public/docs/one-ox/index.html
Normal file
@@ -0,0 +1,129 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one-ox</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title"><h1>one-ox</h1></div><div class="toc"><div><div>Table of content</div><div>
|
||||
<ul>
|
||||
<li><a href="#one-326337f683">Org export backend used by the default render functions</a></li>
|
||||
<li><a href="#org-elements-not-supported">Org elements not supported</a></li>
|
||||
</ul>
|
||||
</div></div></div><div></div>
|
||||
<div><h2 id="one-326337f683">Org export backend used by the default render functions</h2><div><p><code class="one-hl one-hl-inline">one.el</code> (specifically the default render functions) uses its own org
|
||||
export backend called <code class="one-hl one-hl-inline">one-ox</code> to export the org content of the pages
|
||||
into HTML strings.
|
||||
</p>
|
||||
|
||||
<p>For instance, the render function <code class="one-hl one-hl-inline">one-default</code> takes as first argument
|
||||
<code class="one-hl one-hl-inline">page-tree</code> which is the current page being rendered (<code class="one-hl one-hl-inline">page-tree</code> is the
|
||||
org parsed data structure representing the page) and exports it as an
|
||||
HTML string using <code class="one-hl one-hl-inline">org-export-data-with-backend</code> function and <code class="one-hl one-hl-inline">one-ox</code>
|
||||
export backend and uses it to render the HTML page:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block">(<span class="one-hl-keyword">defun</span> <span class="one-hl-function-name">one-default</span> (page-tree pages _global)
|
||||
<span class="one-hl-doc">"..."</span>
|
||||
(<span class="one-hl-keyword">let*</span> (...
|
||||
(content (org-export-data-with-backend
|
||||
(org-element-contents page-tree)
|
||||
'one-ox nil))
|
||||
...)
|
||||
(jack-html
|
||||
<span class="one-hl-string">"<!DOCTYPE html>"</span>
|
||||
`(<span class="one-hl-ta-colon-keyword">:html</span>
|
||||
(<span class="one-hl-ta-colon-keyword">:head</span> ...)
|
||||
(<span class="one-hl-ta-colon-keyword">:body</span> ... (<span class="one-hl-ta-colon-keyword">:div.content</span> ... ,content ,nav))))))</code></pre>
|
||||
|
||||
<p>This org backend is taylor for <code class="one-hl one-hl-inline">one.el</code> usage. So it doesn't try to
|
||||
export all the org elements unlike <code class="one-hl one-hl-inline">html</code> backend and when the org
|
||||
elements are exported they differ from what we can expect from <code class="one-hl one-hl-inline">html</code>
|
||||
backend.
|
||||
</p>
|
||||
|
||||
<p>For instance <code class="one-hl one-hl-inline">headline</code> elements don't take into account markups
|
||||
neither links.
|
||||
</p>
|
||||
|
||||
<p>Another example are the <code class="one-hl one-hl-inline">link</code> elements. They don't support org fuzzy
|
||||
links and links to local files that are not in the subdirectories
|
||||
<code class="one-hl one-hl-inline">./public/</code> or <code class="one-hl one-hl-inline">./assets/</code> raise errors.
|
||||
</p>
|
||||
|
||||
<p>You can read how the supported org elements are exported by <code class="one-hl one-hl-inline">one-ox</code> org
|
||||
backend in the following page:
|
||||
</p>
|
||||
|
||||
<ul><li><p><a href="/docs/one-ox-headline/">one-ox | headline</a>,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="/docs/one-ox-src-block/">one-ox | src-block</a>,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a>,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a>,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="/docs/one-ox-links/">one-ox | links</a> and
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="/docs/one-ox-plain-list/">one-ox | plain-list</a>.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="org-elements-not-supported">Org elements not supported</h2><div><p>The org elements that are not supported are the following:
|
||||
<code class="one-hl one-hl-inline">center-block</code>, <code class="one-hl one-hl-inline">clock</code>, <code class="one-hl one-hl-inline">drawer</code>, <code class="one-hl one-hl-inline">dynamic-block</code>, <code class="one-hl one-hl-inline">entity</code>, <code class="one-hl one-hl-inline">export-block</code>,
|
||||
<code class="one-hl one-hl-inline">export-snippet</code>, <code class="one-hl one-hl-inline">footnote-reference</code>, <code class="one-hl one-hl-inline">horizontal-rule</code>, <code class="one-hl one-hl-inline">inline-src-block</code>,
|
||||
<code class="one-hl one-hl-inline">inlinetask</code>, <code class="one-hl one-hl-inline">keyword</code>, <code class="one-hl one-hl-inline">latex-environment</code>, <code class="one-hl one-hl-inline">latex-fragment</code>, <code class="one-hl one-hl-inline">line-break</code>,
|
||||
<code class="one-hl one-hl-inline">node-property</code>, <code class="one-hl one-hl-inline">planning</code>, <code class="one-hl one-hl-inline">property-drawer</code>, <code class="one-hl one-hl-inline">radio-target</code>, <code class="one-hl one-hl-inline">special-block</code>,
|
||||
<code class="one-hl one-hl-inline">statistics-cookie</code>, <code class="one-hl one-hl-inline">table</code>, <code class="one-hl one-hl-inline">table-cell</code>, <code class="one-hl one-hl-inline">table-row</code>, <code class="one-hl one-hl-inline">target</code>, <code class="one-hl one-hl-inline">timestamp</code>,
|
||||
<code class="one-hl one-hl-inline">verse-block</code>.
|
||||
</p>
|
||||
|
||||
<p>Note that "not supported" means they are not rendered by default by
|
||||
<code class="one-hl one-hl-inline">one.el</code> but we can still use them or even extend <code class="one-hl one-hl-inline">one-ox</code> org export
|
||||
backend to take some of them into account.
|
||||
</p>
|
||||
|
||||
<p>Why doesn't <code class="one-hl one-hl-inline">one.el</code> support all org elements?
|
||||
</p>
|
||||
|
||||
<ol><li><p>I don't need those org elements to write my technical blogs:
|
||||
</p>
|
||||
|
||||
<ul><li><p>I don't do math. No support for Latex,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>I don't use table. No support for tables,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>etc.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><p><code class="one-hl one-hl-inline">one-ox</code> org backend is used only by the default render functions, so
|
||||
if you need more org elements you can either use another org
|
||||
backend or extend <code class="one-hl one-hl-inline">one-ox</code> org backend and use this other org backend
|
||||
in your own render functions (See <a href="/docs/miscellaneous/#extend-one-ox-org-backend">Extend one-ox org backend</a>).
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/miscellaneous/">PREV</a><a href="/docs/one-ox-src-block/">RANDOM</a><a href="/docs/one-ox-headline/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
BIN
one.el/docs/public/img/keep-learning.png
Normal file
BIN
one.el/docs/public/img/keep-learning.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
189
one.el/docs/public/index.html
Normal file
189
one.el/docs/public/index.html
Normal file
@@ -0,0 +1,189 @@
|
||||
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1" /><link rel="stylesheet" type="text/css" href="/one.css" /><title>one.el</title></head><body><div id="sidebar-left" onclick="followSidebarLink()"><div><div>Pages</div></div><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><div id="sidebar-main"></div><div id="sidebar-header"><svg id="hamburger" viewBox="0 0 24 24" onclick="sidebarShow()"><path d="M21,6H3V5h18V6z M21,11H3v1h18V11z M21,17H3v1h18V17z"></path></svg><a href="/">one.el</a></div><div id="sidebar-content"><div id="sidebar"><ul><li><a href="/">one.el</a></li><li><a href="/docs/install-one-el/">Install one.el</a></li><li><a href="/docs/getting-started/">Getting started</a></li><li><a href="/docs/how-does-one-el-work/">How does one.el work?</a></li><li><a href="/docs/one-default-render-function/">one-default render function</a></li><li><a href="/docs/miscellaneous/">Miscellaneous</a></li><li><a href="/docs/one-ox/">one-ox</a></li><li><a href="/docs/one-ox-headline/">one-ox | headline</a></li><li><a href="/docs/one-ox-src-block/">one-ox | src-block</a></li><li><a href="/docs/one-ox-quote-block/">one-ox | quote-block</a></li><li><a href="/docs/one-ox-fixed-width-and-example-block/">one-ox | fixed-width and example-block</a></li><li><a href="/docs/one-ox-links/">one-ox | links</a></li><li><a href="/docs/one-ox-plain-list/">one-ox | plain-list and item</a></li></ul></div><article><div class="title-empty"></div><div></div>
|
||||
<div><h2 id="one-c1672d88a8">Static Site Generator for Emacs Lisp programmers</h2><div><p><iframe style="width:100%;aspect-ratio: 16 / 9;" src="https://www.youtube.com/embed/GGP2mxZn4mY?&fs=1&modestbranding=1&rel=0&widget_referrer=https://one.tonyaldon.com" title="YouTube video player playing " frameborder="0" allow="fullscreen;accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture;web-share"></iframe>
|
||||
</p>
|
||||
|
||||
<p>Have you ever wanted to write a blog:
|
||||
</p>
|
||||
|
||||
<ul><li><p>contained in a unique org file,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>rendered with only one Emacs command,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>that can be modified by writing Emacs Lisp code (and CSS too),
|
||||
</p>
|
||||
</li>
|
||||
<li><p>with "html templates" that are plain Emacs Lisp data,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>with no config file,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>and no dependencies on external static site generators?
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>If so, you might be interested in <code class="one-hl one-hl-inline">one.el</code> a simple <b>Static Site
|
||||
Generator</b> for <b>Emacs Lisp</b> programmers and <b>org-mode</b> users.
|
||||
</p>
|
||||
|
||||
<p>To get started right away check <a href="/docs/install-one-el/">Install one.el</a> and <a href="/docs/getting-started/">Getting started</a>
|
||||
pages.
|
||||
</p>
|
||||
|
||||
<p>You can find the code here: <a href="https://github.com/tonyaldon/one.el">https://github.com/tonyaldon/one.el</a>.
|
||||
</p>
|
||||
|
||||
<p>Athough <code class="one-hl one-hl-inline">one.el</code> uses org-mode not all the org elements are useful to
|
||||
build technical blog sites (see <a href="/#why">Why one.el?</a>). So only a few org
|
||||
elements have an transcoder function implemented in <a href="/docs/one-ox/">one-ox</a>, the org
|
||||
backend used by <code class="one-hl one-hl-inline">one.el</code> to build the default website (see <a href="/docs/one-default-render-function/">one-default
|
||||
render function</a>). Please check <a href="/docs/one-ox/#org-elements-not-supported">Org elements not supported</a> before
|
||||
relying on <code class="one-hl one-hl-inline">one.el</code>.
|
||||
</p>
|
||||
|
||||
<p>In <code class="one-hl one-hl-inline">one.el</code>, the following org document defines a website with 3 pages
|
||||
that we build by calling <code class="one-hl one-hl-inline">one-build</code> command while we are visiting it:
|
||||
</p>
|
||||
|
||||
<pre><code class="one-hl one-hl-block"><span class="one-hl-org-level-1">* My website</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">one-default-home</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
|
||||
Welcome to my website!
|
||||
|
||||
<span class="one-hl-org-level-1">* Blog post 1</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">one-default</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span><span class="one-hl-org-property-value"><span class="one-hl-italic">blog/page-1</span></span><span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
|
||||
My first blog post!
|
||||
|
||||
<span class="one-hl-org-level-1">* Blog post 2</span>
|
||||
<span class="one-hl-org-drawer">:PROPERTIES:</span>
|
||||
<span class="one-hl-org-special-keyword">:ONE:</span> <span class="one-hl-org-property-value">one-default</span>
|
||||
<span class="one-hl-org-special-keyword">:CUSTOM_ID:</span> <span class="one-hl-org-property-value">/</span><span class="one-hl-org-property-value"><span class="one-hl-italic">blog/page-2</span></span><span class="one-hl-org-property-value">/</span>
|
||||
<span class="one-hl-org-drawer">:END:</span>
|
||||
|
||||
My second blog post!</code></pre>
|
||||
|
||||
<p>Note that if we want to use the default css style sheet we can add it
|
||||
by calling <code class="one-hl one-hl-inline">one-default-add-css-file</code> before building the website.
|
||||
</p>
|
||||
|
||||
<p>The path <code class="one-hl one-hl-inline">/</code> in the first <code class="one-hl one-hl-inline">CUSTOM_ID</code> org property tells <code class="one-hl one-hl-inline">one.el</code> that the
|
||||
page "My website" is the home page. That page is rendered using
|
||||
<code class="one-hl one-hl-inline">one-default-home</code> render function, value of <code class="one-hl one-hl-inline">ONE</code> org property of the
|
||||
same headline.
|
||||
</p>
|
||||
|
||||
<p>The path <code class="one-hl one-hl-inline">/blog/page-1/</code> in the second <code class="one-hl one-hl-inline">CUSTOM_ID</code> org property tells
|
||||
<code class="one-hl one-hl-inline">one.el</code> that we want to render "Blog post 1" page in such a way
|
||||
that when we serve our website locally at <code class="one-hl one-hl-inline">http://localhost:3000</code> for
|
||||
instance, that page is served at <code class="one-hl one-hl-inline">http://localhost:3000/blog/page-1/</code>.
|
||||
How that page is rendered is determined by the value of <code class="one-hl one-hl-inline">ONE</code> org
|
||||
property of the same headline which is <code class="one-hl one-hl-inline">one-default</code>, a render
|
||||
function.
|
||||
</p>
|
||||
|
||||
<p>The same goes for the last page "Blog post 2".
|
||||
</p>
|
||||
|
||||
<p>As you might have noticed, a <code class="one-hl one-hl-inline">one.el</code> website is an org file where the
|
||||
pages are the headlines of level 1 with the org properties <code class="one-hl one-hl-inline">ONE</code> and
|
||||
<code class="one-hl one-hl-inline">CUSTOM_ID</code> set. Nothing more!
|
||||
</p>
|
||||
|
||||
<p><code class="one-hl one-hl-inline">ONE</code> is the only org property added by <code class="one-hl one-hl-inline">one.el</code>. Its value, an Emacs Lisp
|
||||
function which returns an HTML string, for a given page determines how
|
||||
<code class="one-hl one-hl-inline">one.el</code> renders that page.
|
||||
</p>
|
||||
|
||||
<p>Paths of pages are set using <code class="one-hl one-hl-inline">CUSTOM_ID</code> org property.
|
||||
</p>
|
||||
|
||||
<p>With that said, if you want to try it you can check <a href="/docs/install-one-el/">Install one.el</a> and
|
||||
<a href="/docs/getting-started/">Getting started</a> pages.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><h2 id="why">Why one.el?</h2><div><p>I wrote <code class="one-hl one-hl-inline">one.el</code> because I didn't find an existing static site generator
|
||||
with the following requirements:
|
||||
</p>
|
||||
|
||||
<ul><li><p>I'm not looking for a solution for every type of websites, only for
|
||||
technical blog sites which are basically chunks of code surrounded
|
||||
by text,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>I want something simple that I understand and that I can modify
|
||||
only by writting some Emacs Lisp,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>I want websites to be written to a single org file,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>I want something with no dependencies other than emacs packages
|
||||
that are not bridges to feed other static site frameworks,
|
||||
</p>
|
||||
</li>
|
||||
<li><p>I want something with no configuration options, if you want to
|
||||
modify something you write Emacs Lisp code and
|
||||
</p>
|
||||
</li>
|
||||
<li><p>Finally, I want an Emacs solution for an Emacs user.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Following those requirements led me to <code class="one-hl one-hl-inline">one.el</code>, an opiniated static
|
||||
site generator for Emacs Lisp programmers and Org mode users that
|
||||
works well if you want to build websites like
|
||||
</p>
|
||||
|
||||
<ul><li><p><a href="https://minibuffer.tonyaldon.com">minibuffer</a> (<a href="https://github.com/tonyaldon/minibuffer.tonyaldon.com">source</a>): learn Emacs Lisp one sexp at a time,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="https://posts.tonyaldon.com">Elisp posts</a>: some articles about Emacs Lisp,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="https://jack.tonyaldon.com">jack</a>: HTML generator library for Emacs Lisp,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="https://one.tonyaldon.com">one.el</a>: documentation of one.el package,
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="https://lnroom.live">LNROOM</a>: learn how to hack on Core Lightning and
|
||||
</p>
|
||||
</li>
|
||||
<li><p><a href="https://tonyaldon.com">https://tonyaldon.com</a>.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>all built with <code class="one-hl one-hl-inline">one.el</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav"><a href="/docs/one-ox/">RANDOM</a><a href="/docs/install-one-el/">NEXT</a></div></article></div></body><script>
|
||||
function sidebarShow() {
|
||||
if (window.innerWidth < 481)
|
||||
document.getElementById('sidebar-left').style.width = '75vw';
|
||||
else {
|
||||
document.getElementById('sidebar-left').style.width = 'min(300px, 34vw)';
|
||||
}
|
||||
document.getElementById('sidebar-main').setAttribute('onclick', 'sidebarHide()');
|
||||
document.getElementById('sidebar-main').style.display = 'block';
|
||||
}
|
||||
function sidebarHide() {
|
||||
document.getElementById('sidebar-left').style.width = '0';
|
||||
document.getElementById('sidebar-main').style.display = 'none';
|
||||
}
|
||||
</script></html>
|
||||
499
one.el/docs/public/one.css
Normal file
499
one.el/docs/public/one.css
Normal file
@@ -0,0 +1,499 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400&family=Noto+Sans:wght@400;700&display=swap');
|
||||
|
||||
html, body, p, ol, ul, li, dl, dt, dd,
|
||||
blockquote, figure, fieldset, legend, textarea,
|
||||
pre, iframe, hr, h1, h2, h3, h4, h5, h6 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
p, blockquote, ul, ol, code,
|
||||
dl, table, pre, details {
|
||||
margin-bottom: 16px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 2em;
|
||||
list-style: disc;
|
||||
}
|
||||
|
||||
ul ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
ol {
|
||||
padding-left: 2em;
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
li p:first-of-type {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
li p {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
li code {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-padding-top: 4rem; /* because we use a sticky header */
|
||||
}
|
||||
|
||||
body {
|
||||
background: #151515;
|
||||
color: #dedede;
|
||||
font-family: "Noto Sans",sans-serif;
|
||||
font-size: 106%;
|
||||
line-height: 1.5;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
h2, h3, h4, h5, h6 {
|
||||
padding-bottom: 0.3em;
|
||||
margin-top: 24px;
|
||||
margin-bottom: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
h2, h3 {
|
||||
border-bottom: 1px solid #1d272b;
|
||||
}
|
||||
|
||||
h2 {font-size: 2em;}
|
||||
h3 {font-size: 1.5em;}
|
||||
h4 {font-size: 1.25em;}
|
||||
h5 {font-size: 1em;}
|
||||
h6 {font-size: .875em;}
|
||||
|
||||
a {
|
||||
color: #ffd787;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #ffd787;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/* ------- '.one' classes used by 'one-ox' org backend ------- */
|
||||
|
||||
.one-hl {
|
||||
font-family: 'Fira Mono', monospace;
|
||||
font-size: 80%;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.one-hl-inline {
|
||||
background: #31424a;
|
||||
padding: 0.2em 0.4em;
|
||||
margin: 0;
|
||||
white-space: break-spaces;
|
||||
}
|
||||
|
||||
.one-hl-block {
|
||||
background: #161f22;
|
||||
color: #c5c5c5;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
padding: 16px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.one-blockquote {
|
||||
background: #202d31;
|
||||
border-left: 0.3em solid #31424a;
|
||||
margin: 0px auto 16px;
|
||||
padding: 1em 1em;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.one-blockquote > p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.one-hl-results {
|
||||
background: #202d31 ;
|
||||
border-left: 2px solid #c5c5c5;
|
||||
display: block;
|
||||
margin: auto;
|
||||
padding: 0.5em 1em;
|
||||
overflow: auto;
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
.one-hl-negation-char { color: #ff6c60} /* font-lock-negation-char-face */
|
||||
.one-hl-warning { color: #fd971f} /* font-lock-warning-face */
|
||||
.one-hl-variable-name { color: #fd971f} /* font-lock-variable-name-face */
|
||||
.one-hl-doc { color: #d3b2a1} /* font-lock-doc-face */
|
||||
.one-hl-doc-string { color: #d3b2a1} /* font-lock-doc-string-face */
|
||||
.one-hl-string { color: #d3b2a1} /* font-lock-string-face */
|
||||
.one-hl-function-name { color: #02d2da} /* font-lock-function-name-face */
|
||||
.one-hl-builtin { color: #b2a1d3} /* font-lock-builtin-face */
|
||||
.one-hl-type { color: #457f8b} /* font-lock-type-face */
|
||||
.one-hl-keyword { color: #f92672} /* font-lock-keyword-face */
|
||||
.one-hl-preprocessor { color: #f92672} /* font-lock-preprocessor-face */
|
||||
.one-hl-comment-delimiter { color: #8c8c8c} /* font-lock-comment-delimiter-face */
|
||||
.one-hl-comment { color: #8c8c8c} /* font-lock-comment-face */
|
||||
.one-hl-constant { color: #f5ebb6} /* font-lock-constant-face */
|
||||
.one-hl-reference { color: #f5ebb6} /* font-lock-reference-face */
|
||||
.one-hl-regexp-grouping-backslash { color: #966046} /* font-lock-regexp-grouping-backslash */
|
||||
.one-hl-regexp-grouping-construct { color: #aa86ee} /* font-lock-regexp-grouping-construct */
|
||||
.one-hl-number { color: #eedc82} /* font-lock-number-face */
|
||||
|
||||
.one-hl-sh-quoted-exec { color: #62bd9c} /* sh-quoted-exec */
|
||||
|
||||
.one-hl-ta-colon-keyword {color: #62b5e0;} /* ta-colon-keyword-face */
|
||||
|
||||
|
||||
.one-hl-org-code { color: #dedede; background: #31424a; }
|
||||
.one-hl-org-block { color: #c5c5c5 ; background: #31424a; }
|
||||
.one-hl-org-block-begin-line { color: #c3957e; }
|
||||
.one-hl-org-block-end-line { color: #c3957e; }
|
||||
.one-hl-org-meta-line { color: #8c8c8c;}
|
||||
.one-hl-org-quote { color: #c5c5c5}
|
||||
.one-hl-org-drawer { color: #d3b2a1; font-size: 0.9em; }
|
||||
.one-hl-org-special-keyword { color: #c3957e; font-size: 0.9em; }
|
||||
.one-hl-org-property-value { color: #d2934a; font-size: 0.9em; }
|
||||
.one-hl-org-level-1 { font-size: 1.7em; text-decoration: underline; }
|
||||
.one-hl-org-level-2 { font-size: 1.4em; text-decoration: underline; }
|
||||
.one-hl-org-level-3 { font-size: 1.2em; text-decoration: underline; }
|
||||
.one-hl-org-level-4 { font-size: 1.1em; text-decoration: underline; }
|
||||
.one-hl-org-level-5 { font-size: 1.0em; text-decoration: underline; }
|
||||
.one-hl-org-level-6 { font-size: 1.0em; text-decoration: underline; }
|
||||
.one-hl-org-level-8 { font-size: 1.0em; text-decoration: underline; }
|
||||
.one-hl-org-level-8 { font-size: 1.0em; text-decoration: underline; }
|
||||
|
||||
|
||||
/* -------- scrollbar -------- */
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #202d31;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #31424a;
|
||||
border-radius: 0.5em;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #31424a;
|
||||
}
|
||||
|
||||
/* -------- specific to the default render functions -------- */
|
||||
|
||||
.header {
|
||||
color: #ffffff;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
padding: 0 16px 0 16px;
|
||||
background: #151515;
|
||||
width: 100%;
|
||||
height: 3.5rem;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-bottom: 1px solid #1d272b;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header > a {
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.header > a:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin: 3.5rem auto;
|
||||
padding-top: 1.8rem;
|
||||
max-width: 740px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
padding: 1.8rem 0;
|
||||
}
|
||||
|
||||
.title-empty {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
/* -------- one-default-home -------- */
|
||||
|
||||
#home {
|
||||
margin: 5rem 0 1.5rem 0;
|
||||
}
|
||||
|
||||
/* -------- one-default-home-list-pages -------- */
|
||||
|
||||
#home-list-pages {
|
||||
margin: 5rem 0 1.5rem 0;
|
||||
}
|
||||
|
||||
#pages ul {
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#pages a {
|
||||
display: block;
|
||||
line-height: 1.2em;
|
||||
font-size: 1.2em;
|
||||
color: #dedede;
|
||||
border-bottom: 1px solid #1d272b;
|
||||
padding: 1em 0.3em;
|
||||
}
|
||||
|
||||
#pages a:hover {
|
||||
text-decoration: none;
|
||||
background: #31424a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* -------- one-default, one-default-with-toc, one-default-with-sidebar, one-default-doc -------- */
|
||||
|
||||
.nav {
|
||||
border-top: 1px solid #c5c5c5;
|
||||
margin-top: 3em;
|
||||
padding: 2em 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nav a {
|
||||
display: block;
|
||||
background: #dedede;
|
||||
border-radius: 6px;
|
||||
padding: 0.2em 0.8em;
|
||||
color: #151515;
|
||||
width: 20%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width:600px) {
|
||||
.nav a {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------- one-default-with-toc, one-default-doc -------- */
|
||||
|
||||
.toc {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 1.8rem;
|
||||
color: #d1d1d1;
|
||||
}
|
||||
|
||||
.toc > div {
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
.toc a {
|
||||
color: #d1d1d1;
|
||||
}
|
||||
|
||||
.toc > div > div:first-child {
|
||||
text-decoration: underline 1px;
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* --------- one-default-with-sidebar, one-default-doc --------- */
|
||||
|
||||
#sidebar-header {
|
||||
color: #ffffff;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
padding: 0 16px 0 16px;
|
||||
background: #151515;
|
||||
width: 100%;
|
||||
height: 3.5rem;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-bottom: 1px solid #1d272b;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#sidebar-header > a {
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#sidebar-header > a:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#hamburger {
|
||||
cursor: pointer;
|
||||
height: 1em;
|
||||
fill: #dedede;
|
||||
display: none;
|
||||
font-weight: normal;
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
|
||||
#sidebar-content {
|
||||
margin: 3.5rem auto;
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 1140px;
|
||||
width: 100%;
|
||||
padding: 1em 16px;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
border-right: 2px solid #31424a;
|
||||
top: 4.5rem;
|
||||
position: sticky;
|
||||
padding-top: 2.2em;
|
||||
padding-bottom: 6em;
|
||||
width: 250px;
|
||||
max-height: 100vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#sidebar a {
|
||||
display: block;
|
||||
color: #dedede;
|
||||
}
|
||||
|
||||
#sidebar a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#sidebar ul {
|
||||
list-style: none;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#sidebar li {
|
||||
padding: 0.5em 0.6em;
|
||||
}
|
||||
|
||||
#sidebar li:hover {
|
||||
background: #31424a;
|
||||
}
|
||||
|
||||
article {
|
||||
padding: 0 1.5em;
|
||||
max-width: 640px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#sidebar-left {
|
||||
width: 0;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
z-index: 3;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transition: 0.25s;
|
||||
background: #2c444f;
|
||||
overflow: hidden; /* to make the children disappear when width is 0 */
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#sidebar-left > div:first-child {
|
||||
height: 3.5rem;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid #b8b8b8;
|
||||
padding-left: 16px;
|
||||
margin-bottom: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#sidebar-left > ul {
|
||||
padding: 0 16px 0 16px;
|
||||
}
|
||||
|
||||
#sidebar-left > ul ul {
|
||||
padding-left: 0.8em;
|
||||
margin-left: 3px;
|
||||
border-left: 1px solid #b8b8b8;
|
||||
}
|
||||
|
||||
#sidebar-left a {
|
||||
color: #dedede;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#sidebar-left li {
|
||||
padding: 0.5em 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#sidebar-main {
|
||||
display: none;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
background: #080808;
|
||||
opacity: 0.80;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
@media (max-width: 840px) {
|
||||
#hamburger {
|
||||
display: block;
|
||||
}
|
||||
#sidebar {
|
||||
display: none;
|
||||
}
|
||||
#sidebar-content {
|
||||
justify-content: center;
|
||||
}
|
||||
#sidebar-header {
|
||||
justify-content: left;
|
||||
}
|
||||
article {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
819
one.el/one-tests.el
Normal file
819
one.el/one-tests.el
Normal file
@@ -0,0 +1,819 @@
|
||||
;;; require
|
||||
|
||||
(require 'one)
|
||||
(require 'ert)
|
||||
(require 'cl) ; flet
|
||||
|
||||
;;; macro from org-mode repository
|
||||
|
||||
;; testing/org-test.el
|
||||
(defmacro org-test-with-temp-text (text &rest body)
|
||||
"Run body in a temporary buffer with Org mode as the active
|
||||
mode holding TEXT. If the string \"<point>\" appears in TEXT
|
||||
then remove it and place the point there before running BODY,
|
||||
otherwise place the point at the beginning of the inserted text."
|
||||
(declare (indent 1))
|
||||
`(let ((inside-text (if (stringp ,text) ,text (eval ,text)))
|
||||
(org-mode-hook nil))
|
||||
(with-temp-buffer
|
||||
(org-mode)
|
||||
(let ((point (string-match "<point>" inside-text)))
|
||||
(if point
|
||||
(progn
|
||||
(insert (replace-match "" nil nil inside-text))
|
||||
(goto-char (1+ (match-beginning 0))))
|
||||
(insert inside-text)
|
||||
(goto-char (point-min))))
|
||||
(font-lock-ensure (point-min) (point-max))
|
||||
,@body)))
|
||||
|
||||
;; testing/lisp/test-ox.el
|
||||
(defmacro org-test-with-parsed-data (data &rest body)
|
||||
"Execute body with parsed data available.
|
||||
DATA is a string containing the data to be parsed. BODY is the
|
||||
body to execute. Parse tree is available under the `tree'
|
||||
variable, and communication channel under `info'."
|
||||
(declare (debug (form body)) (indent 1))
|
||||
`(org-test-with-temp-text ,data
|
||||
(org-export--delete-comment-trees)
|
||||
(let* ((tree (org-element-parse-buffer))
|
||||
(info (org-combine-plists
|
||||
(org-export--get-export-attributes)
|
||||
(org-export-get-environment))))
|
||||
(org-export--prune-tree tree info)
|
||||
(org-export--remove-uninterpreted-data tree info)
|
||||
(let ((info (org-combine-plists
|
||||
info (org-export--collect-tree-properties tree info))))
|
||||
,@body))))
|
||||
|
||||
;;; utils
|
||||
|
||||
(ert-deftest one-escape-test ()
|
||||
(should (string= (one-escape "<") "<"))
|
||||
(should (string= (one-escape ">") ">"))
|
||||
(should (string= (one-escape "&") "&"))
|
||||
(should (string= (one-escape "\"") """))
|
||||
(should (string= (one-escape "'") "'"))
|
||||
(should (string= (one-escape "regular text") "regular text"))
|
||||
(should (string= (one-escape "<...>...&...\"...'") "<...>...&..."...'")))
|
||||
|
||||
;;; one-ox tests
|
||||
|
||||
;; (global-set-key (kbd "C-<f1>") (lambda () (interactive)(ert "one-ox-section-markup-plain-list-test")))
|
||||
|
||||
;;;; headline, section, paragraph, etc.
|
||||
|
||||
(ert-deftest one-ox-headline-test ()
|
||||
(let ((get-headline
|
||||
(lambda (rv tree)
|
||||
(car (org-element-map tree 'headline
|
||||
(lambda (e)
|
||||
(when (string= (org-element-property :raw-value e) rv)
|
||||
e)))))))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "* headline 1\n** headline 2
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /path/to/page/#id-test
|
||||
:END:"
|
||||
(let* ((tree (one-parse-buffer))
|
||||
(headline (funcall get-headline "headline 2" tree)))
|
||||
(one-ox-headline headline "<div>contents<div>" nil)))
|
||||
"<div><h2 id=\"id-test\">headline 2</h2><div>contents<div></div>"))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "* headline 1\n** headline 2
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /path/to/page/#id-test
|
||||
:END:"
|
||||
(let* ((tree (one-parse-buffer))
|
||||
(headline (funcall get-headline "headline 2" tree)))
|
||||
(one-ox-headline headline nil nil)))
|
||||
"<div><h2 id=\"id-test\">headline 2</h2></div>"))
|
||||
(should
|
||||
(string-match-p "id=\"one-.*\""
|
||||
(org-test-with-temp-text "* headline 1\n** headline 2
|
||||
:PROPERTIES:
|
||||
:no-custom-id: so a random :one-internal-id id is set by one-parse-buffer
|
||||
:END:"
|
||||
(let* ((tree (one-parse-buffer))
|
||||
(headline (funcall get-headline "headline 2" tree)))
|
||||
(one-ox-headline headline nil nil)))))))
|
||||
|
||||
(ert-deftest one-ox-section-markup-plain-list-test ()
|
||||
;; section, paragraph, plain-text, bold, italic, strike-through, underline, subscript, superscript
|
||||
(should (string= (one-ox-section nil "section" nil) "<div>section</div>"))
|
||||
(should (string= (one-ox-section nil nil nil) ""))
|
||||
(should (string= (one-ox-paragraph nil "paragraph" nil) "<p>paragraph</p>"))
|
||||
(should (string= (one-ox-plain-text "<...>...&" nil) "<...>...&"))
|
||||
(should (string= (one-ox-bold nil "bold" nil) "<b>bold</b>"))
|
||||
(should (string= (one-ox-italic nil "italic" nil) "<i>italic</i>"))
|
||||
(should (string= (one-ox-strike-through nil "strike-through" nil) "<del>strike-through</del>"))
|
||||
(should (string= (one-ox-underline nil "underline" nil) "<u>underline</u>"))
|
||||
(should (string= (one-ox-no-subscript nil "foo" nil) "_foo"))
|
||||
(should (string= (one-ox-no-superscript nil "bar" nil) "^bar"))
|
||||
;; plain-list, item
|
||||
(let ((ordered-list
|
||||
(org-test-with-temp-text "<point>1) first
|
||||
2) second
|
||||
3) third"
|
||||
(org-element-at-point)))
|
||||
(unordered-list
|
||||
(org-test-with-temp-text "<point>- first
|
||||
- second
|
||||
- third"
|
||||
(org-element-at-point)))
|
||||
(other-list
|
||||
(org-test-with-temp-text "<point>- first :: description 1
|
||||
- second :: description 2
|
||||
- third :: description 3"
|
||||
(org-element-at-point))))
|
||||
(should (string= (one-ox-plain-list ordered-list "contents" nil) "<ol>contents</ol>"))
|
||||
(should (string= (one-ox-plain-list unordered-list "contents" nil) "<ul>contents</ul>"))
|
||||
(should-error (one-ox-plain-list other-list "contents" nil)))
|
||||
(should (string= (one-ox-item nil "item" nil) "<li>item</li>")))
|
||||
|
||||
(ert-deftest one-ox-code-and-verbatim-test ()
|
||||
;; code and verbatim nodes
|
||||
(let ((code (org-test-with-temp-text "before the ~inline code<point>~"
|
||||
(org-element-context)))
|
||||
(verbatim (org-test-with-temp-text "before the ~verbatim<point>~"
|
||||
(org-element-context))))
|
||||
(should (string= (one-ox-code code nil nil)
|
||||
"<code class=\"one-hl one-hl-inline\">inline code</code>"))
|
||||
(should (string= (one-ox-verbatim verbatim nil nil)
|
||||
"<code class=\"one-hl one-hl-inline\">verbatim</code>"))))
|
||||
|
||||
;;;; blocks
|
||||
|
||||
(ert-deftest one-ox-blocks-test ()
|
||||
;; `one-ox-htmlize'
|
||||
;; note that in `sh-mode', `echo' word has the face `font-lock-builtin-face',
|
||||
;; and strings have the faces `font-lock-string-face'.
|
||||
;; normal blocks
|
||||
(should (string= (one-ox-htmlize "echo \"Hello world!\"" "bash")
|
||||
(concat "<pre><code class=\"one-hl one-hl-block\">"
|
||||
"<span class=\"one-hl-builtin\">echo</span> "
|
||||
"<span class=\"one-hl-string\">\"Hello world!\"</span>"
|
||||
"</code></pre>")))
|
||||
;; results blocks
|
||||
(should (string= (one-ox-htmlize "echo \"Hello world!\"" "bash" t)
|
||||
(concat "<pre><code class=\"one-hl one-hl-results\">"
|
||||
"<span class=\"one-hl-builtin\">echo</span> "
|
||||
"<span class=\"one-hl-string\">\"Hello world!\"</span>"
|
||||
"</code></pre>")))
|
||||
|
||||
;; `one-ox-src-block'
|
||||
(let ((src-block (org-test-with-temp-text "
|
||||
#+BEGIN_SRC bash
|
||||
echo \"Hello world!\"
|
||||
#+END_SRC<point>"
|
||||
(org-element-context))))
|
||||
(should (string= (one-ox-src-block src-block nil nil )
|
||||
(concat "<pre><code class=\"one-hl one-hl-block\">"
|
||||
"<span class=\"one-hl-builtin\">echo</span> "
|
||||
"<span class=\"one-hl-string\">\"Hello world!\"</span>"
|
||||
"</code></pre>"))))
|
||||
|
||||
;; `one-ox-example-block'
|
||||
(let ((example-block (org-test-with-temp-text "
|
||||
#+BEGIN_EXAMPLE
|
||||
A simple example
|
||||
#+END_EXAMPLE<point>"
|
||||
(org-element-context)))
|
||||
(example-block-results-1 (org-test-with-temp-text "
|
||||
#+RESULTS:
|
||||
#+BEGIN_EXAMPLE
|
||||
A simple example
|
||||
#+END_EXAMPLE<point>"
|
||||
(org-element-context))))
|
||||
(should (string= (one-ox-example-block example-block nil nil)
|
||||
(concat "<pre><code class=\"one-hl one-hl-block\">"
|
||||
"A simple example"
|
||||
"</code></pre>")))
|
||||
(should (string= (one-ox-example-block example-block-results-1 nil nil)
|
||||
(concat "<pre><code class=\"one-hl one-hl-results\">"
|
||||
"A simple example"
|
||||
"</code></pre>"))))
|
||||
;; `one-ox-fixed-width'
|
||||
(let ((fixed-width (org-test-with-temp-text "
|
||||
: I'm a multiline fixed width
|
||||
: yes I am!<point>"
|
||||
(org-element-context)))
|
||||
(fixed-width-results-1 (org-test-with-temp-text "
|
||||
#+RESULTS:
|
||||
: I'm a multiline fixed width
|
||||
: yes I am!<point>"
|
||||
(org-element-context))))
|
||||
(should (string= (one-ox-fixed-width fixed-width nil nil)
|
||||
(concat "<pre><code class=\"one-hl one-hl-block\">"
|
||||
"I'm a multiline fixed width\nyes I am!"
|
||||
"</code></pre>")))
|
||||
(should (string= (one-ox-fixed-width fixed-width-results-1 nil nil)
|
||||
(concat "<pre><code class=\"one-hl one-hl-results\">"
|
||||
"I'm a multiline fixed width\nyes I am!"
|
||||
"</code></pre>"))))
|
||||
|
||||
;; `one-ox-quote-block'
|
||||
(should (string= (one-ox-quote-block nil "I'm a quote. —Tony Aldon" nil)
|
||||
"<blockquote class=\"one-blockquote\">I'm a quote. —Tony Aldon</blockquote>")))
|
||||
|
||||
;;;; links
|
||||
|
||||
(ert-deftest one-ox-link--custom-id-https-mailto-test ()
|
||||
"link type: custom-id, https, mailto"
|
||||
(let ((backend
|
||||
(org-export-create-backend
|
||||
:transcoders
|
||||
'((section . (lambda (_e c _i) c))
|
||||
(paragraph . (lambda (_e c _i) c))
|
||||
(link . one-ox-link)))))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "[[#foo][bar]]"
|
||||
(org-export-as backend))
|
||||
"<a href=\"foo\">bar</a>\n"))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "[[#foo]]"
|
||||
(org-export-as backend))
|
||||
"<a href=\"foo\">foo</a>\n"))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "https://tonyaldon.com"
|
||||
(org-export-as backend))
|
||||
"<a href=\"https://tonyaldon.com\">https://tonyaldon.com</a>\n"))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "[[https://tonyaldon.com][Tony Aldon]]"
|
||||
(org-export-as backend))
|
||||
"<a href=\"https://tonyaldon.com\">Tony Aldon</a>\n"))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "mailto:aldon.tony.adm@gmail.com"
|
||||
(org-export-as backend))
|
||||
"<a href=\"mailto:aldon.tony.adm@gmail.com\">mailto:aldon.tony.adm@gmail.com</a>\n"))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "[[mailto:aldon.tony.adm@gmail.com][my email]]"
|
||||
(org-export-as backend))
|
||||
"<a href=\"mailto:aldon.tony.adm@gmail.com\">my email</a>\n"))))
|
||||
|
||||
(ert-deftest one-ox-link--fuzzy-test ()
|
||||
"link type: fuzzy"
|
||||
(let ((backend
|
||||
(org-export-create-backend
|
||||
:transcoders
|
||||
'((section . (lambda (_e c _i) c))
|
||||
(paragraph . (lambda (_e c _i) c))
|
||||
(link . one-ox-link)))))
|
||||
(should-error
|
||||
(org-test-with-temp-text "[[fuzzy search]]"
|
||||
(org-export-as backend)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "[[*fuzzy search]]"
|
||||
(org-export-as backend)))))
|
||||
|
||||
(ert-deftest one-ox-link--file-public-and-assets-test ()
|
||||
;; relative file links starting with ./public or ./assets
|
||||
(let ((backend
|
||||
(org-export-create-backend
|
||||
:transcoders
|
||||
'((section . (lambda (_e c _i) c))
|
||||
(paragraph . (lambda (_e c _i) c))
|
||||
(link . one-ox-link)))))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "[[./public/blog/page-1.md][Page 1 in markdown]]"
|
||||
(org-export-as backend))
|
||||
"<a href=\"/blog/page-1.md\">Page 1 in markdown</a>\n"))
|
||||
;; images
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "[[./assets/images/one.png]]"
|
||||
(org-export-as backend))
|
||||
"<p><img src=\"/images/one.png\" alt=\"/images/one.png\" /></p>\n"))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "[[./assets/images/one.png][one image]]"
|
||||
(org-export-as backend))
|
||||
"<p><img src=\"/images/one.png\" alt=\"one image\" /></p>\n"))))
|
||||
|
||||
(ert-deftest one-ox-link--custom-type-test ()
|
||||
;; link type with an export function defined with `org-link-set-parameters'
|
||||
(org-link-set-parameters
|
||||
"foo"
|
||||
:export (lambda (path desc backend info)
|
||||
(when (eq backend 'one-ox)
|
||||
(format "<a href=\"%s\">%s</a>"
|
||||
(concat "foo::::" path)
|
||||
desc))))
|
||||
(let ((backend
|
||||
(org-export-create-backend
|
||||
:transcoders
|
||||
'((section . (lambda (_e c _i) c))
|
||||
(paragraph . (lambda (_e c _i) c))
|
||||
(link . one-ox-link)))))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text "[[foo:bar][My foo type link]]"
|
||||
(org-export-as backend))
|
||||
"<a href=\"foo::::bar\">My foo type link</a>\n")))
|
||||
;; remove specific link added with `org-link-set-parameters'
|
||||
(pop org-link-parameters))
|
||||
|
||||
;;; pages
|
||||
|
||||
(ert-deftest one-internal-id-test ()
|
||||
(let ((get-headline
|
||||
(lambda (rv tree)
|
||||
(car (org-element-map tree 'headline
|
||||
(lambda (e)
|
||||
(when (string= (org-element-property :raw-value e) rv)
|
||||
e)))))))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-parsed-data "* headline 1
|
||||
** headline 2
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /#id-test
|
||||
:END:"
|
||||
(one-internal-id (funcall get-headline "headline 2" tree)))
|
||||
"id-test"))
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-parsed-data "* headline 1
|
||||
** headline 2
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /path/to/page/#id-test
|
||||
:END:"
|
||||
(one-internal-id (funcall get-headline "headline 2" tree)))
|
||||
"id-test"))
|
||||
(should
|
||||
(string-prefix-p "one-"
|
||||
(org-test-with-parsed-data "* headline 1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /path/to/page/
|
||||
:END:"
|
||||
(one-internal-id (funcall get-headline "headline 1" tree)))))
|
||||
(should
|
||||
(string-prefix-p "one-"
|
||||
(org-test-with-parsed-data "* headline 1
|
||||
** headline 2"
|
||||
(one-internal-id (funcall get-headline "headline 2" tree)))))))
|
||||
|
||||
(ert-deftest one-is-page-test ()
|
||||
(should
|
||||
(let (headline)
|
||||
(equal
|
||||
(org-test-with-temp-text "* page 1
|
||||
:PROPERTIES:
|
||||
:ONE: render-function
|
||||
:CUSTOM_ID: /path/to/page-1/
|
||||
:END:"
|
||||
(setq headline (org-element-context))
|
||||
(one-is-page headline))
|
||||
`(:one-title "page 1"
|
||||
:one-path "/path/to/page-1/"
|
||||
:one-render-page-function render-function
|
||||
:one-page-tree ,headline))))
|
||||
(should-not
|
||||
(org-test-with-temp-text "** NOT A PAGE BECAUSE AT HEADLINE LEVEL > 1
|
||||
:PROPERTIES:
|
||||
:ONE: render-function
|
||||
:CUSTOM_ID: /path/to/page-1/
|
||||
:END:"
|
||||
(let* ((headline (org-element-context)))
|
||||
(one-is-page headline))))
|
||||
(should-not
|
||||
(org-test-with-temp-text "* NO PROPERTY ONE
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /path/to/page-1/
|
||||
:END:"
|
||||
(let* ((headline (org-element-context)))
|
||||
(one-is-page headline))))
|
||||
(should-not
|
||||
(org-test-with-temp-text "* NO PROPERTY CUSTOM_ID
|
||||
:PROPERTIES:
|
||||
:ONE: render-function
|
||||
:END:"
|
||||
(let* ((headline (org-element-context)))
|
||||
(one-is-page headline)))))
|
||||
|
||||
(ert-deftest one-list-pages-test ()
|
||||
;; list pages
|
||||
(should
|
||||
(equal
|
||||
(org-test-with-temp-text "* page 1
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-1
|
||||
:CUSTOM_ID: /path/to/page-1/
|
||||
:END:
|
||||
* NOT A PAGE
|
||||
* page 2
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-2
|
||||
:CUSTOM_ID: /path/to/page-2/
|
||||
:END:
|
||||
* Headline level 1
|
||||
** NOT A PAGE (because at headline level 2)
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-3
|
||||
:CUSTOM_ID: /path/to/page-3/
|
||||
:END:
|
||||
* NO PROPERTY ONE
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /some/path/
|
||||
:END:
|
||||
* NO PROPERTY ONE
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-4
|
||||
:END:"
|
||||
(let* ((pages (one-list-pages (one-parse-buffer)))
|
||||
(page-1 (car pages))
|
||||
(page-2 (cadr pages)))
|
||||
(list (length pages)
|
||||
(plist-get page-1 :one-path)
|
||||
(plist-get page-1 :one-render-page-function)
|
||||
(car (plist-get page-1 :one-page-tree))
|
||||
(plist-get page-2 :one-path)
|
||||
(plist-get page-2 :one-render-page-function)
|
||||
(car (plist-get page-2 :one-page-tree)))))
|
||||
'(2
|
||||
"/path/to/page-1/" render-function-1 headline
|
||||
"/path/to/page-2/" render-function-2 headline)))
|
||||
;; narrow to the first element
|
||||
(should
|
||||
(equal
|
||||
(org-test-with-temp-text "* page 1
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-1
|
||||
:CUSTOM_ID: /path/to/page-1/
|
||||
:END:
|
||||
* page 2
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-2
|
||||
:CUSTOM_ID: /path/to/page-2/
|
||||
:END:"
|
||||
(org-narrow-to-element)
|
||||
(let* ((pages (one-list-pages (one-parse-buffer)))
|
||||
(page-1 (car pages)))
|
||||
(list (length pages)
|
||||
(plist-get page-1 :one-path)
|
||||
(plist-get page-1 :one-render-page-function)
|
||||
(car (plist-get page-1 :one-page-tree)))))
|
||||
'(1 "/path/to/page-1/" render-function-1 headline))))
|
||||
|
||||
(ert-deftest one-render-page-test ()
|
||||
(let* ((one-tree
|
||||
(org-test-with-temp-text "* Page foo bar
|
||||
:PROPERTIES:
|
||||
:ONE: render-function
|
||||
:CUSTOM_ID: /foo/bar/
|
||||
:END:
|
||||
* Page foo bar baz
|
||||
:PROPERTIES:
|
||||
:ONE: render-function
|
||||
:CUSTOM_ID: /foo/bar/baz/
|
||||
:END:"
|
||||
(one-parse-buffer)))
|
||||
(page (one-is-page (nth 2 one-tree)))
|
||||
(pages (one-list-pages one-tree))
|
||||
(global (list :one-tree one-tree)))
|
||||
(flet ((render-function
|
||||
(page-tree pages global)
|
||||
(message "%S" pages)
|
||||
(concat "-- page --\n"
|
||||
":ONE " (org-element-property :ONE page-tree) "\n"
|
||||
":CUSTOM_ID " (org-element-property :CUSTOM_ID page-tree) "\n"
|
||||
"-- pages --\n"
|
||||
":one-title " (plist-get (car pages) :one-title) "\n"
|
||||
":one-title " (plist-get (cadr pages) :one-title) "\n"
|
||||
"-- global --\n"
|
||||
":one-tree " (symbol-name (car (plist-get global :one-tree))))))
|
||||
(let* ((temp-dir (file-name-as-directory
|
||||
(expand-file-name
|
||||
(make-temp-file "one-" 'dir))))
|
||||
(default-directory temp-dir))
|
||||
;; we are testing `one-render-page'
|
||||
(one-render-page page pages global)
|
||||
(should
|
||||
(string=
|
||||
(with-current-buffer (find-file-noselect "public/foo/bar/index.html")
|
||||
(buffer-substring-no-properties (point-min) (point-max)))
|
||||
"-- page --
|
||||
:ONE render-function
|
||||
:CUSTOM_ID /foo/bar/
|
||||
-- pages --
|
||||
:one-title Page foo bar
|
||||
:one-title Page foo bar baz
|
||||
-- global --
|
||||
:one-tree org-data"))
|
||||
(delete-directory temp-dir t)))))
|
||||
|
||||
(ert-deftest one-render-pages-test ()
|
||||
;; test variables `one-add-to-global' and `one-hook',
|
||||
;; and also that `onerc.el' file is loaded
|
||||
(flet ((render-function-1 (page-tree pages global)
|
||||
(org-element-property :raw-value
|
||||
(nth 2 (plist-get global :one-tree))))
|
||||
(render-function-2 (page-tree pages global)
|
||||
(plist-get global :foo))
|
||||
;; we define it below in the file "onerc.el"
|
||||
;; but we want it to be local to the test
|
||||
(render-function-3 nil)
|
||||
(global-function (pages tree) "I'm BAR")
|
||||
;; create page ./public/tag1/index.html and ./public/tag2/index.html
|
||||
(tag-hook (pages tree global)
|
||||
(let ((tag-table (make-hash-table :test 'equal)))
|
||||
(dolist (page pages)
|
||||
(let ((path (plist-get page :one-path))
|
||||
(tags (org-element-property
|
||||
:tags
|
||||
(plist-get page :one-page-tree))))
|
||||
(dolist (tag tags)
|
||||
(puthash (substring-no-properties tag)
|
||||
(push path (gethash tag tag-table)) tag-table))))
|
||||
(maphash
|
||||
(lambda (tag page-paths)
|
||||
(let* ((path (concat "./public/" tag "/"))
|
||||
(file (concat path "index.html")))
|
||||
(make-directory path t)
|
||||
(with-temp-file file
|
||||
(insert (mapconcat #'identity (sort page-paths 'string<) "\n")))))
|
||||
tag-table))))
|
||||
(let* ((temp-dir (file-name-as-directory
|
||||
(expand-file-name
|
||||
(make-temp-file "one-" 'dir))))
|
||||
(default-directory temp-dir)
|
||||
(_ (with-temp-file (concat temp-dir "onerc.el")
|
||||
(prin1 '(defun render-function-3 (page-tree pages global)
|
||||
(plist-get global :bar))
|
||||
(current-buffer))))
|
||||
(one-add-to-global
|
||||
'((:one-global-property :one-tree
|
||||
:one-global-function (lambda (pages tree) tree))
|
||||
(:one-global-property :foo
|
||||
:one-global-function (lambda (pages tree)
|
||||
(org-element-map tree 'headline
|
||||
(lambda (elt) (org-element-property :FOO elt))
|
||||
nil t)))
|
||||
(:one-global-property :bar
|
||||
:one-global-function global-function)))
|
||||
(one-hook '(tag-hook)))
|
||||
(org-test-with-temp-text "* Some global information
|
||||
:PROPERTIES:
|
||||
:FOO: FOO
|
||||
:END:
|
||||
* Page 1 :tag1:
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-1
|
||||
:CUSTOM_ID: /page-1/
|
||||
:END:
|
||||
* Page 2 :tag2:
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-2
|
||||
:CUSTOM_ID: /page-2/
|
||||
:END:
|
||||
* Page 3 :tag1:tag2:
|
||||
:PROPERTIES:
|
||||
:ONE: render-function-3
|
||||
:CUSTOM_ID: /page-3/
|
||||
:END:"
|
||||
(one-render-pages))
|
||||
(should
|
||||
(string=
|
||||
(with-current-buffer (find-file-noselect "public/page-1/index.html")
|
||||
(buffer-substring-no-properties (point-min) (point-max)))
|
||||
"Some global information"))
|
||||
(should
|
||||
(string=
|
||||
(with-current-buffer (find-file-noselect "public/page-2/index.html")
|
||||
(buffer-substring-no-properties (point-min) (point-max)))
|
||||
"FOO"))
|
||||
(should
|
||||
(string=
|
||||
(with-current-buffer (find-file-noselect "public/page-3/index.html")
|
||||
(buffer-substring-no-properties (point-min) (point-max)))
|
||||
"I'm BAR"))
|
||||
(should
|
||||
(string=
|
||||
(with-current-buffer (find-file-noselect "public/tag1/index.html")
|
||||
(buffer-substring-no-properties (point-min) (point-max)))
|
||||
"/page-1/\n/page-3/"))
|
||||
(should
|
||||
(string=
|
||||
(with-current-buffer (find-file-noselect "public/tag2/index.html")
|
||||
(buffer-substring-no-properties (point-min) (point-max)))
|
||||
"/page-2/\n/page-3/"))
|
||||
(delete-directory temp-dir t))))
|
||||
|
||||
(ert-deftest one-page-at-point-test ()
|
||||
(let (one-path-1 one-path-2 one-path-3 one-path-4 one-path-5)
|
||||
(should
|
||||
(equal
|
||||
(org-test-with-temp-text "no page at point
|
||||
|
||||
* foo
|
||||
:PROPERTIES:
|
||||
:ONE: foo
|
||||
:CUSTOM_ID: /foo/
|
||||
:END:
|
||||
|
||||
some content here
|
||||
|
||||
* foo bar
|
||||
:PROPERTIES:
|
||||
:ONE: foo-bar
|
||||
:CUSTOM_ID: /foo/bar/
|
||||
:END:"
|
||||
(setq one-path-1 (one-page-at-point))
|
||||
(forward-line 2)
|
||||
(setq one-path-2 (one-page-at-point))
|
||||
(forward-line 6)
|
||||
(setq one-path-3 (one-page-at-point))
|
||||
(forward-line 2)
|
||||
(setq one-path-4 (one-page-at-point))
|
||||
(forward-line 2)
|
||||
(setq one-path-5 (one-page-at-point))
|
||||
(list one-path-1 one-path-2 one-path-3 one-path-4 one-path-5))
|
||||
'(nil "/foo/" "/foo/" "/foo/bar/" "/foo/bar/")))))
|
||||
|
||||
;;; default
|
||||
|
||||
(ert-deftest one-default-pages-test ()
|
||||
(should
|
||||
(equal
|
||||
(one-default-pages
|
||||
'((:one-title "HOME" :one-path "/")
|
||||
(:one-title "FOO-1" :one-path "/foo-1/")
|
||||
(:one-title "FOO-2" :one-path "/foo-2/")))
|
||||
'(:ul
|
||||
(:li (:a (@ :href "/") "HOME"))
|
||||
(:li (:a (@ :href "/foo-1/") "FOO-1"))
|
||||
(:li (:a (@ :href "/foo-2/") "FOO-2")))))
|
||||
(should
|
||||
(equal
|
||||
(one-default-pages
|
||||
'((:one-title "HOME" :one-path "/")
|
||||
(:one-title "FOO-1" :one-path "/foo-1/")
|
||||
(:one-title "FOO-2" :one-path "/foo-2/"))
|
||||
"/.+")
|
||||
'(:ul
|
||||
(:li (:a (@ :href "/foo-1/") "FOO-1"))
|
||||
(:li (:a (@ :href "/foo-2/") "FOO-2")))))
|
||||
(should
|
||||
(equal
|
||||
(one-default-pages
|
||||
'((:one-title "HOME" :one-path "/")
|
||||
(:one-title "FOO-1" :one-path "/foo/foo-1/")
|
||||
(:one-title "FOO-2" :one-path "/foo/foo-2/")
|
||||
(:one-title "BAR" :one-path "/bar/foo/")
|
||||
(:one-title "BAZ" :one-path "/baz/foo/"))
|
||||
"^/foo/")
|
||||
'(:ul
|
||||
(:li (:a (@ :href "/foo/foo-1/") "FOO-1"))
|
||||
(:li (:a (@ :href "/foo/foo-2/") "FOO-2")))))
|
||||
(should-not
|
||||
(one-default-pages '((:one-title "HOME" :one-path "/")) "/.+")))
|
||||
|
||||
(ert-deftest one-default-website-name-test ()
|
||||
(should
|
||||
(string=
|
||||
(one-default-website-name
|
||||
'((:one-title "HOME" :one-path "/")
|
||||
(:one-title "FOO-1" :one-path "/foo-1/")
|
||||
(:one-title "FOO-2" :one-path "/foo-2/")))
|
||||
"HOME"))
|
||||
(should-not
|
||||
(one-default-website-name
|
||||
'((:one-title "FOO-1" :one-path "/foo-1/")
|
||||
(:one-title "FOO-2" :one-path "/foo-2/")))))
|
||||
|
||||
(ert-deftest one-default-nav-test ()
|
||||
;; Two pages different from the home page are expected
|
||||
(should
|
||||
(equal
|
||||
(one-default-nav
|
||||
"/foo-1/"
|
||||
'((:one-path "/")
|
||||
(:one-path "/foo-1/")))
|
||||
'(:div.nav (:a (@ :href "/") "PREV") nil nil)))
|
||||
(should
|
||||
(equal
|
||||
(one-default-nav
|
||||
"/"
|
||||
'((:one-path "/")
|
||||
(:one-path "/foo-1/")))
|
||||
'(:div.nav nil nil (:a (@ :href "/foo-1/") "NEXT"))))
|
||||
(let* ((nav (one-default-nav
|
||||
"/foo-2/"
|
||||
'((:one-path "/")
|
||||
(:one-path "/foo-1/")
|
||||
(:one-path "/foo-2/")
|
||||
(:one-path "/foo-3/")
|
||||
(:one-path "/foo-4/"))))
|
||||
(random (nth 2 nav)))
|
||||
(should (equal (nth 1 nav) '(:a (@ :href "/foo-1/") "PREV")))
|
||||
(should (equal (nth 3 nav) '(:a (@ :href "/foo-3/") "NEXT")))
|
||||
(should-not (string= (nth 2 (nth 1 random)) "/foo-2/"))
|
||||
(should (member (nth 2 (nth 1 random)) '("/" "/foo-1/" "/foo-3/" "/foo-4/")))
|
||||
(should (equal (nth 2 random) "RANDOM"))))
|
||||
|
||||
(ert-deftest one-default-list-headlines-test ()
|
||||
(should
|
||||
(equal
|
||||
(org-test-with-temp-text "* page 1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /path/to/page-1/
|
||||
:END:
|
||||
** headline 1.1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /path/to/page-1/#id-11
|
||||
:END:
|
||||
** headline 1.2
|
||||
*** headline 1.2.1
|
||||
** headline 1.3
|
||||
*** headline 1.3.1
|
||||
* page 2
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: /path/to/page-2/
|
||||
:END:
|
||||
** headline 2.1
|
||||
*** headline 2.1.1
|
||||
"
|
||||
(let* ((tree (one-parse-buffer))
|
||||
(headlines (one-default-list-headlines tree))
|
||||
(headline-1 (car headlines))
|
||||
(headline-2 (cadr headlines)))
|
||||
(list (length headlines)
|
||||
(substring-no-properties (plist-get headline-1 :id) 0 4)
|
||||
(plist-get headline-1 :level)
|
||||
(plist-get headline-1 :title)
|
||||
(plist-get headline-2 :id)
|
||||
(plist-get headline-2 :level)
|
||||
(plist-get headline-2 :title))))
|
||||
'(9
|
||||
"one-" 1 "page 1"
|
||||
"id-11" 2 "headline 1.1"))))
|
||||
|
||||
(global-set-key (kbd "C-<f1>") (lambda () (interactive) (ert "one-default-toc-test")))
|
||||
(ert-deftest one-default-toc-test ()
|
||||
(should
|
||||
(equal
|
||||
(one-default-toc
|
||||
'((:level 2 :id "id-bar-1" :title "bar-1")
|
||||
(:level 3 :id "id-bar-1.1" :title "bar-1.1")
|
||||
(:level 3 :id "id-bar-1.2" :title "bar-1.2")
|
||||
(:level 4 :id "id-bar-1.2.1" :title "bar-1.2.1")
|
||||
(:level 4 :id "id-bar-1.2.2" :title "bar-1.2.2")
|
||||
(:level 5 :id "id-bar-1.2.2.1" :title "bar-1.2.2.1")
|
||||
(:level 5 :id "id-bar-1.2.2.2" :title "bar-1.2.2.2")
|
||||
(:level 6 :id "id-bar-1.2.2.2.1" :title "bar-1.2.2.2.1")
|
||||
(:level 6 :id "id-bar-1.2.2.2.2" :title "bar-1.2.2.2.2")
|
||||
(:level 6 :id "id-bar-1.2.2.2.3" :title "bar-1.2.2.2.3")
|
||||
(:level 2 :id "id-bar-2" :title "bar-2")
|
||||
(:level 3 :id "id-bar-2.1" :title "bar-2.1")
|
||||
(:level 3 :id "id-bar-2.2" :title "bar-2.2")
|
||||
(:level 2 :id "id-bar-3" :title "bar-3")
|
||||
(:level 3 :id "id-bar-3.1" :title "bar-3.1")
|
||||
(:level 2 :id "id-bar-4" :title "bar-4")))
|
||||
"
|
||||
<ul>
|
||||
<li><a href=\"#id-bar-1\">bar-1</a>
|
||||
<ul>
|
||||
<li><a href=\"#id-bar-1.1\">bar-1.1</a></li>
|
||||
<li><a href=\"#id-bar-1.2\">bar-1.2</a>
|
||||
<ul>
|
||||
<li><a href=\"#id-bar-1.2.1\">bar-1.2.1</a></li>
|
||||
<li><a href=\"#id-bar-1.2.2\">bar-1.2.2</a>
|
||||
<ul>
|
||||
<li><a href=\"#id-bar-1.2.2.1\">bar-1.2.2.1</a></li>
|
||||
<li><a href=\"#id-bar-1.2.2.2\">bar-1.2.2.2</a>
|
||||
<ul>
|
||||
<li><a href=\"#id-bar-1.2.2.2.1\">bar-1.2.2.2.1</a></li>
|
||||
<li><a href=\"#id-bar-1.2.2.2.2\">bar-1.2.2.2.2</a></li>
|
||||
<li><a href=\"#id-bar-1.2.2.2.3\">bar-1.2.2.2.3</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href=\"#id-bar-2\">bar-2</a>
|
||||
<ul>
|
||||
<li><a href=\"#id-bar-2.1\">bar-2.1</a></li>
|
||||
<li><a href=\"#id-bar-2.2\">bar-2.2</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href=\"#id-bar-3\">bar-3</a>
|
||||
<ul>
|
||||
<li><a href=\"#id-bar-3.1\">bar-3.1</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href=\"#id-bar-4\">bar-4</a></li>
|
||||
</ul>
|
||||
"))
|
||||
)
|
||||
2021
one.el/one.el
Normal file
2021
one.el/one.el
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user