initial commit sidebar
|
@ -0,0 +1,6 @@
|
|||
build/lib.linux-x86_64-2.7
|
||||
build/scripts-2.7
|
||||
build/share
|
||||
debian/uberwriter/DEBIAN
|
||||
debian/uberwriter/opt
|
||||
debian/uberwriter/usr
|
|
@ -0,0 +1,5 @@
|
|||
project = uberwriter
|
||||
version = 12.08.1
|
||||
template = ubuntu-application
|
||||
bzrbranch = lp:~w-vollprecht/uberwriter/quickly_trunk
|
||||
lp_id = uberwriter
|
|
@ -0,0 +1,2 @@
|
|||
Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
Copyright (C) 2012, Vova Kolobok <vovkkk@ya.ru>
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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
|
||||
<http://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
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
import locale
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
# Add project root directory (enable symlink and trunk execution)
|
||||
PROJECT_ROOT_DIRECTORY = os.path.abspath(
|
||||
os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
|
||||
|
||||
python_path = []
|
||||
if os.path.abspath(__file__).startswith('/opt'):
|
||||
locale.bindtextdomain('uberwriter', '/opt/extras.ubuntu.com/uberwriter/share/locale')
|
||||
syspath = sys.path[:] # copy to avoid infinite loop in pending objects
|
||||
for path in syspath:
|
||||
opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/uberwriter')
|
||||
python_path.insert(0, opt_path)
|
||||
sys.path.insert(0, opt_path)
|
||||
os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/uberwriter/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/")))
|
||||
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'uberwriter'))
|
||||
and PROJECT_ROOT_DIRECTORY not in sys.path):
|
||||
python_path.insert(0, PROJECT_ROOT_DIRECTORY)
|
||||
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
|
||||
if python_path:
|
||||
os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses
|
||||
|
||||
import uberwriter
|
||||
uberwriter.main()
|
|
@ -0,0 +1,35 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
import locale
|
||||
from locale import gettext as _
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter')
|
||||
|
||||
from uberwriter_lib.AboutDialog import AboutDialog
|
||||
|
||||
# See uberwriter_lib.AboutDialog.py for more details about how this class works.
|
||||
class AboutUberwriterDialog(AboutDialog):
|
||||
__gtype_name__ = "AboutUberwriterDialog"
|
||||
|
||||
def finish_initializing(self, builder): # pylint: disable=E1002
|
||||
"""Set up the about dialog"""
|
||||
super(AboutUberwriterDialog, self).finish_initializing(builder)
|
||||
|
||||
# Code for other initialization actions should be added here.
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
import re
|
||||
from gi.repository import Gtk
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter')
|
||||
logger.critical("RASDAOD JKJD ASJD SJ")
|
||||
|
||||
class FixTable():
|
||||
|
||||
def __init__(self, TextBuffer):
|
||||
self.TextBuffer = TextBuffer
|
||||
|
||||
@staticmethod
|
||||
def create_seperator(widths, char):
|
||||
"""
|
||||
Generate a line of + and - as sepeartor
|
||||
|
||||
Example:
|
||||
>>> create_separarator([2, 4], '-')
|
||||
'+----+------+'
|
||||
"""
|
||||
line = []
|
||||
|
||||
for w in widths:
|
||||
line.append("+" + char * (w + 2))
|
||||
|
||||
line.append("+")
|
||||
return ''.join(line)
|
||||
|
||||
@staticmethod
|
||||
def create_line(columns, widths):
|
||||
"""
|
||||
Crea una fila de la tabla separando los campos con un '|'.
|
||||
|
||||
El argumento `columns` es una lista con las celdas que se
|
||||
quieren imprimir y el argumento `widths` tiene el ancho
|
||||
de cada columna. Si la columna es mas ancha que el texto
|
||||
a imprimir se agregan espacios vacíos.
|
||||
|
||||
Example
|
||||
>>> create_line(['nombre', 'apellido'], [7, 10])
|
||||
'| nombre | apellido |'
|
||||
"""
|
||||
|
||||
line = zip(columns, widths)
|
||||
result = []
|
||||
|
||||
for text, width in line:
|
||||
spaces = " " * (width - len(text))
|
||||
text = "| " + text + spaces + " "
|
||||
result.append(text)
|
||||
|
||||
result.append("|")
|
||||
return ''.join(result)
|
||||
|
||||
@staticmethod
|
||||
def create_table(content):
|
||||
"""Imprime una tabla en formato restructuredText.
|
||||
|
||||
El argumento `content` tiene que ser una lista
|
||||
de celdas.
|
||||
|
||||
Example:
|
||||
|
||||
>>> print create_table([['software', 'vesion'], ['python', '3.2'],
|
||||
['vim', '7.3']])
|
||||
+----------+--------+
|
||||
| software | vesion |
|
||||
+==========+========+
|
||||
| python | 3.2 |
|
||||
+----------+--------+
|
||||
| vim | 7.3 |
|
||||
+----------+--------+
|
||||
"""
|
||||
|
||||
# obtiene las columnas de toda la tabla.
|
||||
columns = zip(*content)
|
||||
# calcula el tamano maximo que debe tener cada columna.
|
||||
# replace with len()
|
||||
widths = [max([len(x) for x in i]) for i in columns]
|
||||
|
||||
result = []
|
||||
|
||||
result.append(FixTable.create_seperator(widths, '-'))
|
||||
print(content, widths)
|
||||
result.append(FixTable.create_line(content[0], widths))
|
||||
result.append(FixTable.create_seperator(widths, '='))
|
||||
|
||||
for line in content[1:]:
|
||||
result.append(FixTable.create_line(line, widths))
|
||||
result.append(FixTable.create_seperator(widths, '-'))
|
||||
|
||||
return '\n'.join(result)
|
||||
|
||||
@staticmethod
|
||||
def are_in_a_table(current_line):
|
||||
"Line in a table?"
|
||||
return "|" in current_line or "+" in current_line
|
||||
|
||||
@staticmethod
|
||||
def are_in_a_paragraph(current_line):
|
||||
"Line in a paragraph?"
|
||||
return len(current_line.strip()) >= 1
|
||||
|
||||
def get_table_bounds(self, are_in_callback):
|
||||
"""
|
||||
Gets the row number where the table begins and ends.
|
||||
are_in_callback argument must be a function
|
||||
indicating whether a particular line belongs or not
|
||||
to the table to be measured (or create).
|
||||
Returns two values as a tuple
|
||||
"""
|
||||
top = 0
|
||||
|
||||
buf = self.TextBuffer
|
||||
start_iter = buf.get_start_iter()
|
||||
end_iter = buf.get_end_iter()
|
||||
|
||||
text = self.TextBuffer.get_text(start_iter, end_iter, False).split('\n')
|
||||
logger.debug(text)
|
||||
length = len(text)
|
||||
bottom = length - 1
|
||||
|
||||
insert_mark = self.TextBuffer.get_insert()
|
||||
insert_iter = self.TextBuffer.get_iter_at_mark(insert_mark)
|
||||
current_row_index = insert_iter.get_line()
|
||||
|
||||
for a in range(current_row_index, top, -1):
|
||||
if not are_in_callback(text[a]):
|
||||
top = a + 1
|
||||
break
|
||||
|
||||
for b in range(current_row_index, length):
|
||||
if not are_in_callback(text[b]):
|
||||
bottom = b - 1
|
||||
break
|
||||
|
||||
return top, bottom
|
||||
|
||||
@staticmethod
|
||||
def remove_spaces(string):
|
||||
"""Remove unnecessary spaces"""
|
||||
return re.sub("\s\s+", " ", string)
|
||||
|
||||
@staticmethod
|
||||
def create_separators_removing_spaces(string):
|
||||
return re.sub("\s\s+", "|", string)
|
||||
|
||||
@staticmethod
|
||||
def extract_cells_as_list(string):
|
||||
"Extrae el texto de una fila de tabla y lo retorna como una lista."
|
||||
string = FixTable.remove_spaces(string)
|
||||
return [item.strip() for item in string.split('|') if item]
|
||||
|
||||
@staticmethod
|
||||
def extract_table(text, top, bottom):
|
||||
full_table_text = text[top:bottom]
|
||||
# selecciona solamente las lineas que tienen celdas con texto.
|
||||
only_text_lines = [x for x in full_table_text if '|' in x]
|
||||
# extrae las celdas y descarta los separadores innecesarios.
|
||||
return [FixTable.extract_cells_as_list(x) for x in only_text_lines]
|
||||
|
||||
@staticmethod
|
||||
def extract_words_as_lists(text, top, bottom):
|
||||
"Genera una lista de palabras para crear una lista."
|
||||
|
||||
lines = text[top:bottom + 1]
|
||||
return [FixTable.create_separators_removing_spaces(line).split('|') for line in lines]
|
||||
|
||||
def fix_table(self):
|
||||
"""
|
||||
Fix Table, so all columns have the same width (again)
|
||||
|
||||
`initial_row` is a int idicationg the current row index
|
||||
"""
|
||||
|
||||
cursor_mark = self.TextBuffer.get_insert()
|
||||
cursor_iter = self.TextBuffer.get_iter_at_mark(cursor_mark)
|
||||
cursor_iter.set_line(cursor_iter.get_line())
|
||||
|
||||
end_line = cursor_iter.copy()
|
||||
end_line.forward_to_line_end()
|
||||
|
||||
|
||||
line_text = self.TextBuffer.get_text(cursor_iter, end_line, False)
|
||||
if FixTable.are_in_a_table(line_text):
|
||||
|
||||
# obtiene el indice donde comienza y termina la tabla.
|
||||
r1, r2 = self.get_table_bounds(FixTable.are_in_a_table)
|
||||
|
||||
logger.debug('asdasd ')
|
||||
|
||||
# extrae de la tabla solo las celdas de texto
|
||||
buf = self.TextBuffer
|
||||
start_iter = buf.get_start_iter()
|
||||
end_iter = buf.get_end_iter()
|
||||
|
||||
text = self.TextBuffer.get_text(start_iter, end_iter, False).split('\n')
|
||||
|
||||
table_as_list = FixTable.extract_table(text, r1, r2)
|
||||
logger.debug(table_as_list)
|
||||
# genera una nueva tabla tipo restructured text y la dibuja en el buffer.
|
||||
table_content = FixTable.create_table(table_as_list)
|
||||
logger.debug(table_content)
|
||||
# Insert table back into Buffer ...
|
||||
self.TextBuffer.insert(start_iter, table_content, -1)
|
||||
else:
|
||||
logger.debug("Not in a table")
|
||||
print("Not in table")
|
|
@ -0,0 +1,217 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
|
||||
import locale
|
||||
|
||||
import re
|
||||
from gi.repository import Gtk, Gdk # pylint: disable=E0611
|
||||
from gi.repository import Pango # pylint: disable=E0611
|
||||
|
||||
from locale import gettext as _
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
from . MarkupBuffer import MarkupBuffer
|
||||
|
||||
class FormatShortcuts():
|
||||
|
||||
def __init__(self, textbuffer, texteditor):
|
||||
self.TextBuffer = textbuffer
|
||||
self.TextEditor = texteditor
|
||||
|
||||
def rule(self):
|
||||
self.TextBuffer.insert_at_cursor("\n\n-------\n")
|
||||
self.TextEditor.scroll_mark_onscreen(self.TextBuffer.get_insert())
|
||||
self.regex = MarkupBuffer.regex
|
||||
|
||||
def bold(self):
|
||||
self.apply_format("**")
|
||||
|
||||
def italic(self):
|
||||
self.apply_format("*")
|
||||
|
||||
def apply_format(self, wrap = "*"):
|
||||
if self.TextBuffer.get_has_selection():
|
||||
## Find current highlighting
|
||||
|
||||
(start, end) = self.TextBuffer.get_selection_bounds()
|
||||
moved = False
|
||||
if (
|
||||
start.get_offset() >= len(wrap) and
|
||||
end.get_offset() <= self.TextBuffer.get_char_count() - len(wrap)
|
||||
):
|
||||
moved = True
|
||||
ext_start = start.copy()
|
||||
ext_start.backward_chars(len(wrap))
|
||||
ext_end = end.copy()
|
||||
ext_end.forward_chars(len(wrap))
|
||||
text = self.TextBuffer.get_text(ext_start, ext_end, True)
|
||||
else:
|
||||
text = self.TextBuffer.get_text(start, end, True)
|
||||
|
||||
if moved and text.startswith(wrap) and text.endswith(wrap):
|
||||
text = text[len(wrap):-len(wrap)]
|
||||
new_text = text
|
||||
self.TextBuffer.delete(ext_start, ext_end)
|
||||
move_back = 0
|
||||
else:
|
||||
if moved:
|
||||
text = text[len(wrap):-len(wrap)]
|
||||
new_text = text.lstrip().rstrip()
|
||||
text = text.replace(new_text, wrap + new_text + wrap)
|
||||
|
||||
self.TextBuffer.delete(start, end)
|
||||
move_back = len(wrap)
|
||||
|
||||
self.TextBuffer.insert_at_cursor(text)
|
||||
text_length = len(new_text)
|
||||
|
||||
else:
|
||||
helptext = ""
|
||||
if wrap == "*":
|
||||
helptext = _("emphasized text")
|
||||
elif wrap == "**":
|
||||
helptext = _("strong text")
|
||||
|
||||
self.TextBuffer.insert_at_cursor(wrap + helptext + wrap)
|
||||
text_length = len(helptext)
|
||||
move_back = len(wrap)
|
||||
|
||||
cursor_mark = self.TextBuffer.get_insert()
|
||||
cursor_iter = self.TextBuffer.get_iter_at_mark(cursor_mark)
|
||||
cursor_iter.backward_chars(move_back)
|
||||
self.TextBuffer.move_mark_by_name('selection_bound', cursor_iter)
|
||||
cursor_iter.backward_chars(text_length)
|
||||
self.TextBuffer.move_mark_by_name('insert', cursor_iter)
|
||||
|
||||
def unordered_list_item(self):
|
||||
helptext = _("List item")
|
||||
text_length = len(helptext)
|
||||
move_back = 0
|
||||
if self.TextBuffer.get_has_selection():
|
||||
(start, end) = self.TextBuffer.get_selection_bounds()
|
||||
if start.starts_line():
|
||||
text = self.TextBuffer.get_text(start, end, False)
|
||||
if text.startswith(("- ", "* ", "+ ")):
|
||||
delete_end = start.forward_chars(2)
|
||||
self.TextBuffer.delete(start, delete_end)
|
||||
else:
|
||||
self.TextBuffer.insert(start, "- ")
|
||||
else:
|
||||
move_back = 0
|
||||
cursor_mark = self.TextBuffer.get_insert()
|
||||
cursor_iter = self.TextBuffer.get_iter_at_mark(cursor_mark)
|
||||
|
||||
start_ext = cursor_iter.copy()
|
||||
start_ext.backward_lines(3)
|
||||
text = self.TextBuffer.get_text(cursor_iter, start_ext, False)
|
||||
lines = text.splitlines()
|
||||
|
||||
for line in reversed(lines):
|
||||
if len(line) and line.startswith(("- ", "* ", "+ ")):
|
||||
if cursor_iter.starts_line():
|
||||
self.TextBuffer.insert_at_cursor(line[:2] + helptext)
|
||||
else:
|
||||
self.TextBuffer.insert_at_cursor("\n" + line[:2] + helptext)
|
||||
break
|
||||
else:
|
||||
if len(lines[-1]) == 0 and len(lines[-2]) == 0:
|
||||
self.TextBuffer.insert_at_cursor("- " + helptext)
|
||||
elif len(lines[-1]) == 0:
|
||||
if cursor_iter.starts_line():
|
||||
self.TextBuffer.insert_at_cursor("- " + helptext)
|
||||
else:
|
||||
self.TextBuffer.insert_at_cursor("\n- " + helptext)
|
||||
else:
|
||||
self.TextBuffer.insert_at_cursor("\n\n- " + helptext)
|
||||
break
|
||||
|
||||
self.select_edit(move_back, text_length)
|
||||
|
||||
def ordered_list_item(self):
|
||||
pass
|
||||
|
||||
def select_edit(self, move_back, text_length):
|
||||
cursor_mark = self.TextBuffer.get_insert()
|
||||
cursor_iter = self.TextBuffer.get_iter_at_mark(cursor_mark)
|
||||
cursor_iter.backward_chars(move_back)
|
||||
self.TextBuffer.move_mark_by_name('selection_bound', cursor_iter)
|
||||
cursor_iter.backward_chars(text_length)
|
||||
self.TextBuffer.move_mark_by_name('insert', cursor_iter)
|
||||
self.TextEditor.scroll_mark_onscreen(self.TextBuffer.get_insert())
|
||||
|
||||
def above(self, linestart = ""):
|
||||
if not cursor_iter.starts_line():
|
||||
return ""
|
||||
else:
|
||||
cursor_mark = self.TextBuffer.get_insert()
|
||||
cursor_iter = self.TextBuffer.get_iter_at_mark(cursor_mark)
|
||||
|
||||
start_ext = cursor_iter.copy()
|
||||
start_ext.backward_lines(2)
|
||||
text = self.TextBuffer.get_text(cursor_iter, start_ext, False)
|
||||
lines = text.splitlines()
|
||||
|
||||
#if line[-1].startswith
|
||||
|
||||
def get_lines(self, cursor_iter):
|
||||
|
||||
start_ext = cursor_iter.copy()
|
||||
start_ext.backward_lines(2)
|
||||
text = self.TextBuffer.get_text(cursor_iter, start_ext, False)
|
||||
lines = text.splitlines()
|
||||
|
||||
abs_line = cursor_iter.get_line()
|
||||
|
||||
return reversed(lines)
|
||||
|
||||
def heading(self, level = 0):
|
||||
helptext = _("Heading")
|
||||
before = ""
|
||||
if self.TextBuffer.get_has_selection():
|
||||
(start, end) = self.TextBuffer.get_selection_bounds()
|
||||
text = self.TextBuffer.get_text(start, end, False)
|
||||
self.TextBuffer.delete(start, end)
|
||||
else:
|
||||
text = helptext
|
||||
|
||||
cursor_mark = self.TextBuffer.get_insert()
|
||||
cursor_iter = self.TextBuffer.get_iter_at_mark(cursor_mark)
|
||||
|
||||
#lines = self.get_lines(cursor_iter)
|
||||
|
||||
#if cursor_iter.starts_line():
|
||||
# if lines[1] != '':
|
||||
# before = before + "\n"
|
||||
#else:
|
||||
# match = re.match(r'([\#]+ )(.+)', lines[0])
|
||||
# if match:
|
||||
# if match.group(1):
|
||||
#
|
||||
# print match.group(0)
|
||||
# if len(match.group(0)) < 6:
|
||||
# before = before + "#" * (len(match.group(0)) + 1)
|
||||
# else:
|
||||
# before = before + "#"
|
||||
# else:
|
||||
# before = before + "\n\n"
|
||||
#
|
||||
#
|
||||
# check_text = self.TextBuffer.get_text(start, cursor_iter, False).decode("utf-8")
|
||||
# print check_text
|
||||
|
||||
self.TextBuffer.insert_at_cursor("#" + " " + text)
|
||||
self.select_edit(0, len(text))
|
|
@ -0,0 +1,316 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
import re
|
||||
from gi.repository import Gtk # pylint: disable=E0611
|
||||
from gi.repository import Pango # pylint: disable=E0611
|
||||
|
||||
|
||||
class MarkupBuffer():
|
||||
|
||||
def __init__(self, Parent, TextBuffer, base_leftmargin):
|
||||
self.multiplier = 10
|
||||
self.parent = Parent
|
||||
self.TextBuffer = TextBuffer
|
||||
|
||||
# Styles
|
||||
self.italic = self.TextBuffer.create_tag("italic",
|
||||
style=Pango.Style.ITALIC)
|
||||
|
||||
self.emph = self.TextBuffer.create_tag("emph",
|
||||
weight=Pango.Weight.BOLD,
|
||||
style=Pango.Style.NORMAL)
|
||||
|
||||
self.bolditalic = self.TextBuffer.create_tag("bolditalic",
|
||||
weight=Pango.Weight.BOLD,
|
||||
style=Pango.Style.ITALIC)
|
||||
|
||||
self.headline_two = self.TextBuffer.create_tag("headline_two",
|
||||
weight=Pango.Weight.BOLD,
|
||||
style=Pango.Style.NORMAL)
|
||||
|
||||
self.normal_indent = self.TextBuffer.create_tag('normal_indent', indent=100)
|
||||
|
||||
self.green_text = self.TextBuffer.create_tag(
|
||||
"greentext",
|
||||
foreground="#00364C"
|
||||
)
|
||||
|
||||
self.grayfont = self.TextBuffer.create_tag('graytag',
|
||||
foreground="gray")
|
||||
|
||||
self.blackfont = self.TextBuffer.create_tag('blacktag',
|
||||
foreground="#222")
|
||||
|
||||
self.underline = self.TextBuffer.create_tag(
|
||||
"underline",
|
||||
underline=Pango.Underline.SINGLE
|
||||
)
|
||||
|
||||
self.underline.set_property('weight', Pango.Weight.BOLD)
|
||||
|
||||
self.strikethrough = self.TextBuffer.create_tag(
|
||||
"strikethrough",
|
||||
strikethrough=True
|
||||
)
|
||||
|
||||
self.centertext = self.TextBuffer.create_tag(
|
||||
"centertext",
|
||||
justification=Gtk.Justification.CENTER
|
||||
)
|
||||
|
||||
self.TextBuffer.apply_tag(
|
||||
self.normal_indent,
|
||||
self.TextBuffer.get_start_iter(),
|
||||
self.TextBuffer.get_end_iter()
|
||||
)
|
||||
|
||||
self.rev_leftmargin = []
|
||||
for i in range(0, 6):
|
||||
name = "rev_marg_indent_left" + str(i)
|
||||
self.rev_leftmargin.append(self.TextBuffer.create_tag(name))
|
||||
self.rev_leftmargin[i].set_property("left-margin", 90 - 10 * (i + 1))
|
||||
self.rev_leftmargin[i].set_property("indent", - 10 * (i + 1) - 10)
|
||||
#self.leftmargin[i].set_property("background", "gray")
|
||||
|
||||
self.leftmargin = []
|
||||
|
||||
for i in range(0, 6):
|
||||
name = "marg_indent_left" + str(i)
|
||||
self.leftmargin.append(self.TextBuffer.create_tag(name))
|
||||
self.leftmargin[i].set_property("left-margin", base_leftmargin + 10 + 10 * (i + 1))
|
||||
self.leftmargin[i].set_property("indent", - 10 * (i + 1) - 10)
|
||||
|
||||
self.leftindent = []
|
||||
|
||||
for i in range(0, 15):
|
||||
name = "indent_left" + str(i)
|
||||
self.leftindent.append(self.TextBuffer.create_tag(name))
|
||||
self.leftindent[i].set_property("indent", - 10 * (i + 1) - 20)
|
||||
|
||||
self.table_env = self.TextBuffer.create_tag('table_env')
|
||||
self.table_env.set_property('wrap-mode', Gtk.WrapMode.NONE)
|
||||
# self.table_env.set_property('font', 'Ubuntu Mono 13px')
|
||||
self.table_env.set_property('pixels-above-lines', 0)
|
||||
self.table_env.set_property('pixels-below-lines', 0)
|
||||
regex = {
|
||||
"ITALIC": re.compile(r"\*\w(.+?)\*| _\w(.+?)_ ", re.UNICODE), # *asdasd* // _asdasd asd asd_
|
||||
"STRONG": re.compile(r"\*{2}\w(.+?)\*{2}| [_]{2}\w(.+?)[_]{2} ", re.UNICODE), # **as das** // __asdasdasd asd ad a__
|
||||
"STRONGITALIC": re.compile(r"\*{3}\w(.+?)\*{3}| [_]{3}\w(.+?)[_]{3} "),
|
||||
"BLOCKQUOTE": re.compile(r"^([\>]+ )", re.MULTILINE),
|
||||
"STRIKETHROUGH": re.compile(r"~~[^ `~\n].+?~~"),
|
||||
"LIST": re.compile(r"^[\-\*\+] ", re.MULTILINE),
|
||||
"NUMERICLIST": re.compile(r"^((\d|[a-z]|\#)+[\.\)]) ", re.MULTILINE),
|
||||
"INDENTEDLIST": re.compile(r"^(\t{1,6})((\d|[a-z]|\#)+[\.\)]|[\-\*\+]) ", re.MULTILINE),
|
||||
"HEADINDICATOR": re.compile(r"^(#{1,6}) ", re.MULTILINE),
|
||||
"HEADLINE": re.compile(r"^(#{1,6} [^\n]+)", re.MULTILINE),
|
||||
"HEADLINE_TWO": re.compile(r"^\w.+\n[\=\-]{3,}", re.MULTILINE),
|
||||
"MATH": re.compile(r"[\$]{1,2}([^` ].+?[^`\\ ])[\$]{1,2}"),
|
||||
"HORIZONTALRULE": re.compile(r"(\n\n[\*\-]{3,}\n)"),
|
||||
"TABLE": re.compile(r"^[\-\+]{5,}\n(.+?)\n[\-\+]{5,}\n", re.DOTALL),
|
||||
"LINK": re.compile(r"\(http(.+?)\)")
|
||||
}
|
||||
|
||||
def markup_buffer(self, mode=0):
|
||||
buf = self.TextBuffer
|
||||
|
||||
# Modes:
|
||||
# 0 -> start to end
|
||||
# 1 -> around the cursor
|
||||
# 2 -> n.d.
|
||||
|
||||
if mode == 0:
|
||||
context_start = buf.get_start_iter()
|
||||
context_end = buf.get_end_iter()
|
||||
context_offset = 0
|
||||
elif mode == 1:
|
||||
cursor_mark = buf.get_insert()
|
||||
context_start = buf.get_iter_at_mark(cursor_mark)
|
||||
context_start.backward_lines(3)
|
||||
context_end = buf.get_iter_at_mark(cursor_mark)
|
||||
context_end.forward_lines(2)
|
||||
context_offset = context_start.get_offset()
|
||||
|
||||
text = buf.get_slice(context_start, context_end, False)
|
||||
|
||||
self.TextBuffer.remove_tag(self.italic, context_start, context_end)
|
||||
|
||||
matches = re.finditer(self.regex["ITALIC"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.italic, startIter, endIter)
|
||||
|
||||
self.TextBuffer.remove_tag(self.emph, context_start, context_end)
|
||||
|
||||
matches = re.finditer(self.regex["STRONG"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.emph, startIter, endIter)
|
||||
|
||||
matches = re.finditer(self.regex["STRONGITALIC"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.bolditalic, startIter, endIter)
|
||||
|
||||
self.TextBuffer.remove_tag(self.strikethrough, context_start, context_end)
|
||||
|
||||
matches = re.finditer(self.regex["STRIKETHROUGH"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.strikethrough, startIter, endIter)
|
||||
|
||||
self.TextBuffer.remove_tag(self.green_text, context_start, context_end)
|
||||
|
||||
matches = re.finditer(self.regex["MATH"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.green_text, startIter, endIter)
|
||||
|
||||
for margin in self.rev_leftmargin:
|
||||
self.TextBuffer.remove_tag(margin, context_start, context_end)
|
||||
|
||||
matches = re.finditer(self.regex["LIST"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.rev_leftmargin[0], startIter, endIter)
|
||||
|
||||
matches = re.finditer(self.regex["NUMERICLIST"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
index = len(match.group(1)) - 1
|
||||
if index < len(self.rev_leftmargin):
|
||||
margin = self.rev_leftmargin[index]
|
||||
self.TextBuffer.apply_tag(margin, startIter, endIter)
|
||||
|
||||
matches = re.finditer(self.regex["BLOCKQUOTE"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
index = len(match.group(1)) - 2
|
||||
if index < len(self.leftmargin):
|
||||
self.TextBuffer.apply_tag(self.leftmargin[index], startIter, endIter)
|
||||
|
||||
for leftindent in self.leftindent:
|
||||
self.TextBuffer.remove_tag(leftindent, context_start, context_end)
|
||||
|
||||
matches = re.finditer(self.regex["INDENTEDLIST"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
index = (len(match.group(1)) - 1) * 2 + len(match.group(2))
|
||||
if index < len(self.leftindent):
|
||||
self.TextBuffer.apply_tag(self.leftindent[index], startIter, endIter)
|
||||
|
||||
matches = re.finditer(self.regex["HEADINDICATOR"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
index = len(match.group(1)) - 1
|
||||
if index < len(self.rev_leftmargin):
|
||||
margin = self.rev_leftmargin[index]
|
||||
self.TextBuffer.apply_tag(margin, startIter, endIter)
|
||||
|
||||
matches = re.finditer(self.regex["HORIZONTALRULE"], text)
|
||||
rulecontext = context_start.copy()
|
||||
rulecontext.forward_lines(3)
|
||||
self.TextBuffer.remove_tag(self.centertext, rulecontext, context_end)
|
||||
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
startIter.forward_chars(2)
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.centertext, startIter, endIter)
|
||||
|
||||
matches = re.finditer(self.regex["HEADLINE"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.emph, startIter, endIter)
|
||||
|
||||
matches = re.finditer(self.regex["HEADLINE_TWO"], text)
|
||||
self.TextBuffer.remove_tag(self.headline_two, rulecontext, context_end)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.headline_two, startIter, endIter)
|
||||
|
||||
matches = re.finditer(self.regex["TABLE"], text)
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(context_offset + match.start())
|
||||
endIter = buf.get_iter_at_offset(context_offset + match.end())
|
||||
self.TextBuffer.apply_tag(self.table_env, startIter, endIter)
|
||||
|
||||
if self.parent.focusmode:
|
||||
self.focusmode_highlight()
|
||||
|
||||
def focusmode_highlight(self):
|
||||
self.TextBuffer.apply_tag(self.grayfont,
|
||||
self.TextBuffer.get_start_iter(),
|
||||
self.TextBuffer.get_end_iter())
|
||||
|
||||
self.TextBuffer.remove_tag(self.blackfont,
|
||||
self.TextBuffer.get_start_iter(),
|
||||
self.TextBuffer.get_end_iter())
|
||||
|
||||
cursor = self.TextBuffer.get_mark("insert")
|
||||
cursor_iter = self.TextBuffer.get_iter_at_mark(cursor)
|
||||
|
||||
end_sentence = cursor_iter.copy()
|
||||
end_sentence.forward_sentence_end()
|
||||
|
||||
end_line = cursor_iter.copy()
|
||||
end_line.forward_to_line_end()
|
||||
|
||||
comp = end_line.compare(end_sentence)
|
||||
# if comp < 0, end_line is BEFORE end_sentence
|
||||
if comp <= 0:
|
||||
end_sentence = end_line
|
||||
|
||||
start_sentence = cursor_iter.copy()
|
||||
start_sentence.backward_sentence_start()
|
||||
|
||||
self.TextBuffer.apply_tag(self.blackfont,
|
||||
start_sentence, end_sentence)
|
||||
|
||||
def set_multiplier(self, multiplier):
|
||||
self.multiplier = multiplier
|
||||
|
||||
def recalculate(self, lm):
|
||||
multiplier = self.multiplier
|
||||
for i in range(0, 6):
|
||||
self.rev_leftmargin[i].set_property("left-margin", (lm - multiplier) - multiplier * (i + 1))
|
||||
self.rev_leftmargin[i].set_property("indent", - multiplier * (i + 1) - multiplier)
|
||||
|
||||
for i in range(0, 6):
|
||||
self.leftmargin[i].set_property("left-margin", (lm - multiplier) + multiplier + multiplier * (i + 1))
|
||||
self.leftmargin[i].set_property("indent", - (multiplier - 1) * (i + 1) - multiplier)
|
||||
|
||||
def dark_mode(self, active=False):
|
||||
if active:
|
||||
self.green_text.set_property("foreground", "#FA5B0F")
|
||||
self.grayfont.set_property("foreground", "#666")
|
||||
self.blackfont.set_property("foreground", "#CCC")
|
||||
else:
|
||||
self.green_text.set_property("foreground", "#00364C")
|
||||
self.grayfont.set_property("foreground", "gray")
|
||||
self.blackfont.set_property("foreground", "#222")
|
|
@ -0,0 +1,255 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
from gi.repository import Gtk
|
||||
import os
|
||||
import subprocess
|
||||
import locale
|
||||
from locale import gettext as _
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter')
|
||||
|
||||
from uberwriter_lib.AdvancedExportDialog import AdvancedExportDialog
|
||||
|
||||
# See uberwriter_lib.AboutDialog.py for more details about how this class works.
|
||||
class UberwriterAdvancedExportDialog(AdvancedExportDialog):
|
||||
__gtype_name__ = "UberwriterAdvancedExportDialog"
|
||||
|
||||
def finish_initializing(self, builder): # pylint: disable=E1002
|
||||
"""Set up the about dialog"""
|
||||
super(UberwriterAdvancedExportDialog, self).finish_initializing(builder)
|
||||
|
||||
# Code for other initialization actions should be added here.
|
||||
|
||||
self.builder.get_object("highlight_style").set_active(0)
|
||||
|
||||
format_store = Gtk.ListStore(int, str)
|
||||
for fmt_id in self.formats_dict:
|
||||
format_store.append([fmt_id, self.formats_dict[fmt_id]["name"]])
|
||||
self.format_field = builder.get_object('choose_format')
|
||||
self.format_field.set_model(format_store)
|
||||
|
||||
format_renderer = Gtk.CellRendererText()
|
||||
self.format_field.pack_start(format_renderer, True)
|
||||
self.format_field.add_attribute(format_renderer, "text", 1)
|
||||
self.format_field.set_active(0)
|
||||
self.show_all()
|
||||
|
||||
formats_dict = {
|
||||
1: {
|
||||
"name": "LaTeX Source",
|
||||
"ext": "tex",
|
||||
"to": "latex"
|
||||
},
|
||||
2: {
|
||||
"name": "LaTeX PDF",
|
||||
"ext": "pdf",
|
||||
"to": "pdf"
|
||||
},
|
||||
3: {
|
||||
"name": "LaTeX beamer slide show Source .tex",
|
||||
"ext": "tex",
|
||||
"to": "beamer"
|
||||
},
|
||||
4: {
|
||||
"name": "LaTeX beamer slide show PDF",
|
||||
"ext": "pdf",
|
||||
"to": "beamer"
|
||||
},
|
||||
5: {
|
||||
"name": "HTML",
|
||||
"ext": "html",
|
||||
"to": "html"
|
||||
},
|
||||
6: {
|
||||
"name": "Textile",
|
||||
"ext": "txt",
|
||||
"to": "textile"
|
||||
},
|
||||
7: {
|
||||
"name": "OpenOffice text document",
|
||||
"ext": "odt",
|
||||
"to": "odt"
|
||||
},
|
||||
8: {
|
||||
"name": "Word docx",
|
||||
"ext": "docx",
|
||||
"to": "docx"
|
||||
},
|
||||
9: {
|
||||
"name": "reStructuredText txt",
|
||||
"ext": "txt",
|
||||
"to": "rst"
|
||||
},
|
||||
10: {
|
||||
"name": "ConTeXt tex",
|
||||
"ext": "tex",
|
||||
"to": "context"
|
||||
},
|
||||
11: {
|
||||
"name": "groff man",
|
||||
"ext": "man",
|
||||
"to": "man"
|
||||
},
|
||||
12: {
|
||||
"name": "MediaWiki markup",
|
||||
"ext": "txt",
|
||||
"to": "mediawiki"
|
||||
},
|
||||
13: {
|
||||
"name": "OpenDocument XML",
|
||||
"ext": "xml",
|
||||
"to": "opendocument"
|
||||
},
|
||||
14: {
|
||||
"name": "OpenDocument XML",
|
||||
"ext": "texi",
|
||||
"to": "texinfo"
|
||||
},
|
||||
15: {
|
||||
"name": "Slidy HTML and javascript slide show",
|
||||
"ext": "html",
|
||||
"to": "slidy"
|
||||
},
|
||||
16: {
|
||||
"name": "Slideous HTML and javascript slide show",
|
||||
"ext": "html",
|
||||
"to": "slideous"
|
||||
},
|
||||
17: {
|
||||
"name": "HTML5 + javascript slide show",
|
||||
"ext": "html",
|
||||
"to": "dzslides"
|
||||
},
|
||||
18: {
|
||||
"name": "S5 HTML and javascript slide show",
|
||||
"ext": "html",
|
||||
"to": "s5"
|
||||
},
|
||||
19: {
|
||||
"name": "EPub electronic publication",
|
||||
"ext": "epub",
|
||||
"to": "epub"
|
||||
},
|
||||
20: {
|
||||
"name": "RTF Rich Text Format",
|
||||
"ext": "rtf",
|
||||
"to": "rtf"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def advanced_export(self, text = ""):
|
||||
tree_iter = self.format_field.get_active_iter()
|
||||
if tree_iter != None:
|
||||
model = self.format_field.get_model()
|
||||
row_id, name = model[tree_iter][:2]
|
||||
|
||||
fmt = self.formats_dict[row_id]
|
||||
logger.info(fmt)
|
||||
filechooser = Gtk.FileChooserDialog(
|
||||
"Export as %s" % fmt["name"],
|
||||
self,
|
||||
Gtk.FileChooserAction.SAVE,
|
||||
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
||||
Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
|
||||
)
|
||||
|
||||
filechooser.set_do_overwrite_confirmation(True)
|
||||
|
||||
response = filechooser.run()
|
||||
if response == Gtk.ResponseType.OK:
|
||||
filename = filechooser.get_filename()
|
||||
filechooser.destroy()
|
||||
else:
|
||||
filechooser.destroy()
|
||||
return
|
||||
|
||||
output_dir = os.path.abspath(os.path.join(filename, os.path.pardir))
|
||||
|
||||
basename = os.path.basename(filename)
|
||||
|
||||
args = ['pandoc', '--from=markdown']
|
||||
|
||||
to = "--to=%s" % fmt["to"]
|
||||
|
||||
if basename.endswith("." + fmt["ext"]):
|
||||
output_file = "--output=%s" % basename
|
||||
else:
|
||||
output_file = "--output=%s.%s" % (basename, fmt["ext"])
|
||||
|
||||
if self.builder.get_object("toc").get_active():
|
||||
args.append('--toc')
|
||||
if self.builder.get_object("normalize").get_active():
|
||||
args.append('--normalize')
|
||||
if self.builder.get_object("smart").get_active():
|
||||
args.append('--smart')
|
||||
|
||||
if self.builder.get_object("highlight").get_active == False:
|
||||
args.append('--no-highlight')
|
||||
else:
|
||||
hs = self.builder.get_object("highlight_style").get_active_text()
|
||||
args.append("--highlight-style=%s" % hs)
|
||||
|
||||
if self.builder.get_object("standalone").get_active():
|
||||
args.append("--standalone")
|
||||
|
||||
if self.builder.get_object("number_sections").get_active():
|
||||
args.append("--number-sections")
|
||||
|
||||
if self.builder.get_object("strict").get_active():
|
||||
args.append("--strict")
|
||||
|
||||
if self.builder.get_object("incremental").get_active():
|
||||
args.append("--incremental")
|
||||
|
||||
if self.builder.get_object("self_contained").get_active():
|
||||
args.append("--self-contained")
|
||||
|
||||
if self.builder.get_object("html5").get_active():
|
||||
if fmt["to"] == "html":
|
||||
to = "--to=%s" % "html5"
|
||||
|
||||
# Pandoc can't handle verbose -t pdf (#571)
|
||||
|
||||
if fmt["to"] != "pdf":
|
||||
args.append(to)
|
||||
|
||||
css_uri = self.builder.get_object("css_filechooser").get_uri()
|
||||
if css_uri:
|
||||
if css_uri.startswith("file://"):
|
||||
css_uri = css_uri[7:]
|
||||
args.append("--css=%s" % css_uri)
|
||||
|
||||
bib_uri = self.builder.get_object("bib_filechooser").get_uri()
|
||||
if bib_uri:
|
||||
if bib_uri.startswith("file://"):
|
||||
bib_uri = bib_uri[7:]
|
||||
args.append("--bibliography=%s" % bib_uri)
|
||||
|
||||
|
||||
args.append(output_file)
|
||||
|
||||
logger.info(args)
|
||||
|
||||
p = subprocess.Popen(args, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE, cwd=output_dir)
|
||||
|
||||
output = p.communicate(text)[0]
|
||||
|
||||
return filename
|
|
@ -0,0 +1,288 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
import re
|
||||
import http.client
|
||||
import urllib
|
||||
from urllib.error import URLError, HTTPError
|
||||
import webbrowser
|
||||
import locale
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import threading
|
||||
|
||||
from gi.repository import Gtk, Gdk, GdkPixbuf, GObject
|
||||
from uberwriter_lib import LatexToPNG
|
||||
|
||||
from .FixTable import FixTable
|
||||
|
||||
from .MarkupBuffer import MarkupBuffer
|
||||
|
||||
from locale import gettext as _
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter')
|
||||
|
||||
GObject.threads_init() # Still needed?
|
||||
|
||||
# TODO:
|
||||
# - Don't insert a span with id, it breaks the text to often
|
||||
# Would be better to search for the nearest title and generate
|
||||
# A jumping URL from that (for preview)
|
||||
# Also, after going to preview, set cursor back to where it was
|
||||
|
||||
def check_url(url, item, spinner):
|
||||
logger.debug("thread started, checking url")
|
||||
error = False
|
||||
try:
|
||||
response = urllib.request.urlopen(url)
|
||||
except URLError as e:
|
||||
error = True
|
||||
text = "Error! Reason: %s" % e.reason
|
||||
|
||||
if not error:
|
||||
if (response.code / 100) >= 4:
|
||||
logger.debug("Website not available")
|
||||
text = _("Website is not available")
|
||||
else:
|
||||
text = _("Website is available")
|
||||
logger.debug("Response: %s" % text)
|
||||
spinner.destroy()
|
||||
item.set_label(text)
|
||||
|
||||
|
||||
def get_web_thumbnail(url, item, spinner):
|
||||
logger.debug("thread started, generating thumb")
|
||||
|
||||
# error = False
|
||||
|
||||
filename = tempfile.mktemp(suffix='.png')
|
||||
thumb_size = '256' # size can only be 32, 64, 96, 128 or 256!
|
||||
args = ['gnome-web-photo', '--mode=thumbnail', '-s', thumb_size, url, filename]
|
||||
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
output = p.communicate()[0]
|
||||
|
||||
image = Gtk.Image.new_from_file(filename)
|
||||
image.show()
|
||||
|
||||
# if not error:
|
||||
# if (response.code / 100) >= 4:
|
||||
# logger.debug("Website not available")
|
||||
# text = _("Website is not available")
|
||||
# else:
|
||||
# text = _("Website is available")
|
||||
|
||||
spinner.destroy()
|
||||
item.add(image)
|
||||
item.show()
|
||||
|
||||
|
||||
class UberwriterInlinePreview():
|
||||
|
||||
def __init__(self, view, text_buffer):
|
||||
self.TextView = view
|
||||
self.TextBuffer = text_buffer
|
||||
self.LatexConverter = LatexToPNG.LatexToPNG()
|
||||
cursor_mark = self.TextBuffer.get_insert()
|
||||
cursor_iter = self.TextBuffer.get_iter_at_mark(cursor_mark)
|
||||
self.ClickMark = self.TextBuffer.create_mark('click', cursor_iter)
|
||||
# Events for popup menu
|
||||
self.TextView.connect_after('populate-popup', self.populate_popup)
|
||||
self.TextView.connect_after('popup-menu', self.move_popup)
|
||||
self.TextView.connect('button-press-event', self.click_move_button)
|
||||
|
||||
def click_move_button(self, widget, event):
|
||||
if event.button == 3:
|
||||
x, y = self.TextView.window_to_buffer_coords(2,
|
||||
int(event.x),
|
||||
int(event.y))
|
||||
self.TextBuffer.move_mark(self.ClickMark,
|
||||
self.TextView.get_iter_at_location(x, y))
|
||||
|
||||
def fix_table(self, widget, data=None):
|
||||
logger.debug('fixing that table')
|
||||
f = FixTable(self.TextBuffer)
|
||||
f.fix_table()
|
||||
|
||||
def populate_popup(self, editor, menu, data=None):
|
||||
|
||||
item = Gtk.MenuItem.new()
|
||||
item.set_name("PreviewMenuItem")
|
||||
separator = Gtk.SeparatorMenuItem.new()
|
||||
|
||||
table_item = Gtk.MenuItem.new()
|
||||
table_item.set_label('Fix that table')
|
||||
|
||||
table_item.connect('activate', self.fix_table)
|
||||
table_item.show()
|
||||
menu.prepend(table_item)
|
||||
menu.show()
|
||||
|
||||
start_iter = self.TextBuffer.get_iter_at_mark(self.ClickMark)
|
||||
# Line offset of click mark
|
||||
line_offset = start_iter.get_line_offset()
|
||||
end_iter = start_iter.copy()
|
||||
start_iter.set_line_offset(0)
|
||||
end_iter.forward_to_line_end()
|
||||
|
||||
text = self.TextBuffer.get_text(start_iter, end_iter, False)
|
||||
|
||||
math = MarkupBuffer.regex["MATH"]
|
||||
link = MarkupBuffer.regex["LINK"]
|
||||
|
||||
footnote = re.compile('\[\^([^\s]+?)\]')
|
||||
image = re.compile("!\[(.+?)\]\((.+?)\)")
|
||||
|
||||
buf = self.TextBuffer
|
||||
context_offset = 0
|
||||
|
||||
matchlist = []
|
||||
|
||||
found_match = False
|
||||
|
||||
matches = re.finditer(math, text)
|
||||
for match in matches:
|
||||
logger.debug(match.group(1))
|
||||
if match.start() < line_offset and match.end() > line_offset:
|
||||
success, result = self.LatexConverter.generatepng(match.group(1))
|
||||
if success:
|
||||
image = Gtk.Image.new_from_file(result)
|
||||
image.show()
|
||||
item.add(image)
|
||||
item.set_property('width-request', 50)
|
||||
else:
|
||||
label = Gtk.Label()
|
||||
msg = 'Formula looks incorrect:\n' + result
|
||||
label.set_alignment(0.0, 0.5)
|
||||
label.set_text(msg)
|
||||
label.show()
|
||||
item.add(label)
|
||||
item.show()
|
||||
menu.prepend(separator)
|
||||
separator.show()
|
||||
menu.prepend(item)
|
||||
menu.show()
|
||||
found_match = True
|
||||
break
|
||||
|
||||
if not found_match:
|
||||
# Links
|
||||
matches = re.finditer(link, text)
|
||||
for match in matches:
|
||||
if match.start() < line_offset and match.end() > line_offset:
|
||||
text = text[text.find("http://"):-1]
|
||||
|
||||
item.connect("activate", lambda w: webbrowser.open(text))
|
||||
|
||||
logger.debug(text)
|
||||
|
||||
statusitem = Gtk.MenuItem.new()
|
||||
statusitem.show()
|
||||
|
||||
spinner = Gtk.Spinner.new()
|
||||
spinner.start()
|
||||
statusitem.add(spinner)
|
||||
spinner.show()
|
||||
|
||||
thread = threading.Thread(target=check_url,
|
||||
args=(text, statusitem, spinner))
|
||||
thread.start()
|
||||
|
||||
webphoto_item = Gtk.MenuItem.new()
|
||||
webphoto_item.show()
|
||||
spinner_2 = Gtk.Spinner.new()
|
||||
spinner_2.start()
|
||||
webphoto_item.add(spinner_2)
|
||||
spinner_2.show()
|
||||
|
||||
thread_image = threading.Thread(target=get_web_thumbnail,
|
||||
args=(text, webphoto_item, spinner_2))
|
||||
|
||||
thread_image.start()
|
||||
|
||||
item.set_label(_("Open Link in Webbrowser"))
|
||||
item.show()
|
||||
|
||||
menu.prepend(separator)
|
||||
separator.show()
|
||||
|
||||
menu.prepend(webphoto_item)
|
||||
menu.prepend(statusitem)
|
||||
menu.prepend(item)
|
||||
menu.show()
|
||||
|
||||
|
||||
found_match = True
|
||||
break
|
||||
|
||||
if not found_match:
|
||||
matches = re.finditer(image, text)
|
||||
for match in matches:
|
||||
if match.start() < line_offset and match.end() > line_offset:
|
||||
path = match.group(2)
|
||||
if path.startswith("file://"):
|
||||
path = path[7:]
|
||||
logger.info(path)
|
||||
pb = GdkPixbuf.Pixbuf.new_from_file_at_size(path, 400, 300)
|
||||
image = Gtk.Image.new_from_pixbuf(pb)
|
||||
image.show()
|
||||
item.add(image)
|
||||
item.set_property('width-request', 50)
|
||||
item.show()
|
||||
menu.prepend(separator)
|
||||
separator.show()
|
||||
menu.prepend(item)
|
||||
menu.show()
|
||||
found_match = True
|
||||
break
|
||||
|
||||
if not found_match:
|
||||
matches = re.finditer(footnote, text)
|
||||
for match in matches:
|
||||
if match.start() < line_offset and match.end() > line_offset:
|
||||
logger.debug(match.group(1))
|
||||
footnote_match = re.compile("\[\^" + match.group(1) + "\]: (.+(?:\n|\Z)(?:^[\t].+(?:\n|\Z))*)", re.MULTILINE)
|
||||
replace = re.compile("^\t", re.MULTILINE)
|
||||
start, end = self.TextBuffer.get_bounds()
|
||||
fn_match = re.search(footnote_match, self.TextBuffer.get_text(start, end, False))
|
||||
label = Gtk.Label()
|
||||
label.set_alignment(0.0, 0.5)
|
||||
logger.debug(fn_match)
|
||||
if fn_match:
|
||||
result = re.sub(replace, "", fn_match.group(1))
|
||||
if result.endswith("\n"):
|
||||
result = result[:-1]
|
||||
else:
|
||||
result = _("No matching footnote found")
|
||||
label.set_max_width_chars(40)
|
||||
label.set_line_wrap(True)
|
||||
label.set_text(result)
|
||||
label.show()
|
||||
item.add(label)
|
||||
item.show()
|
||||
|
||||
menu.prepend(separator)
|
||||
separator.show()
|
||||
menu.prepend(item)
|
||||
menu.show()
|
||||
found_match = True
|
||||
break
|
||||
return
|
||||
|
||||
def move_popup(self):
|
||||
pass
|
|
@ -0,0 +1,150 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
import os, re
|
||||
import subprocess
|
||||
from gi.repository import Gtk, Gdk
|
||||
import time
|
||||
# from plugins import plugins
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter')
|
||||
|
||||
class UberwriterSearchAndReplace():
|
||||
"""
|
||||
Adds (regex) search and replace functionality to
|
||||
uberwriter
|
||||
"""
|
||||
def __init__(self, parentwindow):
|
||||
self.parentwindow = parentwindow
|
||||
self.box = parentwindow.builder.get_object("searchreplaceholder")
|
||||
self.searchentry = parentwindow.builder.get_object("searchentrybox")
|
||||
self.searchentry.connect('changed', self.search)
|
||||
self.searchentry.connect('activate', self.scrolltonext)
|
||||
|
||||
self.open_replace_button = parentwindow.builder.get_object("replace")
|
||||
self.open_replace_button.connect("toggled", self.toggle_replace)
|
||||
|
||||
self.textbuffer = parentwindow.TextBuffer
|
||||
self.texteditor = parentwindow.TextEditor
|
||||
|
||||
self.nextbutton = parentwindow.builder.get_object("next_result")
|
||||
self.prevbutton = parentwindow.builder.get_object("previous_result")
|
||||
self.regexbutton = parentwindow.builder.get_object("regex")
|
||||
self.casesensitivebutton = parentwindow.builder.get_object("case_sensitive")
|
||||
|
||||
self.replacebox = parentwindow.builder.get_object("replacebox")
|
||||
self.replacebox.hide()
|
||||
self.replace_one_button = parentwindow.builder.get_object("replace_one")
|
||||
self.replace_all_button = parentwindow.builder.get_object("replace_all")
|
||||
self.replaceentry = parentwindow.builder.get_object("replaceentrybox")
|
||||
|
||||
self.replace_all_button.connect('clicked', self.replace_all)
|
||||
self.replace_one_button.connect('clicked', self.replace_clicked)
|
||||
self.replaceentry.connect('activate', self.replace_clicked)
|
||||
|
||||
self.nextbutton.connect('clicked', self.scrolltonext)
|
||||
self.prevbutton.connect('clicked', self.scrolltoprev)
|
||||
self.regexbutton.connect('toggled', self.search)
|
||||
self.casesensitivebutton.connect('toggled', self.search)
|
||||
self.highlight = self.textbuffer.create_tag('search_highlight',
|
||||
background="yellow")
|
||||
|
||||
def toggle_replace(self, widget, data=None):
|
||||
if widget.get_active():
|
||||
self.replacebox.show_all()
|
||||
else:
|
||||
self.replacebox.hide()
|
||||
|
||||
def toggle_search(self, widget=None, data=None):
|
||||
"""
|
||||
show search box
|
||||
"""
|
||||
if self.box.get_visible():
|
||||
self.box.hide()
|
||||
else:
|
||||
self.box.show()
|
||||
|
||||
def search(self, widget=None, data=None, scroll=True):
|
||||
searchtext = self.searchentry.get_text()
|
||||
buf = self.textbuffer
|
||||
context_start = buf.get_start_iter()
|
||||
context_end = buf.get_end_iter()
|
||||
text = buf.get_slice(context_start, context_end, False)
|
||||
|
||||
self.textbuffer.remove_tag(self.highlight, context_start, context_end)
|
||||
|
||||
# case sensitive?
|
||||
flags = False
|
||||
if not self.casesensitivebutton.get_active():
|
||||
flags = flags | re.I
|
||||
|
||||
# regex?
|
||||
if not self.regexbutton.get_active():
|
||||
searchtext = re.escape(searchtext)
|
||||
|
||||
matches = re.finditer(searchtext, text, flags)
|
||||
|
||||
self.matchiters = []
|
||||
self.active = 0
|
||||
for match in matches:
|
||||
startIter = buf.get_iter_at_offset(match.start())
|
||||
endIter = buf.get_iter_at_offset(match.end())
|
||||
self.matchiters.append((startIter, endIter))
|
||||
self.textbuffer.apply_tag(self.highlight, startIter, endIter)
|
||||
if scroll:
|
||||
self.scrollto(self.active)
|
||||
logger.debug(searchtext)
|
||||
|
||||
def scrolltonext(self, widget, data=None):
|
||||
self.scrollto(self.active + 1)
|
||||
|
||||
def scrolltoprev(self, widget, data=None):
|
||||
self.scrollto(self.active - 1)
|
||||
|
||||
def scrollto(self, index):
|
||||
if not len(self.matchiters):
|
||||
return
|
||||
if(index < len(self.matchiters)):
|
||||
self.active = index
|
||||
else:
|
||||
self.active = 0
|
||||
|
||||
matchiter = self.matchiters[self.active]
|
||||
self.texteditor.scroll_to_iter(matchiter[0], 0.0, True, 0.0, 0.5)
|
||||
|
||||
def hide(self):
|
||||
self.box.hide()
|
||||
|
||||
def replace_clicked(self, widget, data=None):
|
||||
self.replace(self.active)
|
||||
|
||||
def replace_all(self, widget=None, data=None):
|
||||
while self.matchiters:
|
||||
match = self.matchiters[0]
|
||||
self.textbuffer.delete(match[0], match[1])
|
||||
self.textbuffer.insert(match[0], self.replaceentry.get_text())
|
||||
self.search(scroll=False)
|
||||
|
||||
def replace(self, searchindex, inloop=False):
|
||||
match = self.matchiters[searchindex]
|
||||
self.textbuffer.delete(match[0], match[1])
|
||||
self.textbuffer.insert(match[0], self.replaceentry.get_text())
|
||||
active = self.active
|
||||
self.search(scroll=False)
|
||||
self.active = active
|
||||
self.parentwindow.MarkupBuffer.markup_buffer()
|
||||
self.scrollto(self.active)
|
|
@ -0,0 +1,176 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from gi.repository import Gtk, Gdk
|
||||
|
||||
# from plugins import plugins
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter')
|
||||
|
||||
class Shelve():
|
||||
"""
|
||||
Shelve holds a collection of folders
|
||||
folders:
|
||||
List of folders
|
||||
name:
|
||||
descriptive name of shelve e.g. blog, notes etc.
|
||||
"""
|
||||
|
||||
name = ""
|
||||
folders = []
|
||||
|
||||
def __init__(self, name, folders):
|
||||
self.name = name
|
||||
self.folders = folders
|
||||
|
||||
def get_tree(self, store):
|
||||
node = {}
|
||||
for folder in self.folders:
|
||||
node[folder] = store.append(None, [os.path.basename(folder), folder])
|
||||
for root, dirs, files in os.walk(folder):
|
||||
logger.debug(root)
|
||||
for directory in dirs:
|
||||
node[root + "/" + directory] = store.append(node[root], [directory, root + "/" + directory])
|
||||
for filename in files:
|
||||
store.append(node[root], [filename, root + "/" + filename])
|
||||
|
||||
|
||||
class UberwriterSidebar():
|
||||
"""
|
||||
Presentational class for shelves and files managed by the "sidebar"
|
||||
|
||||
parentwindow:
|
||||
Reference to UberwriterWindow
|
||||
"""
|
||||
def __init__(self, parentwindow):
|
||||
"""
|
||||
Initialize Treeview and Treestore
|
||||
"""
|
||||
|
||||
self.parentwindow = parentwindow
|
||||
self.paned_window = parentwindow.paned_window
|
||||
self.sidebar_box = parentwindow.sidebar_box
|
||||
|
||||
# (GtkBox *box,
|
||||
# GtkWidget *child,
|
||||
# gboolean expand,
|
||||
# gboolean fill,
|
||||
# guint padding);
|
||||
|
||||
self.shelve_store = Gtk.ListStore(str)
|
||||
self.shelve_store.append(["testshelve"])
|
||||
self.shelves_dropdown = Gtk.ComboBox.new_with_model_and_entry(self.shelve_store)
|
||||
|
||||
self.sidebar_box.pack_start(self.shelves_dropdown, False, False, 5)
|
||||
|
||||
self.sidebar_scrolledwindow = Gtk.ScrolledWindow()
|
||||
self.sidebar_scrolledwindow.set_hexpand(True)
|
||||
self.sidebar_scrolledwindow.set_vexpand(True)
|
||||
|
||||
self.store = Gtk.TreeStore(str, str)
|
||||
self.active_shelf = Shelve("testshelve", ["/home/wolf/Documents/Texte"])
|
||||
self.active_shelf.get_tree(self.store)
|
||||
|
||||
self.treeview = Gtk.TreeView(self.store)
|
||||
self.treeview.set_headers_visible(False)
|
||||
# expand first folder (root folder, but not children)
|
||||
self.treeview.expand_row(Gtk.TreePath.new_from_string("0"), False)
|
||||
|
||||
renderer = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn("Title", renderer, text=0)
|
||||
self.treeview.append_column(column)
|
||||
# new selection
|
||||
self.treeview.connect('cursor_changed', self.get_selected_file)
|
||||
# right click handler
|
||||
self.treeview.connect('button-press-event', self.handle_button_press)
|
||||
self.treeview.show()
|
||||
|
||||
self.sidebar_scrolledwindow.add(self.treeview)
|
||||
self.sidebar_box.pack_start(self.sidebar_scrolledwindow, True, True, 5)
|
||||
|
||||
self.menu_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
|
||||
self.menu_button = Gtk.MenuButton.new()
|
||||
|
||||
# TODO refactor
|
||||
mb_menu = Gtk.Menu.new()
|
||||
mitem = Gtk.MenuItem.new_with_label('etstasd asd as d')
|
||||
mitem.show()
|
||||
mb_menu.append(mitem)
|
||||
mb_menu.show()
|
||||
|
||||
self.menu_button.set_popup(mb_menu)
|
||||
|
||||
self.menu_box.pack_start(self.menu_button, False, False, 5)
|
||||
self.sidebar_box.pack_end(self.menu_box, False, False, 5)
|
||||
|
||||
self.sidebar_box.show_all()
|
||||
self.paned_window.pack1(self.sidebar_box, True, True);
|
||||
self.paned_window.show_all()
|
||||
|
||||
|
||||
def get_selected_file(self, widget, data=None):
|
||||
"""
|
||||
Handle left click on file
|
||||
"""
|
||||
selection = self.treeview.get_selection()
|
||||
if not selection:
|
||||
return
|
||||
selection.set_mode(Gtk.SelectionMode.SINGLE)
|
||||
treemodel, treeiter = selection.get_selected()
|
||||
selected_file = treemodel.get_value(treeiter, 1)
|
||||
self.parentwindow.load_file(selected_file)
|
||||
logger.debug(selected_file)
|
||||
|
||||
def handle_button_press(self, widget, event):
|
||||
"""
|
||||
Handle right click (context menu)
|
||||
"""
|
||||
if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3:
|
||||
# reference to self to not have it garbage collected
|
||||
self.popup = Gtk.Menu.new()
|
||||
pathinfo = self.treeview.get_path_at_pos(event.x, event.y)
|
||||
if pathinfo:
|
||||
path, col, cellx, celly = pathinfo
|
||||
treeiter = self.store.get_iter(path)
|
||||
filename = self.store.get_value(treeiter, 1)
|
||||
item = Gtk.MenuItem.new()
|
||||
item.set_label("Open ...")
|
||||
item.connect("activate", self.context_menu_open_file)
|
||||
item.filename = filename
|
||||
item.show()
|
||||
self.popup.append(item)
|
||||
self.popup.show()
|
||||
self.popup.popup(None, None, None, None, event.button, event.time)
|
||||
return True
|
||||
|
||||
def get_treeview(self):
|
||||
"""
|
||||
Return Treeview to append to scrolled window
|
||||
"""
|
||||
return self.treeview
|
||||
|
||||
def context_menu_open_file(self, widget, data=None):
|
||||
"""
|
||||
Open selected file with xdg-open
|
||||
"""
|
||||
selected_file = widget.filename
|
||||
subprocess.call(["xdg-open", selected_file])
|
||||
|
||||
def close_sidebar(self):
|
||||
pass
|
|
@ -0,0 +1,440 @@
|
|||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
"""Module for the TextView widgth wich encapsulates management of TextBuffer
|
||||
and TextIter for common functionality, such as cut, copy, paste, undo, redo,
|
||||
and highlighting of text.
|
||||
|
||||
Using
|
||||
#create the TextEditor and set the text
|
||||
editor = TextEditor()
|
||||
editor.text = "Text to add to the editor"
|
||||
|
||||
#use cut, works the same for copy, paste, undo, and redo
|
||||
def __handle_on_cut(self, widget, data=None):
|
||||
self.editor.cut()
|
||||
|
||||
#add string to highlight
|
||||
self.editor.add_highlight("Ubuntu")
|
||||
self.editor.add_highlight("Quickly")
|
||||
|
||||
#remove highlights
|
||||
self.editor.clear_highlight("Ubuntu")
|
||||
self.editor.clear_all_highlight()
|
||||
|
||||
Configuring
|
||||
#Configure as a TextView
|
||||
self.editor.set_wrap_mode(Gtk.WRAP_CHAR)
|
||||
|
||||
#Access the Gtk.TextBuffer if needed
|
||||
buffer = self.editor.get_buffer()
|
||||
|
||||
Extending
|
||||
A TextEditor is Gtk.TextView
|
||||
|
||||
"""
|
||||
|
||||
|
||||
try:
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
|
||||
except:
|
||||
print("couldn't load depencies")
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter')
|
||||
|
||||
|
||||
class UndoableInsert(object):
|
||||
"""something that has been inserted into our textbuffer"""
|
||||
def __init__(self, text_iter, text, length, fflines):
|
||||
self.offset = text_iter.get_offset() - fflines
|
||||
self.text = text
|
||||
self.length = length
|
||||
if self.length > 1 or self.text in ("\r", "\n", " "):
|
||||
self.mergeable = False
|
||||
else:
|
||||
self.mergeable = True
|
||||
|
||||
|
||||
class UndoableDelete(object):
|
||||
"""something that has ben deleted from our textbuffer"""
|
||||
def __init__(self, text_buffer, start_iter, end_iter, fflines):
|
||||
self.text = text_buffer.get_text(start_iter, end_iter, False)
|
||||
self.start = start_iter.get_offset() - fflines
|
||||
self.end = end_iter.get_offset() - fflines
|
||||
# need to find out if backspace or delete key has been used
|
||||
# so we don't mess up during redo
|
||||
insert_iter = text_buffer.get_iter_at_mark(text_buffer.get_insert())
|
||||
if insert_iter.get_offset() <= self.start:
|
||||
self.delete_key_used = True
|
||||
else:
|
||||
self.delete_key_used = False
|
||||
if self.end - self.start > 1 or self.text in ("\r", "\n", " "):
|
||||
self.mergeable = False
|
||||
else:
|
||||
self.mergeable = True
|
||||
|
||||
|
||||
class TextEditor(Gtk.TextView):
|
||||
"""TextEditor encapsulates management of TextBuffer and TextIter for
|
||||
common functionality, such as cut, copy, paste, undo, redo, and
|
||||
highlighting of text.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""Create a TextEditor
|
||||
|
||||
"""
|
||||
|
||||
Gtk.TextView.__init__(self)
|
||||
self.undo_max = None
|
||||
|
||||
self.insert_event = self.get_buffer().connect("insert-text", self.on_insert_text)
|
||||
self.delete_event = self.get_buffer().connect("delete-range", self.on_delete_range)
|
||||
display = self.get_display()
|
||||
self.clipboard = Gtk.Clipboard.get_for_display(display, Gdk.SELECTION_CLIPBOARD)
|
||||
|
||||
self.fflines = 0
|
||||
|
||||
self.undo_stack = []
|
||||
self.redo_stack = []
|
||||
self.not_undoable_action = False
|
||||
self.undo_in_progress = False
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
"""
|
||||
text - a string specifying all the text currently
|
||||
in the TextEditor's buffer.
|
||||
|
||||
This property is read/write.
|
||||
"""
|
||||
start_iter = self.get_buffer().get_iter_at_offset(0)
|
||||
end_iter = self.get_buffer().get_iter_at_offset(-1)
|
||||
return self.get_buffer().get_text(start_iter, end_iter, False)
|
||||
|
||||
@property
|
||||
def can_undo(self):
|
||||
return bool(self.undo_stack)
|
||||
|
||||
@property
|
||||
def can_redo(self):
|
||||
return bool(self.redo_stack)
|
||||
|
||||
|
||||
@text.setter
|
||||
def text(self, text):
|
||||
self.get_buffer().set_text(text)
|
||||
|
||||
def append(self, text):
|
||||
"""append: appends text to the end of the textbuffer.
|
||||
|
||||
arguments:
|
||||
text - a string to add to the buffer. The text will be the
|
||||
last text in the buffer. The insertion cursor will not be moved.
|
||||
|
||||
"""
|
||||
|
||||
end_iter = self.get_buffer().get_iter_at_offset(-1)
|
||||
self.get_buffer().insert(end_iter, text)
|
||||
|
||||
def prepend(self, text):
|
||||
"""prepend: appends text to the start of the textbuffer.
|
||||
|
||||
arguments:
|
||||
text - a string to add to the buffer. The text will be the
|
||||
first text in the buffer. The insertion cursor will not be moved.
|
||||
|
||||
"""
|
||||
|
||||
start_iter = self.get_buffer().get_iter_at_offset(0)
|
||||
self.get_buffer().insert(start_iter, text)
|
||||
insert_iter = self.get_buffer().get_iter_at_offset(len(text)-1)
|
||||
self.get_buffer().place_cursor(insert_iter)
|
||||
|
||||
def cursor_to_end(self):
|
||||
"""cursor_to_end: moves the insertion curson to the last position
|
||||
in the buffer.
|
||||
|
||||
"""
|
||||
|
||||
end_iter = self.get_buffer().get_iter_at_offset(-1)
|
||||
self.get_buffer().place_cursor(end_iter)
|
||||
|
||||
def cursor_to_start(self):
|
||||
"""cursor_to_start: moves the insertion curson to the first position
|
||||
in the buffer.
|
||||
|
||||
"""
|
||||
|
||||
start_iter = self.get_buffer().get_iter_at_offset(0)
|
||||
self.get_buffer().place_cursor(start_iter)
|
||||
|
||||
def cut(self, widget=None, data=None):
|
||||
"""cut: cut currently selected text and put it on the clipboard.
|
||||
This function can be called as a function, or assigned as a signal
|
||||
handler.
|
||||
|
||||
"""
|
||||
|
||||
self.get_buffer().cut_clipboard(self.clipboard, True)
|
||||
|
||||
def copy(self, widget=None, data=None):
|
||||
"""copy: copy currently selected text to the clipboard.
|
||||
This function can be called as a function, or assigned as a signal
|
||||
handler.
|
||||
|
||||
"""
|
||||
|
||||
self.get_buffer().copy_clipboard(self.clipboard)
|
||||
|
||||
def paste(self, widget=None, data=None):
|
||||
"""paste: Insert any text currently on the clipboard into the
|
||||
buffer.
|
||||
This function can be called as a function, or assigned as a signal
|
||||
handler.
|
||||
|
||||
"""
|
||||
|
||||
self.get_buffer().paste_clipboard(self.clipboard,None,True)
|
||||
|
||||
def undo(self, widget=None, data=None):
|
||||
"""undo inserts or deletions
|
||||
undone actions are being moved to redo stack"""
|
||||
if not self.undo_stack:
|
||||
return
|
||||
self.begin_not_undoable_action()
|
||||
self.undo_in_progress = True
|
||||
undo_action = self.undo_stack.pop()
|
||||
self.redo_stack.append(undo_action)
|
||||
buf = self.get_buffer()
|
||||
if isinstance(undo_action, UndoableInsert):
|
||||
offset = undo_action.offset + self.fflines
|
||||
start = buf.get_iter_at_offset(offset)
|
||||
stop = buf.get_iter_at_offset(
|
||||
offset + undo_action.length
|
||||
)
|
||||
buf.delete(start, stop)
|
||||
buf.place_cursor(start)
|
||||
else:
|
||||
start = buf.get_iter_at_offset(undo_action.start + self.fflines)
|
||||
buf.insert(start, undo_action.text)
|
||||
if undo_action.delete_key_used:
|
||||
buf.place_cursor(start)
|
||||
else:
|
||||
stop = buf.get_iter_at_offset(undo_action.end + self.fflines)
|
||||
buf.place_cursor(stop)
|
||||
self.end_not_undoable_action()
|
||||
self.undo_in_progress = False
|
||||
|
||||
def redo(self, widget=None, data=None):
|
||||
"""redo inserts or deletions
|
||||
|
||||
redone actions are moved to undo stack"""
|
||||
if not self.redo_stack:
|
||||
return
|
||||
self.begin_not_undoable_action()
|
||||
self.undo_in_progress = True
|
||||
redo_action = self.redo_stack.pop()
|
||||
self.undo_stack.append(redo_action)
|
||||
buf = self.get_buffer()
|
||||
if isinstance(redo_action, UndoableInsert):
|
||||
start = buf.get_iter_at_offset(redo_action.offset)
|
||||
buf.insert(start, redo_action.text)
|
||||
new_cursor_pos = buf.get_iter_at_offset(
|
||||
redo_action.offset + redo_action.length
|
||||
)
|
||||
buf.place_cursor(new_cursor_pos)
|
||||
else:
|
||||
start = buf.get_iter_at_offset(redo_action.start)
|
||||
stop = buf.get_iter_at_offset(redo_action.end)
|
||||
buf.delete(start, stop)
|
||||
buf.place_cursor(start)
|
||||
self.end_not_undoable_action()
|
||||
self.undo_in_progress = False
|
||||
|
||||
def on_insert_text(self, textbuffer, text_iter, text, length):
|
||||
"""
|
||||
_on_insert: internal function to handle programatically inserted
|
||||
text. Do not call directly.
|
||||
"""
|
||||
def can_be_merged(prev, cur):
|
||||
"""see if we can merge multiple inserts here
|
||||
|
||||
will try to merge words or whitespace
|
||||
can't merge if prev and cur are not mergeable in the first place
|
||||
can't merge when user set the input bar somewhere else
|
||||
can't merge across word boundaries"""
|
||||
WHITESPACE = (' ', '\t')
|
||||
if not cur.mergeable or not prev.mergeable:
|
||||
return False
|
||||
elif cur.offset != (prev.offset + prev.length):
|
||||
return False
|
||||
elif cur.text in WHITESPACE and not prev.text in WHITESPACE:
|
||||
return False
|
||||
elif prev.text in WHITESPACE and not cur.text in WHITESPACE:
|
||||
return False
|
||||
return True
|
||||
|
||||
if not self.undo_in_progress:
|
||||
self.redo_stack = []
|
||||
if self.not_undoable_action:
|
||||
return
|
||||
|
||||
logger.debug(text)
|
||||
logger.debug("b: %i, l: %i" % (length, len(text)))
|
||||
undo_action = UndoableInsert(text_iter, text, len(text), self.fflines)
|
||||
try:
|
||||
prev_insert = self.undo_stack.pop()
|
||||
except IndexError:
|
||||
self.undo_stack.append(undo_action)
|
||||
return
|
||||
if not isinstance(prev_insert, UndoableInsert):
|
||||
self.undo_stack.append(prev_insert)
|
||||
self.undo_stack.append(undo_action)
|
||||
return
|
||||
if can_be_merged(prev_insert, undo_action):
|
||||
prev_insert.length += undo_action.length
|
||||
prev_insert.text += undo_action.text
|
||||
self.undo_stack.append(prev_insert)
|
||||
else:
|
||||
self.undo_stack.append(prev_insert)
|
||||
self.undo_stack.append(undo_action)
|
||||
|
||||
def on_delete_range(self, text_buffer, start_iter, end_iter):
|
||||
"""
|
||||
On delete
|
||||
"""
|
||||
def can_be_merged(prev, cur):
|
||||
"""see if we can merge multiple deletions here
|
||||
|
||||
will try to merge words or whitespace
|
||||
can't merge if prev and cur are not mergeable in the first place
|
||||
can't merge if delete and backspace key were both used
|
||||
can't merge across word boundaries"""
|
||||
|
||||
WHITESPACE = (' ', '\t')
|
||||
if not cur.mergeable or not prev.mergeable:
|
||||
return False
|
||||
elif prev.delete_key_used != cur.delete_key_used:
|
||||
return False
|
||||
elif prev.start != cur.start and prev.start != cur.end:
|
||||
return False
|
||||
elif cur.text not in WHITESPACE and \
|
||||
prev.text in WHITESPACE:
|
||||
return False
|
||||
elif cur.text in WHITESPACE and \
|
||||
prev.text not in WHITESPACE:
|
||||
return False
|
||||
return True
|
||||
|
||||
if not self.undo_in_progress:
|
||||
self.redo_stack = []
|
||||
if self.not_undoable_action:
|
||||
return
|
||||
undo_action = UndoableDelete(text_buffer, start_iter, end_iter, self.fflines)
|
||||
try:
|
||||
prev_delete = self.undo_stack.pop()
|
||||
except IndexError:
|
||||
self.undo_stack.append(undo_action)
|
||||
return
|
||||
if not isinstance(prev_delete, UndoableDelete):
|
||||
self.undo_stack.append(prev_delete)
|
||||
self.undo_stack.append(undo_action)
|
||||
return
|
||||
if can_be_merged(prev_delete, undo_action):
|
||||
if prev_delete.start == undo_action.start: # delete key used
|
||||
prev_delete.text += undo_action.text
|
||||
prev_delete.end += (undo_action.end - undo_action.start)
|
||||
else: # Backspace used
|
||||
prev_delete.text = "%s%s" % (undo_action.text,
|
||||
prev_delete.text)
|
||||
prev_delete.start = undo_action.start
|
||||
self.undo_stack.append(prev_delete)
|
||||
else:
|
||||
self.undo_stack.append(prev_delete)
|
||||
self.undo_stack.append(undo_action)
|
||||
|
||||
def begin_not_undoable_action(self):
|
||||
"""don't record the next actions
|
||||
|
||||
toggles self.not_undoable_action"""
|
||||
self.not_undoable_action = True
|
||||
|
||||
def end_not_undoable_action(self):
|
||||
"""record next actions
|
||||
|
||||
toggles self.not_undoable_action"""
|
||||
self.not_undoable_action = False
|
||||
|
||||
class TestWindow(Gtk.Window):
|
||||
"""For testing and demonstrating AsycnTaskProgressBox.
|
||||
|
||||
"""
|
||||
def __init__(self):
|
||||
#create a window a VBox to hold the controls
|
||||
Gtk.Window.__init__(self)
|
||||
self.set_title("TextEditor Test Window")
|
||||
windowbox = Gtk.VBox(False, 2)
|
||||
windowbox.show()
|
||||
self.add(windowbox)
|
||||
self.editor = TextEditor()
|
||||
self.editor.show()
|
||||
windowbox.pack_end(self.editor, True, True, 0)
|
||||
self.set_size_request(200,200)
|
||||
self.show()
|
||||
self.maximize()
|
||||
|
||||
self.connect("destroy", Gtk.main_quit)
|
||||
self.editor.text = "this is some inserted text"
|
||||
self.editor.append("\nLine 3")
|
||||
self.editor.prepend("Line1\n")
|
||||
self.editor.cursor_to_end()
|
||||
self.editor.cursor_to_start()
|
||||
self.editor.undo_max = 100
|
||||
cut_button = Gtk.Button("Cut")
|
||||
cut_button.connect("clicked",self.editor.cut)
|
||||
cut_button.show()
|
||||
windowbox.pack_start(cut_button, False, False, 0)
|
||||
|
||||
copy_button = Gtk.Button("Copy")
|
||||
copy_button.connect("clicked",self.editor.copy)
|
||||
copy_button.show()
|
||||
windowbox.pack_start(copy_button, False, False, 0)
|
||||
|
||||
paste_button = Gtk.Button("Paste")
|
||||
paste_button.connect("clicked",self.editor.paste)
|
||||
paste_button.show()
|
||||
windowbox.pack_start(paste_button, False, False, 0)
|
||||
|
||||
undo_button = Gtk.Button("Undo")
|
||||
undo_button.connect("clicked",self.editor.undo)
|
||||
undo_button.show()
|
||||
windowbox.pack_start(undo_button, False, False, 0)
|
||||
|
||||
redo_button = Gtk.Button("Redo")
|
||||
redo_button.connect("clicked",self.editor.redo)
|
||||
redo_button.show()
|
||||
windowbox.pack_start(redo_button, False, False, 0)
|
||||
|
||||
print(self.editor.text)
|
||||
|
||||
|
||||
if __name__== "__main__":
|
||||
test = TestWindow()
|
||||
Gtk.main()
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
import optparse
|
||||
|
||||
import locale
|
||||
import os
|
||||
from locale import gettext as _
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
from gi.repository import Gtk # pylint: disable=E0611
|
||||
|
||||
from . import UberwriterWindow
|
||||
|
||||
from uberwriter_lib import set_up_logging, get_version
|
||||
|
||||
def parse_options():
|
||||
"""Support for command line options"""
|
||||
parser = optparse.OptionParser(version="%%prog %s" % get_version())
|
||||
parser.add_option(
|
||||
"-v", "--verbose", action="count", dest="verbose",
|
||||
help=_("Show debug messages (-vv debugs uberwriter_lib also)"))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
set_up_logging(options)
|
||||
|
||||
# print args
|
||||
|
||||
return options, args
|
||||
|
||||
def main():
|
||||
'constructor for your class instances'
|
||||
(options, args) = parse_options()
|
||||
|
||||
# Run the application.
|
||||
if args:
|
||||
for arg in args:
|
||||
window = UberwriterWindow.UberwriterWindow()
|
||||
window.load_file(arg)
|
||||
else:
|
||||
window = UberwriterWindow.UberwriterWindow()
|
||||
window.show()
|
||||
Gtk.main()
|
|
@ -0,0 +1,50 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
from gi.repository import Gtk # pylint: disable=E0611
|
||||
|
||||
from . helpers import get_builder
|
||||
|
||||
class AboutDialog(Gtk.AboutDialog):
|
||||
__gtype_name__ = "AboutDialog"
|
||||
|
||||
def __new__(cls):
|
||||
"""Special static method that's automatically called by Python when
|
||||
constructing a new instance of this class.
|
||||
|
||||
Returns a fully instantiated AboutDialog object.
|
||||
"""
|
||||
builder = get_builder('AboutUberwriterDialog')
|
||||
new_object = builder.get_object("about_uberwriter_dialog")
|
||||
new_object.finish_initializing(builder)
|
||||
return new_object
|
||||
|
||||
def finish_initializing(self, builder):
|
||||
"""Called while initializing this instance in __new__
|
||||
|
||||
finish_initalizing should be called after parsing the ui definition
|
||||
and creating a AboutDialog object with it in order
|
||||
to finish initializing the start of the new AboutUberwriterDialog
|
||||
instance.
|
||||
|
||||
Put your initialization code in here and leave __init__ undefined.
|
||||
"""
|
||||
# Get a reference to the builder and set up the signals.
|
||||
self.builder = builder
|
||||
self.ui = builder.get_ui(self)
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
from gi.repository import Gtk # pylint: disable=E0611
|
||||
|
||||
from . helpers import get_builder
|
||||
|
||||
class AdvancedExportDialog(Gtk.Dialog):
|
||||
__gtype_name__ = "AdvancedExportDialog"
|
||||
|
||||
def __new__(cls):
|
||||
"""Special static method that's automatically called by Python when
|
||||
constructing a new instance of this class.
|
||||
|
||||
Returns a fully instantiated AdvancedExportDialog object.
|
||||
"""
|
||||
builder = get_builder('UberwriterAdvancedExportDialog')
|
||||
new_object = builder.get_object("uberwriter_advanced_export_dialog")
|
||||
new_object.finish_initializing(builder)
|
||||
return new_object
|
||||
|
||||
def finish_initializing(self, builder):
|
||||
"""Called while initializing this instance in __new__
|
||||
|
||||
finish_initalizing should be called after parsing the ui definition
|
||||
and creating a AdvancedExportDialog object with it in order
|
||||
to finish initializing the start of the new AboutUberwriterDialog
|
||||
instance.
|
||||
|
||||
Put your initialization code in here and leave __init__ undefined.
|
||||
"""
|
||||
# Get a reference to the builder and set up the signals.
|
||||
self.builder = builder
|
||||
self.ui = builder.get_ui(self)
|
||||
|
|
@ -0,0 +1,325 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
'''Enhances builder connections, provides object to access glade objects'''
|
||||
|
||||
from gi.repository import GObject, Gtk # pylint: disable=E0611
|
||||
|
||||
import inspect
|
||||
import functools
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter_lib')
|
||||
|
||||
from xml.etree.cElementTree import ElementTree
|
||||
|
||||
# this module is big so uses some conventional prefixes and postfixes
|
||||
# *s list, except self.widgets is a dictionary
|
||||
# *_dict dictionary
|
||||
# *name string
|
||||
# ele_* element in a ElementTree
|
||||
|
||||
|
||||
# pylint: disable=R0904
|
||||
# the many public methods is a feature of Gtk.Builder
|
||||
class Builder(Gtk.Builder):
|
||||
''' extra features
|
||||
connects glade defined handler to default_handler if necessary
|
||||
auto connects widget to handler with matching name or alias
|
||||
auto connects several widgets to a handler via multiple aliases
|
||||
allow handlers to lookup widget name
|
||||
logs every connection made, and any on_* not made
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
Gtk.Builder.__init__(self)
|
||||
self.widgets = {}
|
||||
self.glade_handler_dict = {}
|
||||
self.connections = []
|
||||
self._reverse_widget_dict = {}
|
||||
|
||||
# pylint: disable=R0201
|
||||
# this is a method so that a subclass of Builder can redefine it
|
||||
def default_handler(self,
|
||||
handler_name, filename, *args, **kwargs):
|
||||
'''helps the apprentice guru
|
||||
|
||||
glade defined handlers that do not exist come here instead.
|
||||
An apprentice guru might wonder which signal does what he wants,
|
||||
now he can define any likely candidates in glade and notice which
|
||||
ones get triggered when he plays with the project.
|
||||
this method does not appear in Gtk.Builder'''
|
||||
logger.debug('''tried to call non-existent function:%s()
|
||||
expected in %s
|
||||
args:%s
|
||||
kwargs:%s''', handler_name, filename, args, kwargs)
|
||||
# pylint: enable=R0201
|
||||
|
||||
def get_name(self, widget):
|
||||
''' allows a handler to get the name (id) of a widget
|
||||
|
||||
this method does not appear in Gtk.Builder'''
|
||||
return self._reverse_widget_dict.get(widget)
|
||||
|
||||
def add_from_file(self, filename):
|
||||
'''parses xml file and stores wanted details'''
|
||||
Gtk.Builder.add_from_file(self, filename)
|
||||
|
||||
# extract data for the extra interfaces
|
||||
tree = ElementTree()
|
||||
tree.parse(filename)
|
||||
|
||||
ele_widgets = tree.getiterator("object")
|
||||
for ele_widget in ele_widgets:
|
||||
name = ele_widget.attrib['id']
|
||||
widget = self.get_object(name)
|
||||
|
||||
# populate indexes - a dictionary of widgets
|
||||
self.widgets[name] = widget
|
||||
|
||||
# populate a reversed dictionary
|
||||
self._reverse_widget_dict[widget] = name
|
||||
|
||||
# populate connections list
|
||||
ele_signals = ele_widget.findall("signal")
|
||||
|
||||
connections = [
|
||||
(name,
|
||||
ele_signal.attrib['name'],
|
||||
ele_signal.attrib['handler']) for ele_signal in ele_signals]
|
||||
|
||||
if connections:
|
||||
self.connections.extend(connections)
|
||||
|
||||
ele_signals = tree.getiterator("signal")
|
||||
for ele_signal in ele_signals:
|
||||
self.glade_handler_dict.update(
|
||||
{ele_signal.attrib["handler"]: None})
|
||||
|
||||
def connect_signals(self, callback_obj):
|
||||
'''connect the handlers defined in glade
|
||||
|
||||
reports successful and failed connections
|
||||
and logs call to missing handlers'''
|
||||
filename = inspect.getfile(callback_obj.__class__)
|
||||
callback_handler_dict = dict_from_callback_obj(callback_obj)
|
||||
connection_dict = {}
|
||||
connection_dict.update(self.glade_handler_dict)
|
||||
connection_dict.update(callback_handler_dict)
|
||||
for item in connection_dict.items():
|
||||
if item[1] is None:
|
||||
# the handler is missing so reroute to default_handler
|
||||
handler = functools.partial(
|
||||
self.default_handler, item[0], filename)
|
||||
|
||||
connection_dict[item[0]] = handler
|
||||
|
||||
# replace the run time warning
|
||||
logger.warn("expected handler '%s' in %s",
|
||||
item[0], filename)
|
||||
|
||||
# connect glade define handlers
|
||||
Gtk.Builder.connect_signals(self, connection_dict)
|
||||
|
||||
# let's tell the user how we applied the glade design
|
||||
for connection in self.connections:
|
||||
widget_name, signal_name, handler_name = connection
|
||||
logger.debug("connect builder by design '%s', '%s', '%s'",
|
||||
widget_name, signal_name, handler_name)
|
||||
|
||||
def get_ui(self, callback_obj=None, by_name=True):
|
||||
'''Creates the ui object with widgets as attributes
|
||||
|
||||
connects signals by 2 methods
|
||||
this method does not appear in Gtk.Builder'''
|
||||
|
||||
result = UiFactory(self.widgets)
|
||||
|
||||
# Hook up any signals the user defined in glade
|
||||
if callback_obj is not None:
|
||||
# connect glade define handlers
|
||||
self.connect_signals(callback_obj)
|
||||
|
||||
if by_name:
|
||||
auto_connect_by_name(callback_obj, self)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
# pylint: disable=R0903
|
||||
# this class deliberately does not provide any public interfaces
|
||||
# apart from the glade widgets
|
||||
class UiFactory():
|
||||
''' provides an object with attributes as glade widgets'''
|
||||
def __init__(self, widget_dict):
|
||||
self._widget_dict = widget_dict
|
||||
for (widget_name, widget) in widget_dict.items():
|
||||
setattr(self, widget_name, widget)
|
||||
|
||||
# Mangle any non-usable names (like with spaces or dashes)
|
||||
# into pythonic ones
|
||||
cannot_message = """cannot bind ui.%s, name already exists
|
||||
consider using a pythonic name instead of design name '%s'"""
|
||||
consider_message = """consider using a pythonic name instead of design name '%s'"""
|
||||
|
||||
for (widget_name, widget) in widget_dict.items():
|
||||
pyname = make_pyname(widget_name)
|
||||
if pyname != widget_name:
|
||||
if hasattr(self, pyname):
|
||||
logger.debug(cannot_message, pyname, widget_name)
|
||||
else:
|
||||
logger.debug(consider_message, widget_name)
|
||||
setattr(self, pyname, widget)
|
||||
|
||||
def iterator():
|
||||
'''Support 'for o in self' '''
|
||||
return iter(widget_dict.values())
|
||||
setattr(self, '__iter__', iterator)
|
||||
|
||||
def __getitem__(self, name):
|
||||
'access as dictionary where name might be non-pythonic'
|
||||
return self._widget_dict[name]
|
||||
# pylint: enable=R0903
|
||||
|
||||
|
||||
def make_pyname(name):
|
||||
''' mangles non-pythonic names into pythonic ones'''
|
||||
pyname = ''
|
||||
for character in name:
|
||||
if (character.isalpha() or character == '_' or
|
||||
(pyname and character.isdigit())):
|
||||
pyname += character
|
||||
else:
|
||||
pyname += '_'
|
||||
return pyname
|
||||
|
||||
|
||||
# Until bug https://bugzilla.gnome.org/show_bug.cgi?id=652127 is fixed, we
|
||||
# need to reimplement inspect.getmembers. GObject introspection doesn't
|
||||
# play nice with it.
|
||||
def getmembers(obj, check):
|
||||
members = []
|
||||
for k in dir(obj):
|
||||
try:
|
||||
attr = getattr(obj, k)
|
||||
except:
|
||||
continue
|
||||
if check(attr):
|
||||
members.append((k, attr))
|
||||
members.sort()
|
||||
return members
|
||||
|
||||
|
||||
def dict_from_callback_obj(callback_obj):
|
||||
'''a dictionary interface to callback_obj'''
|
||||
methods = getmembers(callback_obj, inspect.ismethod)
|
||||
|
||||
aliased_methods = [x[1] for x in methods if hasattr(x[1], 'aliases')]
|
||||
|
||||
# a method may have several aliases
|
||||
#~ @alias('on_btn_foo_clicked')
|
||||
#~ @alias('on_tool_foo_activate')
|
||||
#~ on_menu_foo_activate():
|
||||
#~ pass
|
||||
alias_groups = [(x.aliases, x) for x in aliased_methods]
|
||||
|
||||
aliases = []
|
||||
for item in alias_groups:
|
||||
for alias in item[0]:
|
||||
aliases.append((alias, item[1]))
|
||||
|
||||
dict_methods = dict(methods)
|
||||
dict_aliases = dict(aliases)
|
||||
|
||||
results = {}
|
||||
results.update(dict_methods)
|
||||
results.update(dict_aliases)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def auto_connect_by_name(callback_obj, builder):
|
||||
'''finds handlers like on_<widget_name>_<signal> and connects them
|
||||
|
||||
i.e. find widget,signal pair in builder and call
|
||||
widget.connect(signal, on_<widget_name>_<signal>)'''
|
||||
|
||||
callback_handler_dict = dict_from_callback_obj(callback_obj)
|
||||
|
||||
for item in builder.widgets.items():
|
||||
(widget_name, widget) = item
|
||||
signal_ids = []
|
||||
try:
|
||||
widget_type = type(widget)
|
||||
while widget_type:
|
||||
signal_ids.extend(GObject.signal_list_ids(widget_type))
|
||||
widget_type = GObject.type_parent(widget_type)
|
||||
except RuntimeError: # pylint wants a specific error
|
||||
pass
|
||||
signal_names = [GObject.signal_name(sid) for sid in signal_ids]
|
||||
|
||||
# Now, automatically find any the user didn't specify in glade
|
||||
for sig in signal_names:
|
||||
# using convention suggested by glade
|
||||
sig = sig.replace("-", "_")
|
||||
handler_names = ["on_%s_%s" % (widget_name, sig)]
|
||||
|
||||
# Using the convention that the top level window is not
|
||||
# specified in the handler name. That is use
|
||||
# on_destroy() instead of on_windowname_destroy()
|
||||
if widget is callback_obj:
|
||||
handler_names.append("on_%s" % sig)
|
||||
|
||||
do_connect(item, sig, handler_names,
|
||||
callback_handler_dict, builder.connections)
|
||||
|
||||
log_unconnected_functions(callback_handler_dict, builder.connections)
|
||||
|
||||
|
||||
def do_connect(item, signal_name, handler_names,
|
||||
callback_handler_dict, connections):
|
||||
'''connect this signal to an unused handler'''
|
||||
widget_name, widget = item
|
||||
|
||||
for handler_name in handler_names:
|
||||
target = handler_name in callback_handler_dict.keys()
|
||||
connection = (widget_name, signal_name, handler_name)
|
||||
duplicate = connection in connections
|
||||
if target and not duplicate:
|
||||
widget.connect(signal_name, callback_handler_dict[handler_name])
|
||||
connections.append(connection)
|
||||
|
||||
logger.debug("connect builder by name '%s','%s', '%s'",
|
||||
widget_name, signal_name, handler_name)
|
||||
|
||||
|
||||
def log_unconnected_functions(callback_handler_dict, connections):
|
||||
'''log functions like on_* that we could not connect'''
|
||||
|
||||
connected_functions = [x[2] for x in connections]
|
||||
|
||||
handler_names = callback_handler_dict.keys()
|
||||
unconnected = [x for x in handler_names if x.startswith('on_')]
|
||||
|
||||
for handler_name in connected_functions:
|
||||
try:
|
||||
unconnected.remove(handler_name)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
for handler_name in unconnected:
|
||||
logger.debug("Not connected to builder '%s'", handler_name)
|
|
@ -0,0 +1,108 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
"""
|
||||
Based on latex2png.py from Stuart Rackham
|
||||
|
||||
AUTHOR
|
||||
Written by Stuart Rackham, <srackham@gmail.com>
|
||||
The code was inspired by Kjell Magne Fauske's code:
|
||||
http://fauskes.net/nb/htmleqII/
|
||||
|
||||
See also:
|
||||
http://www.amk.ca/python/code/mt-math
|
||||
http://code.google.com/p/latexmath2png/
|
||||
|
||||
COPYING
|
||||
Copyright (C) 2010 Stuart Rackham. Free use of this software is
|
||||
granted under the terms of the MIT License.
|
||||
"""
|
||||
|
||||
import os, sys, tempfile, subprocess
|
||||
|
||||
class LatexToPNG():
|
||||
|
||||
TEX_HEADER = r'''\documentclass{article}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amsthm}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{bm}
|
||||
\newcommand{\mx}[1]{\mathbf{\bm{#1}}} % Matrix command
|
||||
\newcommand{\vc}[1]{\mathbf{\bm{#1}}} % Vector command
|
||||
\newcommand{\T}{\text{T}} % Transpose
|
||||
\pagestyle{empty}
|
||||
\begin{document}'''
|
||||
|
||||
TEX_FOOTER = r'''\end{document}'''
|
||||
|
||||
def __init__(self):
|
||||
self.temp_result = tempfile.NamedTemporaryFile(suffix='.png')
|
||||
|
||||
def latex2png(self, tex, outfile, dpi, modified):
|
||||
'''Convert LaTeX input file infile to PNG file named outfile.'''
|
||||
outfile = os.path.abspath(outfile)
|
||||
outdir = os.path.dirname(outfile)
|
||||
texfile = tempfile.mktemp(suffix='.tex', dir=os.path.dirname(outfile))
|
||||
basefile = os.path.splitext(texfile)[0]
|
||||
dvifile = basefile + '.dvi'
|
||||
temps = [basefile + ext for ext in ('.tex','.dvi', '.aux', '.log')]
|
||||
skip = False
|
||||
|
||||
tex = '%s\n%s\n%s\n' % (self.TEX_HEADER, tex.strip(), self.TEX_FOOTER)
|
||||
|
||||
open(texfile, 'w').write(tex)
|
||||
saved_pwd = os.getcwd()
|
||||
|
||||
os.chdir(outdir)
|
||||
|
||||
args = ['latex', '-halt-on-error', texfile]
|
||||
p = subprocess.Popen(args,
|
||||
stderr=subprocess.STDOUT,
|
||||
stdout=subprocess.PIPE)
|
||||
|
||||
output = p.stdout
|
||||
output_lines = output.readlines()
|
||||
if os.path.isfile(dvifile): # DVI File exists
|
||||
# Convert DVI file to PNG.
|
||||
args = ['dvipng',
|
||||
'-D', str(dpi),
|
||||
'-T', 'tight',
|
||||
'-x', '1000',
|
||||
'-z', '9',
|
||||
'-bg', 'Transparent',
|
||||
'-o', outfile,
|
||||
dvifile]
|
||||
|
||||
p = subprocess.Popen(args)
|
||||
p.communicate()
|
||||
|
||||
else:
|
||||
self.clean_up(temps)
|
||||
'''
|
||||
Errors in Latex output start with "! "
|
||||
Stripping exclamation marks and superflous newlines
|
||||
and telling the user what he's done wrong.
|
||||
'''
|
||||
i = []
|
||||
error = ""
|
||||
for line in output_lines:
|
||||
line = line.decode('utf-8')
|
||||
if line.startswith("!"):
|
||||
error += line[2:] # removing "! "
|
||||
if error.endswith("\n"):
|
||||
error = error[:-1]
|
||||
raise Exception(error)
|
||||
|
||||
def generatepng(self, formula):
|
||||
try:
|
||||
self.temp_result = tempfile.NamedTemporaryFile(suffix='.png')
|
||||
formula = "$" + formula + "$"
|
||||
self.latex2png(formula, self.temp_result.name, 300, False)
|
||||
return (True, self.temp_result.name)
|
||||
|
||||
except Exception as e:
|
||||
self.temp_result.close()
|
||||
return (False, e.args[0])
|
||||
|
||||
def clean_up(self, files):
|
||||
for f in files:
|
||||
if os.path.isfile(f):
|
||||
os.remove(f)
|
|
@ -0,0 +1,64 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
"""this dialog adjusts values in gsettings
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk # pylint: disable=E0611
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter_lib')
|
||||
|
||||
from . helpers import get_builder, show_uri, get_help_uri
|
||||
|
||||
class PreferencesDialog(Gtk.Dialog):
|
||||
__gtype_name__ = "PreferencesDialog"
|
||||
|
||||
def __new__(cls):
|
||||
"""Special static method that's automatically called by Python when
|
||||
constructing a new instance of this class.
|
||||
|
||||
Returns a fully instantiated PreferencesDialog object.
|
||||
"""
|
||||
builder = get_builder('PreferencesUberwriterDialog')
|
||||
new_object = builder.get_object("preferences_uberwriter_dialog")
|
||||
new_object.finish_initializing(builder)
|
||||
return new_object
|
||||
|
||||
def finish_initializing(self, builder):
|
||||
"""Called while initializing this instance in __new__
|
||||
|
||||
finish_initalizing should be called after parsing the ui definition
|
||||
and creating a PreferencesDialog object with it in order to
|
||||
finish initializing the start of the new PerferencesUberwriterDialog
|
||||
instance.
|
||||
|
||||
Put your initialization code in here and leave __init__ undefined.
|
||||
"""
|
||||
|
||||
# Get a reference to the builder and set up the signals.
|
||||
self.builder = builder
|
||||
self.ui = builder.get_ui(self, True)
|
||||
|
||||
# code for other initialization actions should be added here
|
||||
|
||||
def on_btn_close_clicked(self, widget, data=None):
|
||||
self.destroy()
|
||||
|
||||
def on_btn_help_clicked(self, widget, data=None):
|
||||
show_uri(self, "ghelp:%s" % get_help_uri('preferences'))
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
from gi.repository import Gio, Gtk # pylint: disable=E0611
|
||||
import logging
|
||||
logger = logging.getLogger('uberwriter_lib')
|
||||
|
||||
from . helpers import get_builder, show_uri, get_help_uri
|
||||
|
||||
# This class is meant to be subclassed by UberwriterWindow. It provides
|
||||
# common functions and some boilerplate.
|
||||
class Window(Gtk.Window):
|
||||
__gtype_name__ = "Window"
|
||||
|
||||
# To construct a new instance of this method, the following notable
|
||||
# methods are called in this order:
|
||||
# __new__(cls)
|
||||
# __init__(self)
|
||||
# finish_initializing(self, builder)
|
||||
# __init__(self)
|
||||
#
|
||||
# For this reason, it's recommended you leave __init__ empty and put
|
||||
# your initialization code in finish_initializing
|
||||
|
||||
def __new__(cls):
|
||||
"""Special static method that's automatically called by Python when
|
||||
constructing a new instance of this class.
|
||||
|
||||
Returns a fully instantiated BaseUberwriterWindow object.
|
||||
"""
|
||||
builder = get_builder('UberwriterWindow')
|
||||
new_object = builder.get_object("uberwriter_window")
|
||||
new_object.finish_initializing(builder)
|
||||
return new_object
|
||||
|
||||
def finish_initializing(self, builder):
|
||||
"""Called while initializing this instance in __new__
|
||||
|
||||
finish_initializing should be called after parsing the UI definition
|
||||
and creating a UberwriterWindow object with it in order to finish
|
||||
initializing the start of the new UberwriterWindow instance.
|
||||
"""
|
||||
# Get a reference to the builder and set up the signals.
|
||||
self.builder = builder
|
||||
self.ui = builder.get_ui(self, True)
|
||||
self.PreferencesDialog = None # class
|
||||
self.preferences_dialog = None # instance
|
||||
self.AboutDialog = None # class
|
||||
|
||||
self.settings = Gio.Settings("net.launchpad.uberwriter")
|
||||
self.settings.connect('changed', self.on_preferences_changed)
|
||||
|
||||
# Optional application indicator support
|
||||
# Run 'quickly add indicator' to get started.
|
||||
# More information:
|
||||
# http://owaislone.org/quickly-add-indicator/
|
||||
# https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators
|
||||
try:
|
||||
from uberwriter import indicator
|
||||
# self is passed so methods of this class can be called from indicator.py
|
||||
# Comment this next line out to disable appindicator
|
||||
self.indicator = indicator.new_application_indicator(self)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
def on_mnu_contents_activate(self, widget, data=None):
|
||||
show_uri(self, "ghelp:%s" % get_help_uri())
|
||||
|
||||
def on_mnu_about_activate(self, widget, data=None):
|
||||
"""Display the about box for uberwriter."""
|
||||
if self.AboutDialog is not None:
|
||||
about = self.AboutDialog() # pylint: disable=E1102
|
||||
response = about.run()
|
||||
about.destroy()
|
||||
|
||||
def on_mnu_preferences_activate(self, widget, data=None):
|
||||
"""Display the preferences window for uberwriter."""
|
||||
|
||||
""" From the PyGTK Reference manual
|
||||
Say for example the preferences dialog is currently open,
|
||||
and the user chooses Preferences from the menu a second time;
|
||||
use the present() method to move the already-open dialog
|
||||
where the user can see it."""
|
||||
if self.preferences_dialog is not None:
|
||||
logger.debug('show existing preferences_dialog')
|
||||
self.preferences_dialog.present()
|
||||
elif self.PreferencesDialog is not None:
|
||||
logger.debug('create new preferences_dialog')
|
||||
self.preferences_dialog = self.PreferencesDialog() # pylint: disable=E1102
|
||||
self.preferences_dialog.connect('destroy', self.on_preferences_dialog_destroyed)
|
||||
self.preferences_dialog.show()
|
||||
# destroy command moved into dialog to allow for a help button
|
||||
|
||||
def on_mnu_close_activate(self, widget, data=None):
|
||||
"""Signal handler for closing the UberwriterWindow."""
|
||||
self.destroy()
|
||||
|
||||
def on_destroy(self, widget, data=None):
|
||||
"""Called when the UberwriterWindow is closed."""
|
||||
# Clean up code for saving application state should be added here.
|
||||
Gtk.main_quit()
|
||||
|
||||
def on_preferences_changed(self, settings, key, data=None):
|
||||
logger.debug('preference changed: %s = %s' % (key, str(settings.get_value(key))))
|
||||
|
||||
def on_preferences_dialog_destroyed(self, widget, data=None):
|
||||
'''only affects gui
|
||||
|
||||
logically there is no difference between the user closing,
|
||||
minimising or ignoring the preferences dialog'''
|
||||
logger.debug('on_preferences_dialog_destroyed')
|
||||
# to determine whether to create or present preferences_dialog
|
||||
self.preferences_dialog = None
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
'''facade - makes uberwriter_lib package easy to refactor
|
||||
|
||||
while keeping its api constant'''
|
||||
from . helpers import set_up_logging
|
||||
from . Window import Window
|
||||
from . uberwriterconfig import get_version
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
# -*- coding:utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2012, Maximilian Köhl <linuxmaxi@googlemail.com>
|
||||
# Copyright (C) 2012, Carlos Jenkins <carlos@jenkins.co.cr>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Python 2/3 unicode
|
||||
import sys
|
||||
if sys.version_info.major == 3:
|
||||
u = lambda x: x
|
||||
else:
|
||||
u = lambda x: x.decode('utf-8')
|
||||
|
||||
# Metadata
|
||||
__version__ = '3.0'
|
||||
__project__ = 'Python GTK Spellcheck'
|
||||
__short_name__ = 'pygtkspellcheck'
|
||||
__authors__ = u('Maximilian Köhl & Carlos Jenkins')
|
||||
__emails__ = u('linuxmaxi@googlemail.com & carlos@jenkins.co.cr')
|
||||
__website__ = 'http://koehlma.github.com/projects/pygtkspellcheck.html'
|
||||
__download_url__ = 'https://github.com/koehlma/pygtkspellcheck/tarball/master'
|
||||
__source__ = 'https://github.com/koehlma/pygtkspellcheck/'
|
||||
__vcs__ = 'git://github.com/koehlma/pygtkspellcheck.git'
|
||||
__copyright__ = u('2012, Maximilian Köhl & Carlos Jenkins')
|
||||
__desc_short__ = 'A simple but quite powerful Python spell checking library for GtkTextViews based on Enchant.'
|
||||
__desc_long__ = ('It supports both Gtk\'s Python bindings, PyGObject and'
|
||||
'PyGtk, and for both Python 2 and 3 with automatic switching'
|
||||
'and binding autodetection. For automatic translation of the'
|
||||
'user interface it can use GEdit\'s translation files.')
|
||||
|
||||
__metadata__ = {'__version__' : __version__,
|
||||
'__project__' : __project__,
|
||||
'__short_name__' : __short_name__,
|
||||
'__authors__' : __authors__,
|
||||
'__emails__' : __emails__,
|
||||
'__website__' : __website__,
|
||||
'__download_url__' : __download_url__,
|
||||
'__source__' : __source__,
|
||||
'__vcs__' : __vcs__,
|
||||
'__copyright__' : __copyright__,
|
||||
'__desc_short__' : __desc_short__,
|
||||
'__desc_long__' : __desc_long__}
|
||||
|
||||
# import SpellChecker class
|
||||
from . spellcheck import SpellChecker
|
|
@ -0,0 +1,638 @@
|
|||
# -*- coding:utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2012, Maximilian Köhl <linuxmaxi@googlemail.com>
|
||||
# Copyright (C) 2012, Carlos Jenkins <carlos@jenkins.co.cr>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
A simple but quite powerful spellchecking library written in pure Python for Gtk
|
||||
based on Enchant. It supports PyGObject as well as PyGtk for Python 2 and 3 with
|
||||
automatic switching and binding detection. For automatic translation of the user
|
||||
interface it can use Gedit’s translation files.
|
||||
"""
|
||||
|
||||
import enchant
|
||||
import gettext
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
|
||||
from ..pylocales import code_to_name
|
||||
|
||||
# public objects
|
||||
__all__ = ['SpellChecker', 'NoDictionariesFound', 'NoGtkBindingFound']
|
||||
|
||||
# logger
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class NoDictionariesFound(Exception):
|
||||
"""
|
||||
There aren't any dictionaries installed on the current system so
|
||||
spellchecking could not work in any way.
|
||||
"""
|
||||
|
||||
class NoGtkBindingFound(Exception):
|
||||
"""
|
||||
Could not find any loaded Gtk binding.
|
||||
"""
|
||||
|
||||
# find any loaded gtk binding
|
||||
if 'gi.repository.Gtk' in sys.modules:
|
||||
gtk = sys.modules['gi.repository.Gtk']
|
||||
_pygobject = True
|
||||
elif 'gtk' in sys.modules:
|
||||
gtk = sys.modules['gtk']
|
||||
_pygobject = False
|
||||
else:
|
||||
raise NoGtkBindingFound('could not find any loaded Gtk binding')
|
||||
|
||||
# select base list class
|
||||
try:
|
||||
from collections import UserList
|
||||
_list = UserList
|
||||
except ImportError:
|
||||
_list = list
|
||||
|
||||
if sys.version_info.major == 3:
|
||||
_py3k = True
|
||||
else:
|
||||
_py3k = False
|
||||
|
||||
# select base string
|
||||
if _py3k:
|
||||
basestring = str
|
||||
|
||||
# map between Gedit's translation and PyGtkSpellcheck's
|
||||
_GEDIT_MAP = {'Languages' : 'Languages',
|
||||
'Ignore All' : 'Ignore _All',
|
||||
'Suggestions' : 'Suggestions',
|
||||
'(no suggestions)' : '(no suggested words)',
|
||||
'Add "{}" to Dictionary' : 'Add w_ord'}
|
||||
|
||||
# translation
|
||||
if gettext.find('gedit'):
|
||||
_gedit = gettext.translation('gedit', fallback=True).gettext
|
||||
_ = lambda message: _gedit(_GEDIT_MAP[message]).replace('_', '')
|
||||
else:
|
||||
locale_name = 'py{}gtkspellcheck'.format(sys.version_info.major)
|
||||
_ = gettext.translation(locale_name, fallback=True).gettext
|
||||
|
||||
class SpellChecker(object):
|
||||
"""
|
||||
Main spellchecking class, everything important happens here.
|
||||
|
||||
:param view: GtkTextView the SpellChecker should be attached to.
|
||||
:param language: The language which should be used for spellchecking.
|
||||
Use a combination of two letter lower-case ISO 639 language code with a
|
||||
two letter upper-case ISO 3166 country code, for example en_US or de_DE.
|
||||
:param prefix: A prefix for some internal GtkTextMarks.
|
||||
:param collapse: Enclose suggestions in its own menu.
|
||||
:param params: Dictionary with Enchant broker parameters that should be set
|
||||
e.g. `enchant.myspell.dictionary.path`.
|
||||
|
||||
.. attribute:: languages
|
||||
|
||||
A list of supported languages.
|
||||
|
||||
.. function:: exists(language)
|
||||
|
||||
Checks if a language exists.
|
||||
|
||||
:param language: language to check
|
||||
"""
|
||||
FILTER_WORD = 'word'
|
||||
FILTER_LINE = 'line'
|
||||
FILTER_TEXT = 'text'
|
||||
|
||||
DEFAULT_FILTERS = {FILTER_WORD : [r'[0-9.,]+'],
|
||||
FILTER_LINE : [(r'(https?|ftp|file):((//)|(\\\\))+[\w\d:'
|
||||
r'#@%/;$()~_?+-=\\.&]+'),
|
||||
r'[\w\d]+@[\w\d.]+'],
|
||||
FILTER_TEXT : []}
|
||||
|
||||
class _LanguageList(_list):
|
||||
def __init__(self, *args, **kwargs):
|
||||
if sys.version_info.major == 3:
|
||||
super().__init__(*args, **kwargs)
|
||||
else:
|
||||
_list.__init__(self, *args, **kwargs)
|
||||
self.mapping = dict(self)
|
||||
|
||||
@classmethod
|
||||
def from_broker(cls, broker):
|
||||
return cls(sorted([(language, code_to_name(language))
|
||||
for language in broker.list_languages()],
|
||||
key=lambda language: language[1]))
|
||||
|
||||
def exists(self, language):
|
||||
return language in self.mapping
|
||||
|
||||
class _Mark():
|
||||
def __init__(self, buffer, name, start):
|
||||
self._buffer = buffer
|
||||
self._name = name
|
||||
self._mark = self._buffer.create_mark(self._name, start, True)
|
||||
|
||||
@property
|
||||
def iter(self):
|
||||
return self._buffer.get_iter_at_mark(self._mark)
|
||||
|
||||
@property
|
||||
def inside_word(self):
|
||||
return self.iter.inside_word()
|
||||
|
||||
@property
|
||||
def word(self):
|
||||
start = self.iter
|
||||
if not start.starts_word():
|
||||
start.backward_word_start()
|
||||
end = self.iter
|
||||
if end.inside_word():
|
||||
end.forward_word_end()
|
||||
return start, end
|
||||
|
||||
def move(self, location):
|
||||
self._buffer.move_mark(self._mark, location)
|
||||
|
||||
def __init__(self, view, language='en', prefix='gtkspellchecker',
|
||||
collapse=True, params={}):
|
||||
self._view = view
|
||||
self.collapse = collapse
|
||||
self._view.connect('populate-popup',
|
||||
lambda entry, menu:self._extend_menu(menu))
|
||||
self._view.connect('popup-menu', self._click_move_popup)
|
||||
self._view.connect('button-press-event', self._click_move_button)
|
||||
self._prefix = prefix
|
||||
if _pygobject:
|
||||
self._misspelled = gtk.TextTag.new('{}-misspelled'\
|
||||
.format(self._prefix))
|
||||
else:
|
||||
self._misspelled = gtk.TextTag('{}-misspelled'.format(self._prefix))
|
||||
self._misspelled.set_property('underline', 4)
|
||||
self._broker = enchant.Broker()
|
||||
for param, value in params.items(): self._broker.set_param(param, value)
|
||||
self.languages = SpellChecker._LanguageList.from_broker(self._broker)
|
||||
if self.languages.exists(language):
|
||||
self._language = language
|
||||
elif self.languages.exists('en'):
|
||||
logger.warning(('no installed dictionary for language "{}", '
|
||||
'fallback to english'.format(language)))
|
||||
self._language = 'en'
|
||||
else:
|
||||
if self.languages:
|
||||
self._language = self.languages[0][0]
|
||||
logger.warning(('no installed dictionary for language "{}" '
|
||||
'and english, fallback to first language in'
|
||||
'language list ("{}")').format(language,
|
||||
self._language))
|
||||
else:
|
||||
logger.critical('no dictionaries found')
|
||||
raise NoDictionariesFound()
|
||||
self._dictionary = self._broker.request_dict(self._language)
|
||||
self._deferred_check = False
|
||||
self._filters = dict(SpellChecker.DEFAULT_FILTERS)
|
||||
self._regexes = {SpellChecker.FILTER_WORD : re.compile('|'.join(
|
||||
self._filters[SpellChecker.FILTER_WORD])),
|
||||
SpellChecker.FILTER_LINE : re.compile('|'.join(
|
||||
self._filters[SpellChecker.FILTER_LINE])),
|
||||
SpellChecker.FILTER_TEXT : re.compile('|'.join(
|
||||
self._filters[SpellChecker.FILTER_TEXT]),
|
||||
re.MULTILINE)}
|
||||
self._enabled = True
|
||||
self.buffer_initialize()
|
||||
|
||||
@property
|
||||
def language(self):
|
||||
"""
|
||||
The language used for spellchecking.
|
||||
"""
|
||||
return self._language
|
||||
|
||||
@language.setter
|
||||
def language(self, language):
|
||||
if language != self._language and self.languages.exists(language):
|
||||
self._language = language
|
||||
self._dictionary = self._broker.request_dict(language)
|
||||
self.recheck()
|
||||
|
||||
@property
|
||||
def enabled(self):
|
||||
"""
|
||||
Enable or disable spellchecking.
|
||||
"""
|
||||
return self._enabled
|
||||
|
||||
@enabled.setter
|
||||
def enabled(self, enabled):
|
||||
if enabled and not self._enabled:
|
||||
self.enable()
|
||||
elif not enabled and self._enabled:
|
||||
self.disable()
|
||||
|
||||
def buffer_initialize(self):
|
||||
"""
|
||||
Initialize the GtkTextBuffer associated with the GtkTextView. If you
|
||||
have associated a new GtkTextBuffer with the GtkTextView call this
|
||||
method.
|
||||
"""
|
||||
self._buffer = self._view.get_buffer()
|
||||
self._buffer.connect('insert-text', self._before_text_insert)
|
||||
self._buffer.connect_after('insert-text', self._after_text_insert)
|
||||
self._buffer.connect_after('delete-range', self._range_delete)
|
||||
self._buffer.connect_after('mark-set', self._mark_set)
|
||||
start = self._buffer.get_bounds()[0]
|
||||
self._marks = {'insert-start' : SpellChecker._Mark(self._buffer,
|
||||
'{}-insert-start'.format(self._prefix), start),
|
||||
'insert-end' : SpellChecker._Mark(self._buffer,
|
||||
'{}-insert-end'.format(self._prefix), start),
|
||||
'click' : SpellChecker._Mark(self._buffer,
|
||||
'{}-click'.format(self._prefix), start)}
|
||||
self._table = self._buffer.get_tag_table()
|
||||
self._table.add(self._misspelled)
|
||||
self.ignored_tags = []
|
||||
def tag_added(tag, *args):
|
||||
if hasattr(tag, 'spell_check') and not getattr(tag, 'spell_check'):
|
||||
self.ignored_tags.append(tag)
|
||||
def tag_removed(tag, *args):
|
||||
if tag in self.ignored_tags:
|
||||
self.ignored_tags.remove(tag)
|
||||
self._table.connect('tag-added', tag_added)
|
||||
self._table.connect('tag-removed', tag_removed)
|
||||
self._table.foreach(tag_added, None)
|
||||
self.no_spell_check = self._table.lookup('no-spell-check')
|
||||
if not self.no_spell_check:
|
||||
if _pygobject:
|
||||
self.no_spell_check = gtk.TextTag.new('no-spell-check')
|
||||
else:
|
||||
self.no_spell_check = gtk.TextTag('no-spell-check')
|
||||
self._table.add(self.no_spell_check)
|
||||
self.recheck()
|
||||
|
||||
def recheck(self):
|
||||
"""
|
||||
Rechecks the spelling of the whole text.
|
||||
"""
|
||||
start, end = self._buffer.get_bounds()
|
||||
self.check_range(start, end, True)
|
||||
|
||||
def disable(self):
|
||||
"""
|
||||
Disable spellchecking.
|
||||
"""
|
||||
self._enabled = False
|
||||
start, end = self._buffer.get_bounds()
|
||||
self._buffer.remove_tag(self._misspelled, start, end)
|
||||
|
||||
def enable(self):
|
||||
"""
|
||||
Enable spellchecking.
|
||||
"""
|
||||
self._enabled = True
|
||||
self.recheck()
|
||||
|
||||
def append_filter(self, regex, filter_type):
|
||||
"""
|
||||
Append a new filter to the filter list. Filters are useful to ignore
|
||||
some misspelled words based on regular expressions.
|
||||
|
||||
:param regex: The regex used for filtering.
|
||||
:param filter_type: The type of the filter.
|
||||
|
||||
Filter Types:
|
||||
|
||||
:const:`SpellChecker.FILTER_WORD`: The regex must match the whole word
|
||||
you want to filter. The word separation is done by Pango's word
|
||||
separation algorithm so, for example, urls won't work here because
|
||||
they are split in many words.
|
||||
|
||||
:const:`SpellChecker.FILTER_LINE`: If the expression you want to match
|
||||
is a single line expression use this type. It should not be an open
|
||||
end expression because then the rest of the line with the text you
|
||||
want to filter will become correct.
|
||||
|
||||
:const:`SpellChecker.FILTER_TEXT`: Use this if you want to filter
|
||||
multiline expressions. The regex will be compiled with the
|
||||
`re.MULTILINE` flag. Same with open end expressions apply here.
|
||||
"""
|
||||
self._filters[filter_type].append(regex)
|
||||
if filter_type == SpellChecker.FILTER_TEXT:
|
||||
self._regexes[filter_type] = re.compile('|'.join(
|
||||
self._filters[filter_type]), re.MULTILINE)
|
||||
else:
|
||||
self._regexes[filter_type] = re.compile('|'.join(
|
||||
self._filters[filter_type]))
|
||||
|
||||
def remove_filter(self, regex, filter_type):
|
||||
"""
|
||||
Remove a filter from the filter list.
|
||||
|
||||
:param regex: The regex which used for filtering.
|
||||
:param filter_type: The type of the filter.
|
||||
"""
|
||||
self._filters[filter_type].remove(regex)
|
||||
if filter_type == SpellChecker.FILTER_TEXT:
|
||||
self._regexes[filter_type] = re.compile('|'.join(
|
||||
self._filters[filter_type]), re.MULTILINE)
|
||||
else:
|
||||
self._regexes[filter_type] = re.compile('|'.join(
|
||||
self._filters[filter_type]))
|
||||
|
||||
def append_ignore_tag(self, tag):
|
||||
"""
|
||||
Appends a tag to the list of ignored tags. A string will be automatic
|
||||
resolved into a tag object.
|
||||
|
||||
:param tag: Tag object or tag name.
|
||||
"""
|
||||
if isinstance(tag, basestring):
|
||||
tag = self._table.lookup(tag)
|
||||
self.ignored_tags.append(tag)
|
||||
|
||||
def remove_ignore_tag(self, tag):
|
||||
"""
|
||||
Removes a tag from the list of ignored tags. A string will be automatic
|
||||
resolved into a tag object.
|
||||
|
||||
:param tag: Tag object or tag name.
|
||||
"""
|
||||
if isinstance(tag, basestring):
|
||||
tag = self._table.lookup(tag)
|
||||
self.ignored_tags.remove(tag)
|
||||
|
||||
def add_to_dictionary(self, word):
|
||||
"""
|
||||
Adds a word to user's dictionary.
|
||||
|
||||
:param word: The word to add.
|
||||
"""
|
||||
self._dictionary.add_to_pwl(word)
|
||||
self.recheck()
|
||||
|
||||
def ignore_all(self, word):
|
||||
"""
|
||||
Ignores a word for the current session.
|
||||
|
||||
:param word: The word to ignore.
|
||||
"""
|
||||
self._dictionary.add_to_session(word)
|
||||
self.recheck()
|
||||
|
||||
def check_range(self, start, end, force_all=False):
|
||||
"""
|
||||
Checks a specified range between two GtkTextIters.
|
||||
|
||||
:param start: Start iter - checking starts here.
|
||||
:param end: End iter - checking ends here.
|
||||
"""
|
||||
if not self._enabled:
|
||||
return
|
||||
if end.inside_word(): end.forward_word_end()
|
||||
if not start.starts_word() and (start.inside_word() or
|
||||
start.ends_word()):
|
||||
start.backward_word_start()
|
||||
self._buffer.remove_tag(self._misspelled, start, end)
|
||||
cursor = self._buffer.get_iter_at_mark(self._buffer.get_insert())
|
||||
precursor = cursor.copy()
|
||||
precursor.backward_char()
|
||||
highlight = (cursor.has_tag(self._misspelled) or
|
||||
precursor.has_tag(self._misspelled))
|
||||
if not start.get_offset():
|
||||
start.forward_word_end()
|
||||
start.backward_word_start()
|
||||
word_start = start.copy()
|
||||
while word_start.compare(end) < 0:
|
||||
word_end = word_start.copy()
|
||||
word_end.forward_word_end()
|
||||
in_word = ((word_start.compare(cursor) < 0) and
|
||||
(cursor.compare(word_end) <= 0))
|
||||
if in_word and not force_all:
|
||||
if highlight:
|
||||
self._check_word(word_start, word_end)
|
||||
else:
|
||||
self._deferred_check = True
|
||||
else:
|
||||
self._check_word(word_start, word_end)
|
||||
self._deferred_check = False
|
||||
word_end.forward_word_end()
|
||||
word_end.backward_word_start()
|
||||
if word_start.equal(word_end):
|
||||
break
|
||||
word_start = word_end.copy()
|
||||
|
||||
def _languages_menu(self):
|
||||
def _set_language(item, code):
|
||||
self.language = code
|
||||
if _pygobject:
|
||||
menu = gtk.Menu.new()
|
||||
group = []
|
||||
else:
|
||||
menu = gtk.Menu()
|
||||
group = gtk.RadioMenuItem()
|
||||
connect = []
|
||||
for code, name in self.languages:
|
||||
if _pygobject:
|
||||
item = gtk.RadioMenuItem.new_with_label(group, name)
|
||||
group.append(item)
|
||||
else:
|
||||
item = gtk.RadioMenuItem(group, name)
|
||||
if code == self.language:
|
||||
item.set_active(True)
|
||||
connect.append((item, code))
|
||||
menu.append(item)
|
||||
for item, code in connect:
|
||||
item.connect('activate', _set_language, code)
|
||||
return menu
|
||||
|
||||
def _suggestion_menu(self, word):
|
||||
menu = []
|
||||
suggestions = self._dictionary.suggest(word)
|
||||
if not suggestions:
|
||||
if _pygobject:
|
||||
item = gtk.MenuItem.new()
|
||||
label = gtk.Label.new('')
|
||||
else:
|
||||
item = gtk.MenuItem()
|
||||
label = gtk.Label()
|
||||
try:
|
||||
label.set_halign(gtk.Align.LEFT)
|
||||
except AttributeError:
|
||||
label.set_alignment(0.0, 0.5)
|
||||
label.set_markup('<i>{text}</i>'.format(text=_('(no suggestions)')))
|
||||
item.add(label)
|
||||
menu.append(item)
|
||||
else:
|
||||
for suggestion in suggestions:
|
||||
if _pygobject:
|
||||
item = gtk.MenuItem.new()
|
||||
label = gtk.Label.new('')
|
||||
else:
|
||||
item = gtk.MenuItem()
|
||||
label = gtk.Label()
|
||||
label.set_markup('<b>{text}</b>'.format(text=suggestion))
|
||||
try:
|
||||
label.set_halign(gtk.Align.LEFT)
|
||||
except AttributeError:
|
||||
label.set_alignment(0.0, 0.5)
|
||||
item.add(label)
|
||||
item.connect('activate', self._replace_word, word, suggestion)
|
||||
menu.append(item)
|
||||
if _pygobject:
|
||||
menu.append(gtk.SeparatorMenuItem.new())
|
||||
item = gtk.MenuItem.new_with_label(
|
||||
_('Add "{}" to Dictionary').format(word))
|
||||
else:
|
||||
menu.append(gtk.SeparatorMenuItem())
|
||||
item = gtk.MenuItem(_('Add "{}" to Dictionary').format(word))
|
||||
item.connect('activate', lambda *args: self.add_to_dictionary(word))
|
||||
menu.append(item)
|
||||
if _pygobject:
|
||||
item = gtk.MenuItem.new_with_label(_('Ignore All'))
|
||||
else:
|
||||
item = gtk.MenuItem(_('Ignore All'))
|
||||
item.connect('activate', lambda *args: self.ignore_all(word))
|
||||
menu.append(item)
|
||||
return menu
|
||||
|
||||
def _extend_menu(self, menu):
|
||||
if not self._enabled:
|
||||
return
|
||||
if _pygobject:
|
||||
separator = gtk.SeparatorMenuItem.new()
|
||||
else:
|
||||
separator = gtk.SeparatorMenuItem()
|
||||
separator.show()
|
||||
menu.prepend(separator)
|
||||
if _pygobject:
|
||||
languages = gtk.MenuItem.new_with_label(_('Languages'))
|
||||
else:
|
||||
languages = gtk.MenuItem(_('Languages'))
|
||||
languages.set_submenu(self._languages_menu())
|
||||
languages.show_all()
|
||||
menu.prepend(languages)
|
||||
if self._marks['click'].inside_word:
|
||||
start, end = self._marks['click'].word
|
||||
if start.has_tag(self._misspelled):
|
||||
if _py3k:
|
||||
word = self._buffer.get_text(start, end, False)
|
||||
else:
|
||||
word = self._buffer.get_text(start, end,
|
||||
False).decode('utf-8')
|
||||
items = self._suggestion_menu(word)
|
||||
if self.collapse:
|
||||
if _pygobject:
|
||||
suggestions = gtk.MenuItem.new_with_label(
|
||||
_('Suggestions'))
|
||||
submenu = gtk.Menu.new()
|
||||
else:
|
||||
suggestions = gtk.MenuItem(_('Suggestions'))
|
||||
submenu = gtk.Menu()
|
||||
for item in items:
|
||||
submenu.append(item)
|
||||
suggestions.set_submenu(submenu)
|
||||
suggestions.show_all()
|
||||
menu.prepend(suggestions)
|
||||
else:
|
||||
items.reverse()
|
||||
for item in items:
|
||||
menu.prepend(item)
|
||||
menu.show_all()
|
||||
|
||||
def _click_move_popup(self, *args):
|
||||
self._marks['click'].move(self._buffer.get_iter_at_mark(
|
||||
self._buffer.get_insert()))
|
||||
return False
|
||||
|
||||
def _click_move_button(self, widget, event):
|
||||
if event.button == 3:
|
||||
if self._deferred_check: self._check_deferred_range(True)
|
||||
x, y = self._view.window_to_buffer_coords(2, int(event.x),
|
||||
int(event.y))
|
||||
self._marks['click'].move(self._view.get_iter_at_location(x, y))
|
||||
return False
|
||||
|
||||
def _before_text_insert(self, textbuffer, location, text, length):
|
||||
self._marks['insert-start'].move(location)
|
||||
|
||||
def _after_text_insert(self, textbuffer, location, text, length):
|
||||
start = self._marks['insert-start'].iter
|
||||
self.check_range(start, location)
|
||||
self._marks['insert-end'].move(location)
|
||||
|
||||
def _range_delete(self, textbuffer, start, end):
|
||||
self.check_range(start, end)
|
||||
|
||||
def _mark_set(self, textbuffer, location, mark):
|
||||
if mark == self._buffer.get_insert() and self._deferred_check:
|
||||
self._check_deferred_range(False)
|
||||
|
||||
def _replace_word(self, item, old_word, new_word):
|
||||
start, end = self._marks['click'].word
|
||||
offset = start.get_offset()
|
||||
self._buffer.begin_user_action()
|
||||
self._buffer.delete(start, end)
|
||||
self._buffer.insert(self._buffer.get_iter_at_offset(offset), new_word)
|
||||
self._buffer.end_user_action()
|
||||
self._dictionary.store_replacement(old_word, new_word)
|
||||
|
||||
def _check_deferred_range(self, force_all):
|
||||
start = self._marks['insert-start'].iter
|
||||
end = self._marks['insert-end'].iter
|
||||
self.check_range(start, end, force_all)
|
||||
|
||||
def _check_word(self, start, end):
|
||||
if start.has_tag(self.no_spell_check):
|
||||
return
|
||||
for tag in self.ignored_tags:
|
||||
if start.has_tag(tag):
|
||||
return
|
||||
if _py3k:
|
||||
word = self._buffer.get_text(start, end, False).strip()
|
||||
else:
|
||||
word = self._buffer.get_text(start, end, False).decode('utf-8').strip()
|
||||
if len(self._filters[SpellChecker.FILTER_WORD]):
|
||||
if self._regexes[SpellChecker.FILTER_WORD].match(word):
|
||||
return
|
||||
if len(self._filters[SpellChecker.FILTER_LINE]):
|
||||
line_start = self._buffer.get_iter_at_line(start.get_line())
|
||||
line_end = end.copy()
|
||||
line_end.forward_to_line_end()
|
||||
if _py3k:
|
||||
line = self._buffer.get_text(line_start, line_end, False)
|
||||
else:
|
||||
line = self._buffer.get_text(line_start, line_end,
|
||||
False).decode('utf-8')
|
||||
for match in self._regexes[SpellChecker.FILTER_LINE].finditer(line):
|
||||
if match.start() <= start.get_line_offset() <= match.end():
|
||||
start = self._buffer.get_iter_at_line_offset(
|
||||
start.get_line(), match.start())
|
||||
end = self._buffer.get_iter_at_line_offset(start.get_line(),
|
||||
match.end())
|
||||
self._buffer.remove_tag(self._misspelled, start, end)
|
||||
return
|
||||
if len(self._filters[SpellChecker.FILTER_TEXT]):
|
||||
text_start, text_end = self._buffer.get_bounds()
|
||||
if _py3k:
|
||||
text = self._buffer.get_text(text_start, text_end, False)
|
||||
else:
|
||||
text = self._buffer.get_text(text_start, text_end,
|
||||
False).decode('utf-8')
|
||||
for match in self._regexes[SpellChecker.FILTER_TEXT].finditer(text):
|
||||
if match.start() <= start.get_offset() <= match.end():
|
||||
start = self._buffer.get_iter_at_offset(match.start())
|
||||
end = self._buffer.get_iter_at_offset(match.end())
|
||||
self._buffer.remove_tag(self._misspelled, start, end)
|
||||
return
|
||||
if not self._dictionary.check(word):
|
||||
self._buffer.apply_tag(self._misspelled, start, end)
|
|
@ -0,0 +1,117 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
"""Helpers for an Ubuntu application."""
|
||||
import logging
|
||||
import os
|
||||
|
||||
from . uberwriterconfig import get_data_file
|
||||
from . Builder import Builder
|
||||
|
||||
from locale import gettext as _
|
||||
|
||||
def get_builder(builder_file_name):
|
||||
"""Return a fully-instantiated Gtk.Builder instance from specified ui
|
||||
file
|
||||
|
||||
:param builder_file_name: The name of the builder file, without extension.
|
||||
Assumed to be in the 'ui' directory under the data path.
|
||||
"""
|
||||
# Look for the ui file that describes the user interface.
|
||||
ui_filename = get_data_file('ui', '%s.ui' % (builder_file_name,))
|
||||
if not os.path.exists(ui_filename):
|
||||
ui_filename = None
|
||||
|
||||
builder = Builder()
|
||||
builder.set_translation_domain('uberwriter')
|
||||
builder.add_from_file(ui_filename)
|
||||
return builder
|
||||
|
||||
|
||||
# Owais Lone : To get quick access to icons and stuff.
|
||||
def get_media_file(media_file_name):
|
||||
media_filename = get_data_file('media', '%s' % (media_file_name,))
|
||||
if not os.path.exists(media_filename):
|
||||
media_filename = None
|
||||
|
||||
return "file:///"+media_filename
|
||||
|
||||
def get_media_path(media_file_name):
|
||||
media_filename = get_data_file('media', '%s' % (media_file_name,))
|
||||
if not os.path.exists(media_filename):
|
||||
media_filename = None
|
||||
return "/"+media_filename
|
||||
|
||||
class NullHandler(logging.Handler):
|
||||
def emit(self, record):
|
||||
pass
|
||||
|
||||
def set_up_logging(opts):
|
||||
# add a handler to prevent basicConfig
|
||||
root = logging.getLogger()
|
||||
null_handler = NullHandler()
|
||||
root.addHandler(null_handler)
|
||||
|
||||
formatter = logging.Formatter("%(levelname)s:%(name)s: %(funcName)s() '%(message)s'")
|
||||
|
||||
logger = logging.getLogger('uberwriter')
|
||||
logger_sh = logging.StreamHandler()
|
||||
logger_sh.setFormatter(formatter)
|
||||
logger.addHandler(logger_sh)
|
||||
|
||||
lib_logger = logging.getLogger('uberwriter_lib')
|
||||
lib_logger_sh = logging.StreamHandler()
|
||||
lib_logger_sh.setFormatter(formatter)
|
||||
lib_logger.addHandler(lib_logger_sh)
|
||||
|
||||
# Set the logging level to show debug messages.
|
||||
if opts.verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
logger.debug('logging enabled')
|
||||
if opts.verbose and opts.verbose > 1:
|
||||
lib_logger.setLevel(logging.DEBUG)
|
||||
|
||||
def get_help_uri(page=None):
|
||||
# help_uri from source tree - default language
|
||||
here = os.path.dirname(__file__)
|
||||
help_uri = os.path.abspath(os.path.join(here, '..', 'help', 'C'))
|
||||
|
||||
if not os.path.exists(help_uri):
|
||||
# installed so use gnome help tree - user's language
|
||||
help_uri = 'uberwriter'
|
||||
|
||||
# unspecified page is the index.page
|
||||
if page is not None:
|
||||
help_uri = '%s#%s' % (help_uri, page)
|
||||
|
||||
return help_uri
|
||||
|
||||
def show_uri(parent, link):
|
||||
from gi.repository import Gtk # pylint: disable=E0611
|
||||
screen = parent.get_screen()
|
||||
Gtk.show_uri(screen, link, Gtk.get_current_event_time())
|
||||
|
||||
def alias(alternative_function_name):
|
||||
'''see http://www.drdobbs.com/web-development/184406073#l9'''
|
||||
def decorator(function):
|
||||
'''attach alternative_function_name(s) to function'''
|
||||
if not hasattr(function, 'aliases'):
|
||||
function.aliases = []
|
||||
function.aliases.append(alternative_function_name)
|
||||
return function
|
||||
return decorator
|
|
@ -0,0 +1,55 @@
|
|||
# -*- coding:utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2012, Maximilian Köhl <linuxmaxi@googlemail.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Python 2/3 unicode
|
||||
import sys
|
||||
if sys.version_info.major == 3:
|
||||
u = lambda x: x
|
||||
else:
|
||||
u = lambda x: x.decode('utf-8')
|
||||
|
||||
# Metadata
|
||||
__version__ = '1.1'
|
||||
__project__ = 'PyLocales'
|
||||
__short_name__ = 'pylocales'
|
||||
__authors__ = u('Maximilian Köhl & Carlos Jenkins')
|
||||
__emails__ = u('linuxmaxi@googlemail.com & carlos@jenkins.co.cr')
|
||||
__website__ = 'http://pygtkspellcheck.readthedocs.org/'
|
||||
__source__ = 'https://github.com/koehlma/pygtkspellcheck/'
|
||||
__vcs__ = 'git://github.com/koehlma/pygtkspellcheck.git'
|
||||
__copyright__ = u('2012, Maximilian Köhl & Carlos Jenkins')
|
||||
__desc_short__ = 'Query the ISO 639/3166 database about a country or a language.'
|
||||
__desc_long__ = ('Query the ISO 639/3166 database about a country or a'
|
||||
'language. The locales database contains ISO 639 languages'
|
||||
'definitions and ISO 3166 countries definitions. This package'
|
||||
'provides translation for countries and languages names if'
|
||||
'iso-codes package is installed (Ubuntu/Debian).')
|
||||
|
||||
__metadata__ = {'__version__' : __version__,
|
||||
'__project__' : __project__,
|
||||
'__short_name__' : __short_name__,
|
||||
'__authors__' : __authors__,
|
||||
'__emails__' : __emails__,
|
||||
'__website__' : __website__,
|
||||
'__source__' : __source__,
|
||||
'__vcs__' : __vcs__,
|
||||
'__copyright__' : __copyright__,
|
||||
'__desc_short__' : __desc_short__,
|
||||
'__desc_long__' : __desc_long__}
|
||||
|
||||
# Should only import Public Objects
|
||||
from .locales import *
|
|
@ -0,0 +1,138 @@
|
|||
# -*- coding:utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2012, Maximilian Köhl <linuxmaxi@googlemail.com>
|
||||
# Copyright (C) 2012, Carlos Jenkins <carlos@jenkins.co.cr>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Query the ISO 639/3166 database about a country or a language. The locales
|
||||
database contains ISO 639 languages definitions and ISO 3166 countries
|
||||
definitions. This package provides translation for countries and languages names
|
||||
if iso-codes package is installed (Ubuntu/Debian).
|
||||
|
||||
@see utils/locales/build.py to know the database tables and structure.
|
||||
"""
|
||||
|
||||
import gettext
|
||||
import logging
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
# Public Objects
|
||||
__all__ = ['Country', 'Language', 'LanguageNotFound',
|
||||
'CountryNotFound', 'code_to_name']
|
||||
|
||||
# Translation
|
||||
_translator_language = gettext.translation('iso_639', fallback=True).gettext
|
||||
_translator_country = gettext.translation('iso_3166', fallback=True).gettext
|
||||
|
||||
# Decides where the database is located. If an application provides an
|
||||
# os.path.get_module_path monkey patch to determine the path where the module
|
||||
# is located it uses this. If not it searches in the directory of this source
|
||||
# code file.
|
||||
__path__ = None
|
||||
if hasattr(os.path, 'get_module_path'):
|
||||
__path__ = os.path.get_module_path(__file__)
|
||||
if not os.path.isfile(os.path.join(__path__, 'locales.db')):
|
||||
__path__ = None
|
||||
if __path__ is None:
|
||||
__path__ = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
|
||||
|
||||
# Loading the Database
|
||||
_database = sqlite3.connect(os.path.join(__path__, 'locales.db'))
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Exceptions
|
||||
class LanguageNotFound(Exception):
|
||||
"""
|
||||
The specified language wasn't found in the database.
|
||||
"""
|
||||
|
||||
class CountryNotFound(Exception):
|
||||
"""
|
||||
The specified country wasn't found in the database.
|
||||
"""
|
||||
|
||||
class Country(object):
|
||||
def __init__(self, rowid):
|
||||
country = _database.execute('SELECT * FROM countries WHERE rowid == ?', (rowid,)).fetchone()
|
||||
self.name = country[0]
|
||||
self.official_name = country[1]
|
||||
self.alpha_2 = country[2]
|
||||
self.alpha_3 = country[3]
|
||||
self.numeric = country[4]
|
||||
self.translation = _translator_country(self.name)
|
||||
|
||||
@classmethod
|
||||
def get_country(cls, code, codec):
|
||||
country = _database.execute('SELECT rowid FROM countries WHERE %s == ?' % (codec), (code,)).fetchone()
|
||||
if country:
|
||||
return cls(country[0])
|
||||
raise CountryNotFound('code: %s, codec: %s' % (code, codec))
|
||||
|
||||
@classmethod
|
||||
def by_alpha_2(cls, code):
|
||||
return Country.get_country(code, 'alpha_2')
|
||||
|
||||
@classmethod
|
||||
def by_alpha_3(cls, code):
|
||||
return Country.get_country(code, 'alpha_3')
|
||||
|
||||
@classmethod
|
||||
def by_numeric(cls, code):
|
||||
return Country.get_country(code, 'numeric')
|
||||
|
||||
class Language(object):
|
||||
def __init__(self, rowid):
|
||||
language = _database.execute('SELECT * FROM languages WHERE rowid == ?', (rowid,)).fetchone()
|
||||
self.name = language[0]
|
||||
self.iso_639_2B = language[1]
|
||||
self.iso_639_2T = language[2]
|
||||
self.iso_639_1 = language[3]
|
||||
self.translation = _translator_language(self.name)
|
||||
|
||||
@classmethod
|
||||
def get_language(cls, code, codec):
|
||||
language = _database.execute('SELECT rowid FROM languages WHERE %s == ?' % (codec), (code,)).fetchone()
|
||||
if language:
|
||||
return cls(language[0])
|
||||
raise LanguageNotFound('code: %s, codec: %s' % (code, codec))
|
||||
|
||||
@classmethod
|
||||
def by_iso_639_2B(cls, code):
|
||||
return Language.get_language(code, 'iso_639_2B')
|
||||
|
||||
@classmethod
|
||||
def by_iso_639_2T(cls, code):
|
||||
return Language.get_language(code, 'iso_639_2T')
|
||||
|
||||
@classmethod
|
||||
def by_iso_639_1(cls, code):
|
||||
return Language.get_language(code, 'iso_639_1')
|
||||
|
||||
|
||||
def code_to_name(code, separator='_'):
|
||||
"""
|
||||
Get the natural name of a language based on it's code.
|
||||
"""
|
||||
logger.debug('requesting name for code "{}"'.format(code))
|
||||
code = code.split(separator)
|
||||
if len(code) > 1:
|
||||
lang = Language.by_iso_639_1(code[0]).translation
|
||||
country = Country.by_alpha_2(code[1]).translation
|
||||
return '{lang} ({country})'.format(lang=lang, country=country)
|
||||
else:
|
||||
return Language.by_iso_639_1(code[0]).translation
|
|
@ -0,0 +1,209 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import re
|
||||
import vim
|
||||
|
||||
|
||||
def cjk_width(text):
|
||||
import sys
|
||||
if sys.version_info[0] < 3:
|
||||
if not isinstance(text, unicode):
|
||||
text = text.decode("utf-8")
|
||||
from unicodedata import east_asian_width
|
||||
return sum(1+(east_asian_width(c) in "WF") for c in text)
|
||||
|
||||
|
||||
def create_separarator(widths, char):
|
||||
"""Genera una linea para separar filas de una tabla.
|
||||
|
||||
El parametro `widths` es un lista indicando el ancho de cada
|
||||
columna. En cambio el argumento `char` es el caracter que se
|
||||
tiene que utilizar para imprimir.
|
||||
|
||||
El valor retornado es un string.
|
||||
|
||||
Por ejemplo::
|
||||
|
||||
>>> create_separarator([2, 4], '-')
|
||||
'+----+------+'
|
||||
"""
|
||||
|
||||
line = []
|
||||
|
||||
for w in widths:
|
||||
line.append("+" + char * (w + 2))
|
||||
|
||||
line.append("+")
|
||||
return ''.join(line)
|
||||
|
||||
|
||||
def create_line(columns, widths):
|
||||
"""Crea una fila de la tabla separando los campos con un '|'.
|
||||
|
||||
El argumento `columns` es una lista con las celdas que se
|
||||
quieren imprimir y el argumento `widths` tiene el ancho
|
||||
de cada columna. Si la columna es mas ancha que el texto
|
||||
a imprimir se agregan espacios vacíos.
|
||||
|
||||
Por ejemplo::
|
||||
|
||||
>>> create_line(['nombre', 'apellido'], [7, 10])
|
||||
'| nombre | apellido |'
|
||||
"""
|
||||
|
||||
line = zip(columns, widths)
|
||||
result = []
|
||||
|
||||
for text, width in line:
|
||||
spaces = " " * (width - cjk_width(text))
|
||||
text = "| " + text + spaces + " "
|
||||
result.append(text)
|
||||
|
||||
result.append("|")
|
||||
return ''.join(result)
|
||||
|
||||
|
||||
def create_table(content):
|
||||
"""Imprime una tabla en formato restructuredText.
|
||||
|
||||
El argumento `content` tiene que ser una lista
|
||||
de celdas.
|
||||
|
||||
Por ejemplo::
|
||||
|
||||
>>> print create_table([['software', 'vesion'], ['python', '3.2'], ['vim', '7.3']])
|
||||
+----------+--------+
|
||||
| software | vesion |
|
||||
+==========+========+
|
||||
| python | 3.2 |
|
||||
+----------+--------+
|
||||
| vim | 7.3 |
|
||||
+----------+--------+
|
||||
"""
|
||||
|
||||
# obtiene las columnas de toda la tabla.
|
||||
columns = zip(*content)
|
||||
# calcula el tamano maximo que debe tener cada columna.
|
||||
widths = [max([cjk_width(x) for x in i]) for i in columns]
|
||||
|
||||
result = []
|
||||
|
||||
result.append(create_separarator(widths, '-'))
|
||||
result.append(create_line(content[0], widths))
|
||||
result.append(create_separarator(widths, '='))
|
||||
|
||||
for line in content[1:]:
|
||||
result.append(create_line(line, widths))
|
||||
result.append(create_separarator(widths, '-'))
|
||||
|
||||
return '\n'.join(result)
|
||||
|
||||
|
||||
def are_in_a_table(current_line):
|
||||
"Indica si el cursor se encuentra dentro de una tabla."
|
||||
return "|" in current_line or "+" in current_line
|
||||
|
||||
|
||||
def are_in_a_paragraph(current_line):
|
||||
"Indica si la linea actual es parte de algun parrafo"
|
||||
return len(current_line.strip()) >= 1
|
||||
|
||||
|
||||
def get_table_bounds(current_row_index, are_in_callback):
|
||||
"""Obtiene el numero de fila donde comienza y termina la tabla.
|
||||
|
||||
el argumento `are_in_callback` tiene que ser una función
|
||||
que indique si una determinada linea pertenece o no
|
||||
a la tabla que se quiere medir (o crear).
|
||||
|
||||
Retorna ambos valores como una tupla.
|
||||
"""
|
||||
|
||||
top = 0
|
||||
buffer = vim.current.buffer
|
||||
max = len(buffer)
|
||||
bottom = max - 1
|
||||
|
||||
for a in range(current_row_index, top, -1):
|
||||
if not are_in_callback(buffer[a]):
|
||||
top = a + 1
|
||||
break
|
||||
|
||||
for b in range(current_row_index, max):
|
||||
if not are_in_callback(buffer[b]):
|
||||
bottom = b - 1
|
||||
break
|
||||
|
||||
return top, bottom
|
||||
|
||||
|
||||
def remove_spaces(string):
|
||||
"Elimina los espacios innecesarios de una fila de tabla."
|
||||
return re.sub("\s\s+", " ", string)
|
||||
|
||||
|
||||
def create_separators_removing_spaces(string):
|
||||
return re.sub("\s\s+", "|", string)
|
||||
|
||||
|
||||
def extract_cells_as_list(string):
|
||||
"Extrae el texto de una fila de tabla y lo retorna como una lista."
|
||||
string = remove_spaces(string)
|
||||
return [item.strip() for item in string.split('|') if item]
|
||||
|
||||
|
||||
def extract_table(buffer, top, bottom):
|
||||
full_table_text = buffer[top:bottom]
|
||||
# selecciona solamente las lineas que tienen celdas con texto.
|
||||
only_text_lines = [x for x in full_table_text if '|' in x]
|
||||
# extrae las celdas y descarta los separadores innecesarios.
|
||||
return [extract_cells_as_list(x) for x in only_text_lines]
|
||||
|
||||
|
||||
def extract_words_as_lists(buffer, top, bottom):
|
||||
"Genera una lista de palabras para crear una lista."
|
||||
|
||||
lines = buffer[top:bottom + 1]
|
||||
return [create_separators_removing_spaces(line).split('|') for line in lines]
|
||||
|
||||
|
||||
def copy_to_buffer(buffer, string, index):
|
||||
lines = string.split('\n')
|
||||
for line in lines:
|
||||
buffer[index] = line
|
||||
index += 1
|
||||
|
||||
|
||||
def fix_table(current_row_index):
|
||||
"""Arregla una tabla para que todas las columnas tengan el mismo ancho.
|
||||
|
||||
`initial_row` es un numero entero que indica en que
|
||||
linea se encuenta el cursor."""
|
||||
|
||||
# obtiene el indice donde comienza y termina la tabla.
|
||||
r1, r2 = get_table_bounds(current_row_index, are_in_a_table)
|
||||
|
||||
# extrae de la tabla solo las celdas de texto
|
||||
table_as_list = extract_table(vim.current.buffer, r1, r2)
|
||||
|
||||
# genera una nueva tabla tipo restructured text y la dibuja en el buffer.
|
||||
table_content = create_table(table_as_list)
|
||||
copy_to_buffer(vim.current.buffer, table_content, r1)
|
||||
|
||||
|
||||
def FixTable():
|
||||
(row, col) = vim.current.window.cursor
|
||||
line = vim.current.buffer[row - 1]
|
||||
|
||||
if are_in_a_table(line):
|
||||
fix_table(row - 1)
|
||||
else:
|
||||
print("No estoy en una tabla. Terminando...")
|
||||
|
||||
|
||||
def CreateTable():
|
||||
(row, col) = vim.current.window.cursor
|
||||
|
||||
top, bottom = get_table_bounds(row - 1, are_in_a_paragraph)
|
||||
lines = extract_words_as_lists(vim.current.buffer, top, bottom)
|
||||
table_content = create_table(lines)
|
||||
vim.current.buffer[top:bottom + 1] = table_content.split('\n')
|
|
@ -0,0 +1,69 @@
|
|||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
__all__ = [
|
||||
'project_path_not_found',
|
||||
'get_data_file',
|
||||
'get_data_path',
|
||||
]
|
||||
|
||||
# Where your project will look for your data (for instance, images and ui
|
||||
# files). By default, this is ../data, relative your trunk layout
|
||||
__uberwriter_data_directory__ = '../data/'
|
||||
__license__ = 'GPL-3'
|
||||
__version__ = 'VERSION'
|
||||
|
||||
import os
|
||||
|
||||
from locale import gettext as _
|
||||
|
||||
class project_path_not_found(Exception):
|
||||
"""Raised when we can't find the project directory."""
|
||||
|
||||
|
||||
def get_data_file(*path_segments):
|
||||
"""Get the full path to a data file.
|
||||
|
||||
Returns the path to a file underneath the data directory (as defined by
|
||||
`get_data_path`). Equivalent to os.path.join(get_data_path(),
|
||||
*path_segments).
|
||||
"""
|
||||
return os.path.join(get_data_path(), *path_segments)
|
||||
|
||||
|
||||
def get_data_path():
|
||||
"""Retrieve uberwriter data path
|
||||
|
||||
This path is by default <uberwriter_lib_path>/../data/ in trunk
|
||||
and /usr/share/uberwriter in an installed version but this path
|
||||
is specified at installation time.
|
||||
"""
|
||||
|
||||
# Get pathname absolute or relative.
|
||||
path = os.path.join(
|
||||
os.path.dirname(__file__), __uberwriter_data_directory__)
|
||||
|
||||
abs_data_path = os.path.abspath(path)
|
||||
if not os.path.exists(abs_data_path):
|
||||
raise project_path_not_found
|
||||
|
||||
return abs_data_path
|
||||
|
||||
|
||||
def get_version():
|
||||
return __version__
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
### BEGIN LICENSE
|
||||
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
### END LICENSE
|
||||
|
||||
### DO NOT EDIT THIS FILE ###
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
import locale
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
# Add project root directory (enable symlink and trunk execution)
|
||||
PROJECT_ROOT_DIRECTORY = os.path.abspath(
|
||||
os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
|
||||
|
||||
python_path = []
|
||||
if os.path.abspath(__file__).startswith('/opt'):
|
||||
locale.bindtextdomain('uberwriter', '/opt/extras.ubuntu.com/uberwriter/share/locale')
|
||||
syspath = sys.path[:] # copy to avoid infinite loop in pending objects
|
||||
for path in syspath:
|
||||
opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/uberwriter')
|
||||
python_path.insert(0, opt_path)
|
||||
sys.path.insert(0, opt_path)
|
||||
os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/uberwriter/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/")))
|
||||
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'uberwriter'))
|
||||
and PROJECT_ROOT_DIRECTORY not in sys.path):
|
||||
python_path.insert(0, PROJECT_ROOT_DIRECTORY)
|
||||
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
|
||||
if python_path:
|
||||
os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses
|
||||
|
||||
import uberwriter
|
||||
uberwriter.main()
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist gettext-domain="uberwriter">
|
||||
<schema id="net.launchpad.uberwriter" path="/net/launchpad/uberwriter/">
|
||||
<key name="example" type="s">
|
||||
<default>''</default>
|
||||
<summary>Sample setting</summary>
|
||||
<description>Longer description of this sample setting. Talk about allowed values and what it does.</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
After Width: | Height: | Size: 145 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 603 B |
After Width: | Height: | Size: 511 B |
After Width: | Height: | Size: 377 B |
After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 603 B |
After Width: | Height: | Size: 511 B |
After Width: | Height: | Size: 377 B |
After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 522 B |
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="208" height="128">
|
||||
<rect style="fill:none;stroke:#000;stroke-width:10" width="198" height="118" x="5" y="5" ry="10" />
|
||||
<path style="fill:#000" d="m 30,98 0,-68 20,0 20,25 20,-25 20,0 0,68 -20,0 0,-39 -20,25 -20,-25 0,39 z" />
|
||||
<path style="fill:#000" d="m 155,98 -30,-33 20,0 0,-35 20,0 0,35 20,0 z" />
|
||||
</svg>
|
After Width: | Height: | Size: 411 B |
|
@ -0,0 +1,241 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="New document 1">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="7.4076614"
|
||||
inkscape:cx="192.09658"
|
||||
inkscape:cy="820.42157"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1855"
|
||||
inkscape:window-height="1056"
|
||||
inkscape:window-x="65"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:none;stroke:#666666;stroke-width:12.91573358;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="path2985"
|
||||
sodipodi:cx="167.50851"
|
||||
sodipodi:cy="89.756706"
|
||||
sodipodi:rx="42.445595"
|
||||
sodipodi:ry="42.445595"
|
||||
d="m 209.95411,89.756706 a 42.445595,42.445595 0 1 1 -84.89119,0 42.445595,42.445595 0 1 1 84.89119,0 z"
|
||||
transform="matrix(0.1557609,0,0,0.15394422,115.30017,191.85093)"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/crh.png"
|
||||
inkscape:export-xdpi="82.699997"
|
||||
inkscape:export-ydpi="82.699997" />
|
||||
<path
|
||||
style="fill:none;stroke:#666666;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 141.39145,199.33354 0,12.97357"
|
||||
id="path3755"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/crh.png"
|
||||
inkscape:export-xdpi="82.699997"
|
||||
inkscape:export-ydpi="82.699997" />
|
||||
<path
|
||||
style="fill:none;stroke:#666666;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 135.02567,205.66846 12.95106,0"
|
||||
id="path3757"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/crh.png"
|
||||
inkscape:export-xdpi="82.699997"
|
||||
inkscape:export-ydpi="82.699997" />
|
||||
<rect
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none"
|
||||
id="rect3759"
|
||||
width="6.2779689"
|
||||
height="6.2047467"
|
||||
x="138.25247"
|
||||
y="202.56609"
|
||||
rx="0.26064596"
|
||||
ry="0.2316401"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/crh.png"
|
||||
inkscape:export-xdpi="82.699997"
|
||||
inkscape:export-ydpi="82.699997" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:none;stroke:#333333;stroke-width:12.91573315;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="path2985-2"
|
||||
sodipodi:cx="167.50851"
|
||||
sodipodi:cy="89.756706"
|
||||
sodipodi:rx="42.445595"
|
||||
sodipodi:ry="42.445595"
|
||||
d="m 209.95411,89.756706 a 42.445595,42.445595 0 1 1 -84.89119,0 42.445595,42.445595 0 1 1 84.89119,0 z"
|
||||
transform="matrix(0.15576089,0,0,0.15394424,208.14569,194.21576)"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/chr_a.png"
|
||||
inkscape:export-xdpi="83.678238"
|
||||
inkscape:export-ydpi="83.678238" />
|
||||
<path
|
||||
style="fill:none;stroke:#333333;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 234.23697,201.69837 0,12.97357"
|
||||
id="path3755-9"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/chr_a.png"
|
||||
inkscape:export-xdpi="83.678238"
|
||||
inkscape:export-ydpi="83.678238" />
|
||||
<path
|
||||
style="fill:none;stroke:#333333;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 227.87119,208.03329 12.95106,0"
|
||||
id="path3757-2"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/chr_a.png"
|
||||
inkscape:export-xdpi="83.678238"
|
||||
inkscape:export-ydpi="83.678238" />
|
||||
<rect
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#666666;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="rect3806"
|
||||
width="12.676776"
|
||||
height="12.676777"
|
||||
x="128.03262"
|
||||
y="234.54805"
|
||||
rx="0.17244641"
|
||||
ry="0"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs.png"
|
||||
inkscape:export-xdpi="85.970146"
|
||||
inkscape:export-ydpi="85.970146" />
|
||||
<path
|
||||
style="fill:none;stroke:#666666;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 130.8362,237.24775 7.31413,7.20365"
|
||||
id="path3810"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs.png"
|
||||
inkscape:export-xdpi="85.970146"
|
||||
inkscape:export-ydpi="85.970146" />
|
||||
<rect
|
||||
style="fill:none;stroke:#666666;stroke-width:1.32299995;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="rect5186"
|
||||
width="13.081472"
|
||||
height="13.081481"
|
||||
x="95.282639"
|
||||
y="221.42332"
|
||||
rx="0.17244641"
|
||||
ry="0" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:none;stroke:#666666;stroke-width:1.32299995;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="path5188"
|
||||
sodipodi:sides="6"
|
||||
sodipodi:cx="77.163028"
|
||||
sodipodi:cy="210.63995"
|
||||
sodipodi:r1="0.35355339"
|
||||
sodipodi:r2="0.1767767"
|
||||
sodipodi:arg1="-1.5707963"
|
||||
sodipodi:arg2="-1.0471976"
|
||||
inkscape:flatsided="false"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 77.163025,210.2864 0.08839,0.20046 0.217798,-0.0237 -0.129409,0.17677 0.129409,0.17678 -0.217798,-0.0237 -0.08839,0.20046 -0.08839,-0.20046 -0.217798,0.0237 0.129409,-0.17678 -0.129409,-0.17677 0.217798,0.0237 z" />
|
||||
<path
|
||||
style="fill:#666666;fill-opacity:1;stroke:none"
|
||||
d="m 133.35413,236.30858 -3.44109,3.60277 -0.11439,-3.61209 z"
|
||||
id="path5190"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs.png"
|
||||
inkscape:export-xdpi="85.970146"
|
||||
inkscape:export-ydpi="85.970146" />
|
||||
<path
|
||||
style="fill:#666666;fill-opacity:1;stroke:none"
|
||||
d="m 135.47632,245.51082 3.54276,-3.72968 0.0348,3.74216 z"
|
||||
id="path5190-2"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs.png"
|
||||
inkscape:export-xdpi="85.970146"
|
||||
inkscape:export-ydpi="85.970146" />
|
||||
<rect
|
||||
style="fill:#ffffff;stroke:#333333;stroke-width:1.75270867000000008;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;fill-opacity:1"
|
||||
id="rect3806-1"
|
||||
width="7.1418161"
|
||||
height="7.1068254"
|
||||
x="153.52342"
|
||||
y="237.6228"
|
||||
rx="0.097152509"
|
||||
ry="0"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs_a.png"
|
||||
inkscape:export-xdpi="90.311836"
|
||||
inkscape:export-ydpi="90.311836" />
|
||||
<path
|
||||
style="fill:none;stroke:#666666;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 176.55228,234.58647 8.61786,8.61786"
|
||||
id="path3810-9"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:#333333;fill-opacity:1;stroke:none"
|
||||
d="m 150.17921,236.68742 2.38103,-2.49437 0.0234,2.50272 z"
|
||||
id="path5190-5"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs_a.png"
|
||||
inkscape:export-xdpi="90.311836"
|
||||
inkscape:export-ydpi="90.311836" />
|
||||
<path
|
||||
style="fill:#333333;fill-opacity:1;stroke:none"
|
||||
d="m 163.9862,245.65036 -2.38103,2.49437 -0.0234,-2.50272 z"
|
||||
id="path5190-2-0"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs_a.png"
|
||||
inkscape:export-xdpi="90.311836"
|
||||
inkscape:export-ydpi="90.311836" />
|
||||
<path
|
||||
style="fill:#333333;fill-opacity:1;stroke:none"
|
||||
d="m 152.58538,248.05568 -2.50667,-2.36937 2.51505,-0.0233 z"
|
||||
id="path5190-5-7"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs_a.png"
|
||||
inkscape:export-xdpi="90.311836"
|
||||
inkscape:export-ydpi="90.311836" />
|
||||
<path
|
||||
style="fill:#333333;fill-opacity:1;stroke:none"
|
||||
d="m 161.57432,234.29204 2.50667,2.36937 -2.51505,0.0233 z"
|
||||
id="path5190-5-7-5"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:export-filename="/home/wolf/Programme/uberwriter/data/media/fs_a.png"
|
||||
inkscape:export-xdpi="90.311836"
|
||||
inkscape:export-ydpi="90.311836" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 9.9 KiB |
|
@ -0,0 +1,3 @@
|
|||
<script>
|
||||
document.getElementById('scroll_mark').scrollIntoView();
|
||||
</script>
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
TODO:
|
||||
Look into compiling resources with glib-compile-resource etc. for
|
||||
inclusion in templates
|
||||
*/
|
||||
|
||||
#UberwriterWindow {
|
||||
background: #FFF;
|
||||
}
|
||||
#UberwriterWindow GtkTextView {
|
||||
border: none;
|
||||
-GtkWidget-cursor-color: shade(@selected_bg_color, 0.9);
|
||||
-GtkWidget-cursor-aspect-ratio: 0.05;
|
||||
background: transparent ;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkTextView GtkButton {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #CCC;
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkScrolledWindow {
|
||||
background: white;
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkToolbar {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkTextView:selected {
|
||||
background-color: @selected_bg_color;
|
||||
color: @selected_fg_color;
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkPaned, #UberwriterWindow GtkScrolledWindow,
|
||||
#UberwriterWindow GtkScrolledWindow:backdrop {
|
||||
background-color: white;
|
||||
background-clip: initial;
|
||||
background-origin: initial;
|
||||
background-size: initial;
|
||||
background-position: initial;
|
||||
background-repeat: initial;
|
||||
background-image: initial;
|
||||
}
|
||||
|
||||
#status_bar_box GtkLabel {
|
||||
color: #666;
|
||||
transition: 500ms ease-in-out;
|
||||
}
|
||||
|
||||
#status_bar_box GtkButton {
|
||||
/* finding reset */
|
||||
background-color: initial;
|
||||
text-shadow: inherit;
|
||||
icon-shadow: inherit;
|
||||
box-shadow: initial;
|
||||
background-clip: initial;
|
||||
background-origin: initial;
|
||||
background-size: initial;
|
||||
background-position: initial;
|
||||
background-repeat: initial;
|
||||
background-image: initial;
|
||||
border-image-source: initial;
|
||||
border-image-repeat: initial;
|
||||
border-image-slice: initial;
|
||||
border-image-width: initial;
|
||||
|
||||
border-style: none;
|
||||
-GtkButton-images: true;
|
||||
border-radius: 2px;
|
||||
color: #666;
|
||||
padding: 3px 5px;
|
||||
|
||||
-GtkButton-child-displacement-y: 0px;
|
||||
-GtkButton-child-displacement-x: 0px;
|
||||
-GtkButton-default-border: 0;
|
||||
-GtkButton-image-spacing: 5px;
|
||||
-GtkButton-interior-focus: false;
|
||||
-GtkButton-inner-border: 0;
|
||||
|
||||
transition: 500ms ease-in;
|
||||
|
||||
}
|
||||
|
||||
#status_bar_box GtkButton:hover,
|
||||
#status_bar_box GtkButton:active:hover {
|
||||
|
||||
transition: 0s ease-in;
|
||||
color: #333;
|
||||
background: #EEE;
|
||||
}
|
||||
|
||||
|
||||
#status_bar_box GtkButton:active {
|
||||
color: #EEE;
|
||||
background-color: #EEE;
|
||||
background-image: none;
|
||||
box-shadow: 0 0 2px rgba(0,0,0,0.4)
|
||||
}
|
||||
|
||||
#status_bar_box GtkLabel:insensitive {
|
||||
color: rgba(255,255,255,0);
|
||||
transition: 500ms ease-in-out;
|
||||
}
|
||||
|
||||
#status_bar_box GtkButton:insensitive {
|
||||
background: rgba(255,255,255,0);
|
||||
transition: 500ms ease-in-out;
|
||||
box-shadow: 0 0 0 #FFF;
|
||||
}
|
||||
#status_bar_box GtkSeparator {
|
||||
border-color: #999;
|
||||
border-right: none;
|
||||
transition: 500ms ease-in-out;
|
||||
|
||||
}
|
||||
#status_bar_box GtkSeparator:insensitive {
|
||||
background: rgba(255,255,255,0);
|
||||
border-color: rgba(255,255,255,0);
|
||||
transition: 500ms ease-in-out;
|
||||
}
|
||||
|
||||
#PreviewMenuItem GtkImage {
|
||||
border-radius: 2px;
|
||||
color: #666;
|
||||
padding: 3px 5px;
|
||||
border: none;
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
|
||||
#UberwriterWindow GtkTreeView {
|
||||
color: #333;
|
||||
font-size: 10;
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkBox {
|
||||
background: #FFF;
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
/*@import url('reset.css');*/
|
||||
/* @import this colorsheet to get the default values for every property.
|
||||
* This is useful when writing special CSS tests that should not be
|
||||
* inluenced by themes - not even the default ones.
|
||||
* Keep in mind that the output will be very ugly and not look like
|
||||
* anything GTK.
|
||||
* Also, when adding new style properties, please add them here.
|
||||
*/
|
||||
|
||||
/** {
|
||||
color: inherit;
|
||||
font-size: inherit;
|
||||
background-color: initial;
|
||||
font-family: inherit;
|
||||
font-style: inherit;
|
||||
font-variant: inherit;
|
||||
font-weight: inherit;
|
||||
text-shadow: inherit;
|
||||
icon-shadow: inherit;
|
||||
box-shadow: initial;
|
||||
margin-top: initial;
|
||||
margin-left: initial;
|
||||
margin-bottom: initial;
|
||||
margin-right: initial;
|
||||
padding-top: initial;
|
||||
padding-left: initial;
|
||||
padding-bottom: initial;
|
||||
padding-right: initial;
|
||||
border-top-style: initial;
|
||||
border-top-width: initial;
|
||||
border-left-style: initial;
|
||||
border-left-width: initial;
|
||||
border-bottom-style: initial;
|
||||
border-bottom-width: initial;
|
||||
border-right-style: initial;
|
||||
border-right-width: initial;
|
||||
border-top-left-radius: initial;
|
||||
border-top-right-radius: initial;
|
||||
border-bottom-right-radius: initial;
|
||||
border-bottom-left-radius: initial;
|
||||
outline-style: initial;
|
||||
outline-width: initial;
|
||||
outline-offset: initial;
|
||||
background-clip: initial;
|
||||
background-origin: initial;
|
||||
background-size: initial;
|
||||
background-position: initial;
|
||||
border-top-color: initial;
|
||||
border-right-color: initial;
|
||||
border-bottom-color: initial;
|
||||
border-left-color: initial;
|
||||
outline-color: initial;
|
||||
background-repeat: initial;
|
||||
background-image: initial;
|
||||
border-image-source: initial;
|
||||
border-image-repeat: initial;
|
||||
border-image-slice: initial;
|
||||
border-image-width: initial;
|
||||
transition-property: initial;
|
||||
transition-duration: initial;
|
||||
transition-timing-function: initial;
|
||||
transition-delay: initial;
|
||||
gtk-key-bindings: initial;
|
||||
|
||||
-GtkWidget-focus-line-width: 0;
|
||||
-GtkWidget-focus-padding: 0;
|
||||
-GtkNotebook-initial-gap: 0;
|
||||
}
|
||||
*/
|
||||
|
||||
#UberwriterWindow {
|
||||
background: #FFF;
|
||||
color: #CCC;
|
||||
}
|
||||
#UberwriterWindow GtkTextView {
|
||||
|
||||
border: none;
|
||||
-GtkWidget-cursor-color: shade(@selected_bg_color, 1.2);
|
||||
-GtkWidget-cursor-aspect-ratio: 0.05;
|
||||
background: transparent ;
|
||||
color: #DDD;
|
||||
/*font: Rough_Typewriter 15;*/
|
||||
/*font: Georgia 15;*/
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkScrolledWindow {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkTextView:selected {
|
||||
background-color: @selected_bg_color;
|
||||
color: @selected_fg_color;
|
||||
}
|
||||
|
||||
#UberwriterWindow GtkPaned {
|
||||
background-color: transparent;
|
||||
background-clip: initial;
|
||||
background-origin: initial;
|
||||
background-size: initial;
|
||||
background-position: initial;
|
||||
background-repeat: initial;
|
||||
background-image: initial;
|
||||
}
|
||||
|
||||
#status_bar_box GtkLabel{
|
||||
color: #666;
|
||||
transition: 500ms ease-in-out;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
#status_bar_box GtkButton {
|
||||
/* finding reset */
|
||||
background-color: initial;
|
||||
text-shadow: inherit;
|
||||
icon-shadow: inherit;
|
||||
box-shadow: initial;
|
||||
background-clip: initial;
|
||||
background-origin: initial;
|
||||
background-size: initial;
|
||||
background-position: initial;
|
||||
background-repeat: initial;
|
||||
background-image: initial;
|
||||
border-image-source: initial;
|
||||
border-image-repeat: initial;
|
||||
border-image-slice: initial;
|
||||
border-image-width: initial;
|
||||
|
||||
border-style: none;
|
||||
-GtkButton-images: true;
|
||||
border-radius: 2px;
|
||||
color: #666;
|
||||
padding: 3px 5px;
|
||||
|
||||
-GtkButton-child-displacement-y: 0px;
|
||||
-GtkButton-child-displacement-x: 0;
|
||||
-GtkButton-default-border: 0;
|
||||
-GtkButton-image-spacing: 5px;
|
||||
-GtkButton-interior-focus: false;
|
||||
-GtkButton-inner-border: 0;
|
||||
|
||||
transition: 500ms ease-in;
|
||||
|
||||
}
|
||||
|
||||
#status_bar_box GtkButton:hover,
|
||||
#status_bar_box GtkButton:active:hover {
|
||||
|
||||
transition: 0s ease-in;
|
||||
color: #666;
|
||||
background: #222;
|
||||
}
|
||||
|
||||
|
||||
#status_bar_box GtkButton:active {
|
||||
color: #666;
|
||||
box-shadow: inset 0 0 5px #333;
|
||||
background-color: #222;
|
||||
background-image: none;
|
||||
box-shadow: 0 0 2px rgba(0,0,0,0.4)
|
||||
}
|
||||
|
||||
#status_bar_box GtkLabel:insensitive {
|
||||
color: rgba(0,0,0,0);
|
||||
transition: 500ms ease-in-out;
|
||||
}
|
||||
|
||||
#status_bar_box GtkButton:insensitive {
|
||||
background: rgba(0,0,0,0);
|
||||
transition: 500ms all ease-in-out;
|
||||
box-shadow: 0 0 0 #000;
|
||||
}
|
||||
|
||||
#status_bar_box GtkSeparator {
|
||||
border-color: #666;
|
||||
border-right: none;
|
||||
transition: 500ms ease-in-out;
|
||||
|
||||
}
|
||||
#status_bar_box GtkSeparator:insensitive {
|
||||
background: rgba(0,0,0,0);
|
||||
border-color: rgba(0,0,0,0);
|
||||
transition: 500ms ease-in-out;
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
#UberwriterWindow {
|
||||
background: #333;
|
||||
}
|
||||
#UberwriterWindow GtkTextView {
|
||||
border: none;
|
||||
-GtkWidget-cursor-color: #FA5B0F;
|
||||
-GtkWidget-cursor-aspect-ratio: 0.05;
|
||||
background-color: transparent;
|
||||
color: #F3F3F3;
|
||||
}
|
||||
#UberwriterWindow GtkTextView:selected {
|
||||
background-color: #888;
|
||||
color: #DDD;
|
||||
}
|
||||
#fullscreen_toggle:hover,
|
||||
#fullscreen_toggle:active:hover,
|
||||
#focus_toggle:hover,
|
||||
#focus_toggle:active:hover {
|
||||
color: #999;
|
||||
background-color: #222;
|
||||
background-image: none;
|
||||
text-shadow: none;
|
||||
-unico-border-gradient: none;
|
||||
-unico-glow-radius: 0;
|
||||
-unico-glow-color: #000;
|
||||
-unico-outer-stroke-color: #000;
|
||||
-unico-outer-stroke-gradient: none;
|
||||
-unico-outer-stroke-width: 0;
|
||||
-unico-inner-stroke-gradient: none;
|
||||
-unico-inner-stroke-width: 1px;
|
||||
-unico-border-gradient: none;
|
||||
-unico-focus-outer-stroke-color: #000;
|
||||
-unico-outer-stroke-width: 0 0 0 0;
|
||||
-GtkButton-default-border: 0;
|
||||
-GtkButton-image-spacing: 0;
|
||||
-GtkButton-interior-focus: false;
|
||||
-unico-focus-border-color: #000;
|
||||
-unico-focus-outer-stroke-color: #000;
|
||||
-unico-inner-stroke-color: #000;
|
||||
-unico-inner-stroke-width: 0;
|
||||
|
||||
}
|
||||
#fullscreen_toggle,
|
||||
#focus_toggle {
|
||||
border-style: none;
|
||||
-unico-border-gradient: none;
|
||||
-GtkButton-images: true;
|
||||
transition: 0s ease-in-out;
|
||||
color: #666;
|
||||
padding: 3px 5px;
|
||||
text-shadow: none;
|
||||
-GtkButton-child-displacement-y: 0px;
|
||||
-GtkButton-child-displacement-x: 0;
|
||||
-GtkButton-default-border: 0;
|
||||
-GtkButton-image-spacing: 5px;
|
||||
-GtkButton-interior-focus: false;
|
||||
-GtkButton-inner-border: 0;
|
||||
|
||||
}
|
||||
#fullscreen_toggle:active,
|
||||
#focus_toggle:active {
|
||||
color: #666;
|
||||
box-shadow: inset 0 0 3 #000;
|
||||
background-color: #111;
|
||||
background-image: none;
|
||||
border: 0px solid #000;
|
||||
border-color: #333;
|
||||
-unico-border-gradient: none;
|
||||
-unico-glow-radius: 0;
|
||||
-unico-glow-color: #000;
|
||||
-unico-outer-stroke-color: #000;
|
||||
-unico-outer-stroke-gradient: none;
|
||||
-unico-outer-stroke-width: 0;
|
||||
-unico-inner-stroke-gradient: none;
|
||||
-unico-inner-stroke-width: 1px;
|
||||
-unico-border-gradient: none;
|
||||
-unico-focus-outer-stroke-color: #000;
|
||||
-unico-outer-stroke-width: 0 0 0 0;
|
||||
-GtkButton-default-border: 0;
|
||||
-GtkButton-image-spacing: 0;
|
||||
-GtkButton-interior-focus: false;
|
||||
-unico-focus-border-color: #000;
|
||||
-unico-focus-outer-stroke-color: #000;
|
||||
-unico-inner-stroke-color: #000;
|
||||
-unico-inner-stroke-width: 1;
|
||||
|
||||
}
|
||||
|
||||
.separator {
|
||||
border-color: #444;
|
||||
border-style: solid;
|
||||
|
||||
-unico-border-gradient: none;
|
||||
-unico-inner-stroke-color: alpha (#444, 0.6);
|
||||
-unico-inner-stroke-gradient: none;
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/************************************
|
||||
|
||||
uberwriter.css
|
||||
A simple and clean stylesheet
|
||||
for pure text and stuff
|
||||
|
||||
************************************/
|
||||
|
||||
body {
|
||||
font-family: Georgia, Times, serif;
|
||||
font-size: 1.em;
|
||||
|
||||
color: #333;
|
||||
|
||||
width: 550px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
blockquote {
|
||||
border-left: 5px solid #666;
|
||||
padding-left: 20px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
p, li {
|
||||
line-height: 1.8em;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin-top: 40px;
|
||||
margin-bottom: 40px;
|
||||
border: none;
|
||||
width: 80%;
|
||||
border-top: 1px solid #222;
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
margin-left: 0px;
|
||||
padding-left: 0px;
|
||||
li {
|
||||
margin-left: 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
li ol, li ul{
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.author, .date {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
color: #777;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.author::after {
|
||||
content: ' ,';
|
||||
}
|
||||
.figure {
|
||||
display: inline-block;
|
||||
}
|
||||
img {
|
||||
max-width: 600px;
|
||||
}
|
||||
.caption {
|
||||
text-align: center;
|
||||
background: #F6F6F6;
|
||||
}
|
After Width: | Height: | Size: 38 KiB |
|
@ -0,0 +1,155 @@
|
|||
Markdown Tutorial for UberWriter
|
||||
================================
|
||||
|
||||
I will try to give a short impressions on how I use markdown/pandocs capabilities to greatly reduce the time spent on formatting anything -- from websites to PDF Documents.
|
||||
|
||||
You can find a much more exhaustive documentation for all features pandoc offers on pandoc's help page: [Link](http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown)
|
||||
|
||||
### Headers
|
||||
|
||||
There are two styles for headers. One looks like this:
|
||||
|
||||
# Header Level One
|
||||
## Header Level Two
|
||||
...
|
||||
###### Header Level Six
|
||||
|
||||
And another one, that has only »two« levels:
|
||||
|
||||
Header One
|
||||
==========
|
||||
|
||||
Header Two
|
||||
----------
|
||||
|
||||
You can use both styles, whichever you prefer. Additionally, pandoc requires you to have a blank line before a header.
|
||||
|
||||
### Paragraphs
|
||||
|
||||
A paragraph is one or more lines of text followed by one or more blank line. Newlines are treated as spaces. If you need a hard line break, put two or more spaces at the end of a line, or type a backslash at the end of a line.
|
||||
|
||||
### Block quotations
|
||||
|
||||
Block quotations in markdown use the same convention as in emails. A generic block quote looks like this:
|
||||
|
||||
> This is a block quote.
|
||||
> This paragraph has two lines.
|
||||
>
|
||||
> > And block quotes can be nested, as well.
|
||||
|
||||
Note the empty line you need to leave before the second level blockquote.
|
||||
|
||||
### Code blocks
|
||||
|
||||
There are two ways of creating a code block. You can indent your code four spaces or one tab.
|
||||
|
||||
Code
|
||||
|
||||
Or use a fenced code block:
|
||||
|
||||
```javascript
|
||||
a = function() {
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Which works as well. You can identify the language of your code block to add syntax highlighting to the resulting document.
|
||||
|
||||
Short code examples can be surrounded by backticks to make them appear verbatim: `this.code() == true`.
|
||||
|
||||
### Lists
|
||||
|
||||
#### Bullet List:
|
||||
|
||||
* one
|
||||
* two
|
||||
* three
|
||||
|
||||
#### Nested Lists:
|
||||
|
||||
* fruits
|
||||
+ pears
|
||||
+ peaches
|
||||
* vegetables
|
||||
+ broccoli
|
||||
+ ubuntu
|
||||
- mint
|
||||
- lubuntu
|
||||
- kubuntu
|
||||
|
||||
#### Numbered Lists:
|
||||
|
||||
1. Item 1
|
||||
2. Item 2
|
||||
3. Item 3
|
||||
|
||||
### Title blocks
|
||||
|
||||
To give your document some meta-information and a nice title, you can use title blocks at the top of your document:
|
||||
|
||||
% title
|
||||
% author(s) (separated by semicolons)
|
||||
% date
|
||||
|
||||
### Inline formatting
|
||||
|
||||
Emphasizing some text is done by surrounding it with *s:
|
||||
|
||||
This is *emphasized with asterisks*, and this will be a **bold text**. And even more ***krass***. And if you want to erase something: ~~completely gone~~ (sorrounded by ~)
|
||||
|
||||
### Horizontal Rules
|
||||
|
||||
Horizontal rules are easily created by putting three or more `***` or `---` on a line:
|
||||
|
||||
*****
|
||||
|
||||
|
||||
### Super- and subscripts
|
||||
|
||||
Superscripts may be written by surrounding the superscripted text by ^ characters; subscripts may be written by surrounding the subscripted text by ~ characters. Thus, for example,
|
||||
|
||||
H~2~O is a liquid. 2^10^ is 1024.
|
||||
|
||||
### Math
|
||||
|
||||
There are two ways to generate math type setting in pandoc: Inline math looks like this:
|
||||
|
||||
This is inline $1 + 2 = 3$ math.
|
||||
|
||||
Note that there are no spaces allowed next to the dollar signs.
|
||||
|
||||
And there is also another format:
|
||||
|
||||
This is a beautiful equation: $$\left|\sum_{i=1}^n x_i \bar{y}_i\right|^2 \leq \sum_{j=1}^n |x_j|^2 \sum_{k=1}^n |y_k|^2$$ And it stands on it's own.
|
||||
|
||||
### Links
|
||||
|
||||
Enclosing an URL in pointy brackets transforms them into links:
|
||||
|
||||
<http://johnmacfarlane.net/pandoc>
|
||||
<max@mustermann.de>
|
||||
|
||||
#### Inline Links:
|
||||
|
||||
This is an [inline link](/url), and here's [one with
|
||||
a title](http://fsf.org "click here for a good time!").
|
||||
|
||||
### Images
|
||||
|
||||
![This is the caption](/url/of/image.png)
|
||||
|
||||
### Footnotes
|
||||
|
||||
An example for footnotes (you can place the referenced footnote wherever you want, e.g. at the bottom of your document):
|
||||
|
||||
Here is a footnote reference,[^1] and another.[^longnote]
|
||||
|
||||
[^1]: Here is the footnote.
|
||||
|
||||
[^longnote]: Here's one with multiple blocks.
|
||||
Subsequent paragraphs are indented to show that they belong to the previous footnote.
|
||||
The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.
|
||||
|
||||
There is also a different format for inline footnotes, that are easier to write:
|
||||
|
||||
Here is an inline note.^[Inlines notes are easier to write, since you don't have to pick an identifier and move down to type the note.]
|
After Width: | Height: | Size: 505 B |
|
@ -0,0 +1,51 @@
|
|||
<interface>
|
||||
<!-- interface-requires about_uberwriter_dialog 1.0 -->
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="AboutUberwriterDialog" id="about_uberwriter_dialog">
|
||||
<property name="website">https://launchpad.net/uberwriter</property><property translatable="yes" name="license"># Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3, as published
|
||||
# by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 <http://www.gnu.org/licenses/>.
|
||||
</property><property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="icon">../media/uberwriter.svg</property>
|
||||
<property name="type_hint">normal</property>
|
||||
<property name="program_name">UberWriter</property>
|
||||
<property name="version">12.07.9</property>
|
||||
<property name="copyright" translatable="yes">Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com></property>
|
||||
<property name="authors">Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com></property>
|
||||
<property name="logo">../media/uberwriter.svg</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -0,0 +1,548 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<!-- interface-requires uberwriter_advanced_export_dialog 1.0 -->
|
||||
<object class="UberwriterAdvancedExportDialog" id="uberwriter_advanced_export_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">Export</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="is_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="choose_format">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">out</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="smart">
|
||||
<property name="label" translatable="yes">Smart</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Pandoc can automatically make "--" to a long dash and more</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="normalize">
|
||||
<property name="label" translatable="yes">Normalize</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Removes things like double spaces or spaces at the beginning of a paragraph</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="toc">
|
||||
<property name="label" translatable="yes">Table of Contents</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="standalone">
|
||||
<property name="label" translatable="yes">Standalone</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Use a header and footer to include things like stylesheets and meta information</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="number_sections">
|
||||
<property name="label" translatable="yes">Number Sections</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="strict">
|
||||
<property name="label" translatable="yes">Strict Markdown</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Use "strict" markdown instead of "pandoc" markdown</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="incremental">
|
||||
<property name="label" translatable="yes">Slideshow incremental bullets</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Show one bullet point after another in a slideshow</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>General Options</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">out</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="highlight">
|
||||
<property name="label" translatable="yes">Highlight syntax</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Choose a color theme for syntax highlighting</property>
|
||||
<property name="label" translatable="yes">Highlight style </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="highlight_style">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Choose a color theme for syntax highlighting</property>
|
||||
<property name="active">0</property>
|
||||
<property name="entry_text_column">0</property>
|
||||
<property name="id_column">1</property>
|
||||
<property name="active_id">0</property>
|
||||
<items>
|
||||
<item>pygments</item>
|
||||
<item>kate</item>
|
||||
<item>monochrome</item>
|
||||
<item>espresso</item>
|
||||
<item>zenburn</item>
|
||||
<item>haddock</item>
|
||||
<item>tango</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>Syntax highlighting</b> (HTML, LaTeX)</property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">out</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="self_contained">
|
||||
<property name="label" translatable="yes">Self Contained</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Produces a HTML that has no external dependencies (all images and stylesheets are included)</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="html5">
|
||||
<property name="label" translatable="yes">HTML 5</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Use HTML 5 syntax</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Choose a CSS File that you want to use</property>
|
||||
<property name="margin_right">10</property>
|
||||
<property name="label" translatable="yes">CSS File</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFileChooserButton" id="css_filechooser">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Choose a CSS File that you want to use</property>
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>HTML Options</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">out</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkFileChooserButton" id="bib_filechooser">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">5</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>Bibliography File</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="linkbutton1">
|
||||
<property name="label" translatable="yes">Commandline Reference</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="uri">http://johnmacfarlane.net/pandoc/README.html</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">button2</action-widget>
|
||||
<action-widget response="1">button1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
|
@ -0,0 +1,971 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<!-- interface-requires uberwriter_window 1.0 -->
|
||||
<!-- interface-local-resource-path ../media -->
|
||||
<object class="GtkAction" id="action1"/>
|
||||
<object class="GtkImage" id="icon_case_sensitive1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Case Sensitive</property>
|
||||
<property name="pixbuf">icon-case-off.png</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="icon_regex1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Activate Regex</property>
|
||||
<property name="pixbuf">icon-regex-off.png</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="yalign">0.49000000953674316</property>
|
||||
<property name="stock">gtk-help</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<object class="GtkRecentFilter" id="recentfilter1">
|
||||
<mime-types>
|
||||
<mime-type>text/plain</mime-type>
|
||||
<mime-type>text/x-markdown</mime-type>
|
||||
</mime-types>
|
||||
</object>
|
||||
<object class="UberwriterWindow" id="uberwriter_window">
|
||||
<property name="app_paintable">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title">UberWriter</property>
|
||||
<property name="default_width">800</property>
|
||||
<property name="default_height">500</property>
|
||||
<property name="icon">../media/uberwriter.svg</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuBar" id="menubar1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_file">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_File</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="menu1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_new">
|
||||
<property name="label">gtk-new</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="new_document" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_open">
|
||||
<property name="label">gtk-open</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="o" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="open_document" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="recent">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Open Recent File</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_save">
|
||||
<property name="label">gtk-save</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="save_document" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_save_as">
|
||||
<property name="label">gtk-save-as</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="s" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="save_document_as" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_export_html">
|
||||
<property name="label">Export as HTML</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="image">image4</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="export_as_html" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_export_pdf">
|
||||
<property name="label">Export as PDF</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="image">image3</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="export_as_pdf" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_export_odt">
|
||||
<property name="label" translatable="yes">Export as ODT</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="image">image1</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="export_as_odt" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="advanced_export">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Advanced Export...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="open_advanced_export" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="seperatoritem10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="copy-html-to-clipboard">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Copy raw HTML to clipboard</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="copy_html_to_clipboard" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_close">
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="w" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_edit">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_Edit</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="menu2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_cut">
|
||||
<property name="label">gtk-cut</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="x" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="cut_text" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_copy">
|
||||
<property name="label">gtk-copy</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="c" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="copy_text" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_paste">
|
||||
<property name="label">gtk-paste</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="v" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="paste_text" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_undo">
|
||||
<property name="label">gtk-undo</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="z" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="undo" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_redo">
|
||||
<property name="label">gtk-redo</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="z" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
|
||||
<accelerator key="y" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="redo" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_view">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_View</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="menu4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_focusmode">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label">Focus Mode</property>
|
||||
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="menu_activate_focusmode" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_fullscreen">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label">Fullscreen</property>
|
||||
<accelerator key="F11" signal="activate"/>
|
||||
<signal name="activate" handler="menu_activate_fullscreen" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="dark_mode">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Light text on a dark background</property>
|
||||
<property name="label" translatable="yes">Dark Mode</property>
|
||||
<property name="draw_as_radio">True</property>
|
||||
<signal name="toggled" handler="dark_mode_toggled" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="mnu_preview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Switch to preview mode</property>
|
||||
<property name="label" translatable="yes">Preview</property>
|
||||
<property name="draw_as_radio">True</property>
|
||||
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="toggled" handler="menu_activate_preview" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="searchreplacemenuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Open Search and Replace</property>
|
||||
<property name="label" translatable="yes">Search and Replace ...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="open_search_and_replace" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem6">
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="mnu_toggle_typewriter">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label">Use Typewritermode (experimental)</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_as_radio">True</property>
|
||||
<accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="toggled" handler="toggle_typewriter" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="disable_spellcheck">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Auto _Spellcheck</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<accelerator key="F7" signal="activate"/>
|
||||
<signal name="toggled" handler="toggle_spellcheck" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_format">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">F_ormat</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="menu3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu-italic">
|
||||
<property name="label">gtk-italic</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="i" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="set_italic" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu-bold">
|
||||
<property name="label">gtk-bold</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="b" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="set_bold" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="unordered-list-item">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Unordered List Item</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="u" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="insert_unordered_list_item" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="horizontal-rule">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Horizontal Rule</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="insert_horizontal_rule" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="heading">
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Heading</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="h" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="insert_heading" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_help">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="helpMenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_contents">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Contents</property>
|
||||
<accelerator key="F1" signal="activate"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_uberwriter_markdown">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Short Markdown Tutorial</property>
|
||||
<signal name="activate" handler="open_uberwriter_markdown" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mnu_pandoc_markdown">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Open Pandoc Online Markdown Help ...</property>
|
||||
<signal name="activate" handler="open_pandoc_markdown" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="get_help_online">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Get Help Online...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="open_launchpad_help" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="translate_launchpad">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Translate This Application...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="open_launchpad_translation" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="mnu_about">
|
||||
<property name="label">gtk-about</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="searchreplaceholder">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="searchboxholder">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_search">
|
||||
<property name="width_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Search</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="searchentrybox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="itoolbar1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="show_arrow">False</property>
|
||||
<property name="icon_size">1</property>
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="next_result">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup" translatable="yes">Next Match</property>
|
||||
<property name="tooltip_text" translatable="yes">Next Match</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">go-down</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="previous_result">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup" translatable="yes">Previous Match</property>
|
||||
<property name="tooltip_text" translatable="yes">Previous Match</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="icon_name">go-up</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="case_sensitive">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_widget">icon_case_sensitive1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="regex">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">toolbutton</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_widget">icon_regex1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="replace">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup" translatable="yes">Open Replace</property>
|
||||
<property name="tooltip_text" translatable="yes">Open Replace</property>
|
||||
<property name="label" translatable="yes">Open Replace</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">edit-find-replace</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="replacebox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="replace_label">
|
||||
<property name="width_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Replace with</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="replaceentrybox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton" id="replace_one">
|
||||
<property name="label" translatable="yes">Replace</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="replace_all">
|
||||
<property name="label" translatable="yes">Replace All</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPaned" id="main_pained">
|
||||
<property name="visible">True</property>
|
||||
<property name="app_paintable">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="sidebar_box">
|
||||
<property name="width_request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="editor_scrolledwindow">
|
||||
<property name="height_request">500</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="status_bar_box">
|
||||
<property name="height_request">15</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="focus_toggle">
|
||||
<property name="label" translatable="yes">Focus Mode</property>
|
||||
<property name="height_request">15</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup" translatable="yes">Go into focus mode</property>
|
||||
<property name="tooltip_text" translatable="yes">Go into focus mode</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<signal name="toggled" handler="set_focusmode" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">3</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="fullscreen_toggle">
|
||||
<property name="label" translatable="yes">Fullscreen</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup" translatable="yes">Go into fullscreen mode</property>
|
||||
<property name="tooltip_text" translatable="yes">Go into fullscreen mode</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<signal name="toggled" handler="toggle_fullscreen" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="preview_toggle">
|
||||
<property name="label" translatable="yes">Preview</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup" translatable="yes">Show HTML preview</property>
|
||||
<property name="tooltip_text" translatable="yes">Show HTML preview</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<signal name="toggled" handler="toggle_preview" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="label" translatable="yes">Words:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="word_count">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label">0</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="width_chars">4</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">6</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="label" translatable="yes">Characters:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="char_count">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">10</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label">0</property>
|
||||
<property name="width_chars">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -0,0 +1,9 @@
|
|||
<glade-catalog name="about_uberwriter_dialog" domain="glade-3"
|
||||
depends="gtk+" version="1.0">
|
||||
<glade-widget-classes>
|
||||
<glade-widget-class title="About Uberwriter Dialog" name="AboutUberwriterDialog"
|
||||
generic-name="AboutUberwriterDialog" parent="GtkAboutDialog"
|
||||
icon-name="widget-gtk-about-dialog"/>
|
||||
</glade-widget-classes>
|
||||
|
||||
</glade-catalog>
|
After Width: | Height: | Size: 603 B |
After Width: | Height: | Size: 511 B |
|
@ -0,0 +1,9 @@
|
|||
<glade-catalog name="uberwriter_advanced_export_dialog" domain="glade-3"
|
||||
depends="gtk+" version="1.0">
|
||||
<glade-widget-classes>
|
||||
<glade-widget-class title="Advanced Export Dialog" name="UberwriterAdvancedExportDialog"
|
||||
generic-name="uberwriter_advanced_export_dialog" parent="GtkDialog"
|
||||
icon-name="widget-gtk-dialog"/>
|
||||
</glade-widget-classes>
|
||||
|
||||
</glade-catalog>
|
|
@ -0,0 +1,8 @@
|
|||
<glade-catalog name="uberwriter_window" domain="glade-3"
|
||||
depends="gtk+" version="1.0">
|
||||
<glade-widget-classes>
|
||||
<glade-widget-class title="Uberwriter Window" name="UberwriterWindow"
|
||||
generic-name="UberwriterWindow" parent="GtkWindow"
|
||||
icon-name="widget-gtk-window"/>
|
||||
</glade-widget-classes>
|
||||
</glade-catalog>
|
|
@ -0,0 +1,218 @@
|
|||
uberwriter (12.11.04-public) quantal; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Added utf 8 encoding to files, necessary or else build on launchpad
|
||||
fails
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 02 Nov 2012 03:20:00 +0200
|
||||
|
||||
uberwriter (12.11.03-public) quantal; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* New Preview
|
||||
* New Inline Preview
|
||||
* New Session restore for spellcheck and darkmode
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 01 Nov 2012 22:20:00 +0200
|
||||
|
||||
|
||||
uberwriter (12.11.02-public1-beta) quantal; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Targetting quantal
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 01 Oct 2012 15:20:00 +0200
|
||||
|
||||
uberwriter (12.11.01-public1) quantal; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Bug resolved involving copy+paste and unicode chars
|
||||
* Statusbar now fades away (at least in quantal)
|
||||
* Targetting quantal
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 01 Oct 2012 11:20:00 +0200
|
||||
|
||||
|
||||
uberwriter (12.08.28-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Hotfixing a stupid wordcount bug
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 27 Aug 2012 23:10:00 +0200
|
||||
|
||||
uberwriter (12.08.27-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Recent Files now working
|
||||
* Several bugfixes
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 27 Aug 2012 23:00:00 +0200
|
||||
|
||||
uberwriter (12.08.26-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Advanced Export Menu
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 27 Aug 2012 10:00:00 +0200
|
||||
|
||||
uberwriter (12.08.25-publicbeta2) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Much more useful *.desktop File
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sat, 25 Aug 2012 15:00:00 +0200
|
||||
|
||||
uberwriter (12.08.24-publicbeta) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Various bugfixes
|
||||
* Auto Spellcheck now settable
|
||||
* Filename in window title
|
||||
* ODT instead of RTF export
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 26 Jul 2012 02:36:23 +0200
|
||||
|
||||
uberwriter (12.08.04-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* New Button style
|
||||
* Blockquote get's better styled
|
||||
* Many, many improvements
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 26 Jul 2012 02:36:23 +0200
|
||||
|
||||
uberwriter (12.08.03-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Added libglib to the correct section
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 19 Jul 2012 15:09:23 +0200
|
||||
|
||||
uberwriter (12.08.02-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Added libglib for launchpad compilation
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 19 Jul 2012 14:23:34 +0200
|
||||
|
||||
uberwriter (12.08.01-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Installs now in opt as promised
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 19 Jul 2012 14:23:34 +0200
|
||||
|
||||
uberwriter (12.07.58-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* New Packaging, link probably broken.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 13:22:34 +0200
|
||||
|
||||
uberwriter (12.07.57-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Various Bugfixes
|
||||
* Added a spellchecker
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 13:22:34 +0200
|
||||
|
||||
|
||||
uberwriter (12.07.56-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Various Bugfixes
|
||||
* New orange cursor
|
||||
* No more jumping when switching to focus / typewriter mode
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 13:22:34 +0200
|
||||
|
||||
uberwriter (12.07.48-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* Sharing to PPA version bump.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 13:22:34 +0200
|
||||
|
||||
uberwriter (12.07.17-public1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* New release.
|
||||
|
||||
[ wolf ]
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 13:22:34 +0200
|
||||
|
||||
uberwriter (12.07.10-public1ubuntu1) precise; urgency=low
|
||||
|
||||
*
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 03:20:37 +0200
|
||||
|
||||
uberwriter (12.07.10-public1) precise; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 03:11:09 +0200
|
||||
|
||||
uberwriter (12.07.3ubuntu1) precise; urgency=low
|
||||
|
||||
*
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 02:50:23 +0200
|
||||
|
||||
uberwriter (12.07.3) precise; urgency=low
|
||||
|
||||
* Added Dependencies for Pandoc & Latex
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 02:40:15 +0200
|
||||
|
||||
uberwriter (12.07.2-public2) precise; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 02:39:57 +0200
|
||||
|
||||
uberwriter (12.07.2-public1) precise; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Sun, 15 Jul 2012 02:04:06 +0200
|
||||
|
||||
uberwriter (12.07.2) precise; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Tue, 10 Jul 2012 01:59:10 +0200
|
||||
|
||||
uberwriter (12.07.1-public1) precise; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Tue, 10 Jul 2012 01:58:32 +0200
|
||||
|
||||
uberwriter (12.07.1) precise; urgency=low
|
||||
|
||||
[ Wolf ]
|
||||
* New release.
|
||||
|
||||
[ wolf ]
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Tue, 10 Jul 2012 01:58:06 +0200
|
||||
|
||||
uberwriter (12.07) precise; urgency=low
|
||||
|
||||
* Creating ubuntu package
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 09 Jul 2012 14:10:54 +0200
|
||||
|
||||
uberwriter (0.1-public1) precise; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 09 Jul 2012 14:03:43 +0200
|
||||
|
||||
uberwriter (0.1) precise; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Mon, 09 Jul 2012 13:54:01 +0200
|
|
@ -0,0 +1 @@
|
|||
8
|
|
@ -0,0 +1,34 @@
|
|||
Source: uberwriter
|
||||
Section: python
|
||||
Priority: extra
|
||||
Build-Depends: debhelper (>= 8),
|
||||
python3 (>= 3.2.3-3~),
|
||||
python3-distutils-extra (>= 2.37-1~)
|
||||
Maintainer: Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
Standards-Version: 3.9.3
|
||||
X-Python-Version: >= 3.2.3
|
||||
|
||||
Package: uberwriter
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends},
|
||||
${python3:Depends},
|
||||
python3-enchant,
|
||||
gir1.2-gtk-3.0,
|
||||
gir1.2-pango-1.0,
|
||||
gir1.2-glib-2.0,
|
||||
python3-cairo,
|
||||
gir1.2-gdkpixbuf-2.0,
|
||||
python3-apt,
|
||||
gir1.2-webkit-3.0,
|
||||
pandoc,
|
||||
yelp,
|
||||
gnome-web-photo,
|
||||
ttf-ubuntu-font-family,
|
||||
dvipng
|
||||
Suggests: texlive
|
||||
Description: UberWriter, beautiful distraction free writing
|
||||
With UberWriter you get only one thing: An empty textbox, that is to
|
||||
fill with your ideas. There are no settings, you don't have to choose a
|
||||
font, it is only for writing.You can use markdown for all your markup
|
||||
needs. PDF, RTF and HTML are generated with pandoc. For PDF generation it
|
||||
is also required that you choose to install the texlive-luatex package.
|
|
@ -0,0 +1,17 @@
|
|||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: uberwriter
|
||||
Upstream-Contact: Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
Source: https://launchpad.com/uberwriter
|
||||
|
||||
Files: *
|
||||
Copyright: (C) 2007, Joe Smith
|
||||
Copyright: (C) 2010, Stuart Rackham
|
||||
Copyright: (C) 2012, Carlos Jenkins <carlos@jenkins.co.cr>
|
||||
Copyright: (C) 2012, Maximilian Köhl <linuxmaxi@googlemail.com>
|
||||
Copyright: (C) 2012, Rosetta Contributors and Canonical Ltd 2012
|
||||
Copyright: (C) 2012, Vova Kolobok <vovkkk@ya.ru>
|
||||
Copyright: (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
|
||||
License: GPL-3
|
||||
The full text of the GPL is distributed in
|
||||
/usr/share/common-licenses/GPL-3 on Debian systems.
|
|
@ -0,0 +1 @@
|
|||
uberwriter_12.11.04-public_all.deb python extra
|
|
@ -0,0 +1,5 @@
|
|||
uberwriter (0.1) precise; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Wolf <w.vollprecht@googlemail.com> Thu, 30 Aug 2012 08:12:09 +0200
|
|
@ -0,0 +1 @@
|
|||
8
|
|
@ -0,0 +1,29 @@
|
|||
Source: uberwriter
|
||||
Section: python
|
||||
Priority: extra
|
||||
Build-Depends: debhelper (>= 8),
|
||||
python (>= 2.6.6-3~),
|
||||
python-distutils-extra (>= 2.10)
|
||||
Maintainer: Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
Standards-Version: 3.9.3
|
||||
X-Python-Version: >= 2.6
|
||||
|
||||
Package: uberwriter
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends},
|
||||
${python:Depends},
|
||||
gir1.2-gtk-3.0,
|
||||
gir1.2-pango-1.0,
|
||||
gir1.2-glib-2.0,
|
||||
uberwriter,
|
||||
python-cairo,
|
||||
python-enchant,
|
||||
python-apt,
|
||||
yelp
|
||||
Description: A beautiful, simple and distraction free markdown editor.
|
||||
UberWriter, beautiful distraction free writing With UberWriter you get
|
||||
only one thing: An empty textbox, that is to fill with your ideas.
|
||||
There are no settings, you don't have to choose a font, it is only for
|
||||
writing.You can use markdown for all your markup needs. PDF, RTF and
|
||||
HTML are generated with pandoc. For PDF generation it is also required
|
||||
that you choose to install the texlive-luatex package.
|
|
@ -0,0 +1,13 @@
|
|||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: uberwriter
|
||||
Upstream-Contact: Wolf Vollprecht <w.vollprecht@gmail.com>
|
||||
Source: https://launchpad.com/uberwriter
|
||||
|
||||
Files: *
|
||||
Copyright: (C) 2007 Joe Smith
|
||||
Copyright: (C) 2012, Carlos Jenkins <carlos@jenkins.co.cr>
|
||||
Copyright: (C) 2012 Wolf Vollprecht <w.vollprecht@googlemail.com>
|
||||
Copyright: (C) 2012, Maximilian Köhl <linuxmaxi@googlemail.com>
|
||||
License: GPL-3
|
||||
The full text of the GPL is distributed in
|
||||
/usr/share/common-licenses/GPL-3 on Debian systems.
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/make -f
|
||||
%:
|
||||
ifneq ($(shell dh -l | grep -xF translations),)
|
||||
dh $@ --with python2,translations
|
||||
else
|
||||
dh $@ --with python2
|
||||
endif
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/make -f
|
||||
%:
|
||||
ifneq ($(shell dh -l | grep -xF translations),)
|
||||
dh $@ --with python3,translations
|
||||
else
|
||||
dh $@ --with python3
|
||||
endif
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install -- --install-scripts=/opt/extras.ubuntu.com/uberwriter/bin --install-data=/opt/extras.ubuntu.com/uberwriter --install-lib=/opt/extras.ubuntu.com/uberwriter
|
||||
|
||||
override_dh_python3:
|
||||
dh_python3 /opt/extras.ubuntu.com/uberwriter
|
||||
|
||||
override_dh_install:
|
||||
dh_install
|
||||
python3 setup.py install --root=$(CURDIR)/debian/uberwriter/ \
|
||||
--install-scripts=/opt/extras.ubuntu.com/uberwriter/bin \
|
||||
--install-data=/opt/extras.ubuntu.com/uberwriter \
|
||||
--install-lib=/opt/extras.ubuntu.com/uberwriter
|
||||
|
||||
cp uberwriter_lib/pylocales/locales.db debian/uberwriter/opt/extras.ubuntu.com/uberwriter/uberwriter_lib/pylocales/locales.db
|
|
@ -0,0 +1,49 @@
|
|||
dh_auto_configure
|
||||
dh_auto_build
|
||||
dh_auto_test
|
||||
dh_prep
|
||||
dh_installdirs
|
||||
override_dh_auto_install dh_auto_install
|
||||
dh_auto_install
|
||||
override_dh_install dh_install
|
||||
dh_install
|
||||
dh_installdocs
|
||||
dh_installchangelogs
|
||||
dh_installexamples
|
||||
dh_installman
|
||||
dh_installcatalogs
|
||||
dh_installcron
|
||||
dh_installdebconf
|
||||
dh_installemacsen
|
||||
dh_installifupdown
|
||||
dh_installinfo
|
||||
dh_pysupport
|
||||
dh_python3
|
||||
dh_installinit
|
||||
dh_installmenu
|
||||
dh_installmime
|
||||
dh_installmodules
|
||||
dh_installlogcheck
|
||||
dh_installlogrotate
|
||||
dh_installpam
|
||||
dh_installppp
|
||||
dh_installudev
|
||||
dh_installwm
|
||||
dh_installxfonts
|
||||
dh_installgsettings
|
||||
dh_bugfiles
|
||||
dh_ucf
|
||||
dh_lintian
|
||||
dh_gconf
|
||||
dh_icons
|
||||
dh_perl
|
||||
dh_usrlocal
|
||||
dh_link
|
||||
dh_translations
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
# Automatically added by dh_python3:
|
||||
if which py3compile >/dev/null 2>&1; then
|
||||
py3compile -p uberwriter /opt/extras.ubuntu.com/uberwriter
|
||||
fi
|
||||
|
||||
# End automatically added section
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
# Automatically added by dh_python3:
|
||||
if which py3clean >/dev/null 2>&1; then
|
||||
py3clean -p uberwriter
|
||||
fi
|
||||
|
||||
# End automatically added section
|
|
@ -0,0 +1,2 @@
|
|||
python3:Depends=python3, python3 (>= 3.2.3-3~)
|
||||
misc:Depends=
|
After Width: | Height: | Size: 669 B |
After Width: | Height: | Size: 582 B |
|
@ -0,0 +1,34 @@
|
|||
<page xmlns="http://projectmallard.org/1.0/"
|
||||
type="guide"
|
||||
id="index">
|
||||
|
||||
<info>
|
||||
<!-- This shows in the title bar so does not show [icon] -->
|
||||
<title type="text">UberWriter</title>
|
||||
<desc>The <app>UberWriter</app> help.</desc>
|
||||
<credit type="author">
|
||||
<name>Wolf Vollprecht</name>
|
||||
<email>w.vollprecht@gmail.com</email>
|
||||
<years>2012</years>
|
||||
</credit>
|
||||
<license href="http://creativecommons.org/licenses/by-sa/3.0/">
|
||||
<p>Creative Commons Attribution-Share Alike 3.0 Unported License</p>
|
||||
</license>
|
||||
</info>
|
||||
|
||||
<title>
|
||||
<!-- This shows on the page in title font -->
|
||||
<!-- the icon only shows when installed -->
|
||||
<media type="image" mime="image/png" src="figures/icon_down.png" width="16">[icon]</media>
|
||||
<app>UberWriter</app> Help
|
||||
</title>
|
||||
|
||||
<p>Help Topics for UberWriter:</p>
|
||||
|
||||
<!-- This is the visible index -->
|
||||
<section id="contents" style="2column">
|
||||
<!-- other pages needs to have a link to index#contents for this to work -->
|
||||
<title>Contents</title>
|
||||
</section>
|
||||
|
||||
</page>
|
|
@ -0,0 +1,128 @@
|
|||
<page xmlns="http://projectmallard.org/1.0/"
|
||||
type="topic"
|
||||
id="topic1">
|
||||
|
||||
<info>
|
||||
<link type="guide" xref="index#contents"/>
|
||||
<credit type="author">
|
||||
<name>Wolf Vollprecht</name>
|
||||
<email>w.vollprecht@gmail.com</email>
|
||||
<years>2012</years>
|
||||
</credit>
|
||||
<desc>Introducing Pandoc's Markdown</desc>
|
||||
</info>
|
||||
|
||||
<title>Pandoc's Markdown</title>
|
||||
<h1 id="markdown-tutorial-for-uberwriter">Markdown Tutorial for UberWriter</h1>
|
||||
<p>I will try to give a short impressions on how I use markdown/pandocs capabilities to greatly reduce the time spent on formatting anything – from websites to PDF Documents.</p>
|
||||
<p>You can find a much more exhaustive documentation for all features pandoc offers on pandoc’s help page: <a href="http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown">Link</a></p>
|
||||
<h3 id="headers">Headers</h3>
|
||||
<p>There are two styles for headers. One looks like this:</p>
|
||||
<h1 id="header-level-one">Header Level One</h1>
|
||||
<h2 id="header-level-two">Header Level Two</h2>
|
||||
<pre><code> ...</code></pre>
|
||||
<h6 id="header-level-six">Header Level Six</h6>
|
||||
<p>And another one, that has only »two« levels:</p>
|
||||
<h1 id="header-one">Header One</h1>
|
||||
<h2 id="header-two">Header Two</h2>
|
||||
<p>You can use both styles, whichever you prefer. Additionally, pandoc requires you to have a blank line before a header.</p>
|
||||
<h3 id="paragraphs">Paragraphs</h3>
|
||||
<p>A paragraph is one or more lines of text followed by one or more blank line. Newlines are treated as spaces. If you need a hard line break, put two or more spaces at the end of a line, or type a backslash at the end of a line.</p>
|
||||
<h3 id="block-quotations">Block quotations</h3>
|
||||
<p>Block quotations in markdown use the same convention as in emails. A generic block quote looks like this:</p>
|
||||
<blockquote>
|
||||
<p>This is a block quote. This paragraph has two lines.</p>
|
||||
<blockquote>
|
||||
<p>And block quotes can be nested, as well.</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p>Note the empty line you need to leave before the second level blockquote.</p>
|
||||
<h3 id="code-blocks">Code blocks</h3>
|
||||
<p>There are two ways of creating a code block. You can indent your code four spaces or one tab.</p>
|
||||
<pre><code>Code</code></pre>
|
||||
<p>Or use a fenced code block:</p>
|
||||
<pre class="sourceCode javascript"><code class="sourceCode javascript">a = <span class="kw">function</span>() {
|
||||
<span class="kw">return</span> <span class="dv">0</span>;
|
||||
}</code></pre>
|
||||
<p>Which works as well. You can identify the language of your code block to add syntax highlighting to the resulting document.</p>
|
||||
<p>Short code examples can be surrounded by backticks to make them appear verbatim: <code>this.code() == true</code>.</p>
|
||||
<h3 id="lists">Lists</h3>
|
||||
<h4 id="bullet-list">Bullet List:</h4>
|
||||
<ul>
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
</ul>
|
||||
<h4 id="nested-lists">Nested Lists:</h4>
|
||||
<ul>
|
||||
<li>fruits
|
||||
<ul>
|
||||
<li>pears</li>
|
||||
<li>peaches</li>
|
||||
</ul></li>
|
||||
<li>vegetables
|
||||
<ul>
|
||||
<li>broccoli</li>
|
||||
<li>ubuntu
|
||||
<ul>
|
||||
<li>mint</li>
|
||||
<li>lubuntu</li>
|
||||
<li>kubuntu</li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h4 id="numbered-lists">Numbered Lists:</h4>
|
||||
<ol style="list-style-type: decimal">
|
||||
<li>Item 1</li>
|
||||
<li>Item 2</li>
|
||||
<li>Item 3</li>
|
||||
</ol>
|
||||
<h3 id="title-blocks">Title blocks</h3>
|
||||
<p>To give your document some meta-information and a nice title, you can use title blocks at the top of your document:</p>
|
||||
<pre><code>% title
|
||||
% author(s) (separated by semicolons)
|
||||
% date</code></pre>
|
||||
<h3 id="inline-formatting">Inline formatting</h3>
|
||||
<p>Emphasizing some text is done by surrounding it with *s:</p>
|
||||
<p>This is <em>emphasized with asterisks</em>, and this will be a <strong>bold text</strong>. And even more <strong><em>krass</em></strong>. And if you want to erase something: <del>completely gone</del> (sorrounded by ~)</p>
|
||||
<h3 id="horizontal-rules">Horizontal Rules</h3>
|
||||
<p>Horizontal rules are easily created by putting three or more <code>***</code> or <code>---</code> on a line:</p>
|
||||
<hr />
|
||||
<h3 id="super--and-subscripts">Super- and subscripts</h3>
|
||||
<p>Superscripts may be written by surrounding the superscripted text by ^ characters; subscripts may be written by surrounding the subscripted text by ~ characters. Thus, for example,</p>
|
||||
<p>H<sub>2</sub>O is a liquid. 2<sup>10</sup> is 1024.</p>
|
||||
<h3 id="math">Math</h3>
|
||||
<p>There are two ways to generate math type setting in pandoc: Inline math looks like this:</p>
|
||||
<p>This is inline <span class="math">1 + 2 = 3</span> math.</p>
|
||||
<p>Note that there are no spaces allowed next to the dollar signs.</p>
|
||||
<p>And there is also another format:</p>
|
||||
<p>This is a beautiful equation: <br /><span class="math">∣∑ <sub><em>i</em> = 1</sub><sup><em>n</em></sup><em>x</em><sub><em>i</em></sub><em>ȳ</em><sub><em>i</em></sub>∣<sup>2</sup> ≤ ∑ <sub><em>j</em> = 1</sub><sup><em>n</em></sup>∣<em>x</em><sub><em>j</em></sub>∣<sup>2</sup>∑ <sub><em>k</em> = 1</sub><sup><em>n</em></sup>∣<em>y</em><sub><em>k</em></sub>∣<sup>2</sup></span><br /> And it stands on it’s own.</p>
|
||||
<h3 id="links">Links</h3>
|
||||
<p>Enclosing an URL in pointy brackets transforms them into links:</p>
|
||||
<p><a href="http://johnmacfarlane.net/pandoc"><code class="url">http://johnmacfarlane.net/pandoc</code></a> <script type="text/javascript">
|
||||
<!--
|
||||
h='mustermann.de';a='@';n='max';e=n+a+h;
|
||||
document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'<code>'+e+'</code>'+'<\/'+'a'+'>');
|
||||
// -->
|
||||
</script><noscript>max at mustermann dot de</noscript></p>
|
||||
<h4 id="inline-links">Inline Links:</h4>
|
||||
<p>This is an <a href="/url">inline link</a>, and here’s <a href="http://fsf.org" title="click here for a good time!">one with a title</a>.</p>
|
||||
<h3 id="images">Images</h3>
|
||||
<div class="figure">
|
||||
<img src="/url/of/image.png" alt="This is the caption" /><p class="caption">This is the caption</p>
|
||||
</div>
|
||||
<h3 id="footnotes">Footnotes</h3>
|
||||
<p>An example for footnotes (you can place the referenced footnote wherever you want, e.g. at the bottom of your document):</p>
|
||||
<p>Here is a footnote reference,<sup><a href="#fn1" class="footnoteRef" id="fnref1">1</a></sup> and another.<sup><a href="#fn2" class="footnoteRef" id="fnref2">2</a></sup></p>
|
||||
<p>There is also a different format for inline footnotes, that are easier to write:</p>
|
||||
<p>Here is an inline note.<sup><a href="#fn3" class="footnoteRef" id="fnref3">3</a></sup></p>
|
||||
<div class="footnotes">
|
||||
<hr />
|
||||
<ol>
|
||||
<li id="fn1"><p>Here is the footnote.<a href="#fnref1">↩</a></p></li>
|
||||
<li id="fn2"><p>Here’s one with multiple blocks. Subsequent paragraphs are indented to show that they belong to the previous footnote. The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.<a href="#fnref2">↩</a></p></li>
|
||||
<li id="fn3"><p>Inlines notes are easier to write, since you don’t have to pick an identifier and move down to type the note.<a href="#fnref3">↩</a></p></li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
</page>
|
|
@ -0,0 +1,34 @@
|
|||
<page xmlns="http://projectmallard.org/1.0/"
|
||||
type="topic"
|
||||
id="preferences">
|
||||
|
||||
<info>
|
||||
<link type="guide" xref="index#contents"/>
|
||||
<credit type="author">
|
||||
<name>Wolf Vollprecht</name>
|
||||
<email>w.vollprecht@gmail.com</email>
|
||||
<years>2012</years>
|
||||
</credit>
|
||||
<desc>UberWriters preview functionalities</desc>
|
||||
</info>
|
||||
|
||||
<title>UberWriter Preview</title>
|
||||
<p>There are 2 different ways to preview your MarkDown files in UberWriter and
|
||||
quickly check, what you have written.
|
||||
</p>
|
||||
<section id="inline-preview">
|
||||
<title>Inline Preview</title>
|
||||
<p>
|
||||
If you have e.g. math, you can open the context menu with a <em>right click</em>
|
||||
on your formula and will get a quick preview of your equation inside the context menu.
|
||||
This will work not only for math, but also for links, footnotes and
|
||||
images.
|
||||
</p>
|
||||
</section>
|
||||
<section>
|
||||
<title>Complete Preview</title>
|
||||
<p>If you want a complete Preview of your document, you just need to hit the
|
||||
preview Button on the statusbar at the bottom of the UberWriter window.
|
||||
It will render the complete HTML Output of your MarkDown file.</p>
|
||||
</section>
|
||||
</page>
|
|
@ -0,0 +1,408 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="author" content="John MacFarlane, Wolf Vollprecht" />
|
||||
<title>UberWriter & Pandoc User Guide</title>
|
||||
<link rel="stylesheet" href="file:////home/wolf/Programme/uberwriter/data/media/uberwriter.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<h1 class="title">UberWriter & Pandoc User Guide</h1>
|
||||
<h2 class="author">John MacFarlane, Wolf Vollprecht</h2>
|
||||
<h3 class="date">01.08.2012</h3>
|
||||
</div>
|
||||
<h2 id="uberwriters-goals">UberWriter’s goals</h2>
|
||||
<p>UberWriter aims to make the writing process very easy and beautiful. The editor offers inline highlighting for a specific subset of markdown, which is used to do the formatting of your text.</p>
|
||||
<p>A short explanation of the core markdown features you’ll find below. Pandoc is used to generate PDF, HTML or RTF files from markdown. Please note that Pandoc’s syntax offers many, many more features which are well documented on the (pandoc homepage)[http://johnmacfarlane.net/pandoc/README.html].<br />However, please note that not all of the advanced features play well with inline highlighting of UberWriter.</p>
|
||||
<p>But for a quick start, this will be sufficient.</p>
|
||||
<h2 id="pandocs-markdown">Pandoc’s markdown</h2>
|
||||
<p>Pandoc understands an extended and slightly revised version of John Gruber’s [markdown] syntax. This document explains the syntax, noting differences from standard markdown.</p>
|
||||
<h3 id="philosophy">Philosophy</h3>
|
||||
<p>Markdown is designed to be easy to write, and, even more importantly, easy to read:</p>
|
||||
<blockquote>
|
||||
<p>A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. – <a href="http://daringfireball.net/projects/markdown/syntax#philosophy">John Gruber</a></p>
|
||||
</blockquote>
|
||||
<p>This principle has guided pandoc’s decisions in finding syntax for tables, footnotes, and other extensions.</p>
|
||||
<h3 id="paragraphs">Paragraphs</h3>
|
||||
<p>A paragraph is one or more lines of text followed by one or more blank line. Newlines are treated as spaces, so you can reflow your paragraphs as you like. If you need a hard line break, put two or more spaces at the end of a line.</p>
|
||||
<p>A backslash followed by a newline is also a hard line break.</p>
|
||||
<h3 id="headers">Headers</h3>
|
||||
<p>An header consists of one to six <code>#</code> signs and a line of text, optionally followed by any number of <code>#</code> signs. The number of <code>#</code> signs at the beginning of the line is the header level:</p>
|
||||
<pre><code>## A level-two header
|
||||
|
||||
### A level-three header ###</code></pre>
|
||||
<p>As with setext-style headers, the header text can contain formatting:</p>
|
||||
<pre><code># A level-one header with a [link](/url) and *emphasis*</code></pre>
|
||||
<p>Standard markdown syntax does not require a blank line before a header. Pandoc does require this (except, of course, at the beginning of the document).</p>
|
||||
<h3 id="inline-formatting">Inline formatting</h3>
|
||||
<p>To <em>emphasize</em> some text, surround it with <code>*</code>s or <code>_</code>, like this:</p>
|
||||
<pre><code>This text is _emphasized with underscores_, and this
|
||||
is *emphasized with asterisks*.</code></pre>
|
||||
<p>Double <code>*</code> or <code>_</code> produces <strong>strong emphasis</strong>:</p>
|
||||
<pre><code>This is **strong emphasis** and __with underscores__.</code></pre>
|
||||
<p>A <code>*</code> or <code>_</code> character surrounded by spaces, or backslash-escaped, will not trigger emphasis:</p>
|
||||
<pre><code>This is * not emphasized *, and \*neither is this\*.</code></pre>
|
||||
<p>Because <code>_</code> is sometimes used inside words and identifiers, pandoc does not interpret a <code>_</code> surrounded by alphanumeric characters as an emphasis marker. If you want to emphasize just part of a word, use <code>*</code>:</p>
|
||||
<pre><code>feas*ible*, not feas*able*.</code></pre>
|
||||
<h4 id="strikeout">Strikeout</h4>
|
||||
<p>To strikeout a section of text with a horizontal line, begin and end it with <code>~~</code>. Thus, for example,</p>
|
||||
<pre><code>This ~~is deleted text.~~</code></pre>
|
||||
<h3 id="block-quotations">Block quotations</h3>
|
||||
<p>Markdown uses email conventions for quoting blocks of text. A block quotation is one or more paragraphs or other block elements (such as lists or headers), with each line preceded by a <code>></code> character and a space.</p>
|
||||
<blockquote>
|
||||
<p>This is a block quote. This paragraph does indeed have more than one line.</p>
|
||||
<ol style="list-style-type: decimal">
|
||||
<li>This is a list inside a block quote.</li>
|
||||
<li>Second item.</li>
|
||||
</ol>
|
||||
</blockquote>
|
||||
<p>Among the block elements that can be contained in a block quote are other block quotes. That is, block quotes can be nested:</p>
|
||||
<blockquote>
|
||||
<p>This is a block quote.</p>
|
||||
<blockquote>
|
||||
<p>A block quote within a block quote.</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p><strong>Standard markdown syntax does not require a blank line before a block quote. Pandoc does require this (except, of course, at the beginning of the document).</strong></p>
|
||||
<p>The following does not produce a nested block quote in pandoc:</p>
|
||||
<blockquote>
|
||||
<p>This is a block quote. > Nested.</p>
|
||||
</blockquote>
|
||||
<h3 id="verbatim-code-blocks">Verbatim (code) blocks</h3>
|
||||
<h4 id="indented-code-blocks">Indented code blocks</h4>
|
||||
<p>A block of text indented four spaces (or one tab) is treated as verbatim text: that is, special characters do not trigger special formatting, and all spaces and line breaks are preserved. For example,</p>
|
||||
<pre><code> if (a > 3) {
|
||||
moveShip(5 * gravity, DOWN);
|
||||
}</code></pre>
|
||||
<p>The initial (four space or one tab) indentation is not considered part of the verbatim text, and is removed in the output.</p>
|
||||
<p>Note: blank lines in the verbatim text need not begin with four spaces.</p>
|
||||
<h3 id="lists">Lists</h3>
|
||||
<h4 id="bullet-lists">Bullet lists</h4>
|
||||
<p>A bullet list is a list of bulleted list items. A bulleted list item begins with a bullet (<code>*</code>, <code>+</code>, or <code>-</code>). Here is a simple example:</p>
|
||||
<ul>
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
</ul>
|
||||
<h3 id="the-four-space-rule">The four-space rule</h3>
|
||||
<p>A list item may contain multiple paragraphs and other block-level content. However, subsequent paragraphs must be preceded by a blank line and indented four spaces or a tab. The list will look better if the first paragraph is aligned with the rest:</p>
|
||||
<ul>
|
||||
<li>First paragraph.</li>
|
||||
</ul>
|
||||
<p>Continued.</p>
|
||||
<ul>
|
||||
<li><p>Second paragraph. With a code block, which must be indented two tabs:</p>
|
||||
<pre><code>{ code }</code></pre></li>
|
||||
</ul>
|
||||
<p>List items may include other lists. In this case the preceding blank line is optional. The nested list must be indented one tab:</p>
|
||||
<ul>
|
||||
<li>fruits
|
||||
<ul>
|
||||
<li>apples
|
||||
<ul>
|
||||
<li>macintosh</li>
|
||||
<li>red delicious</li>
|
||||
</ul></li>
|
||||
<li>pears</li>
|
||||
<li>peaches</li>
|
||||
</ul></li>
|
||||
<li>vegetables
|
||||
<ul>
|
||||
<li>brocolli</li>
|
||||
<li>chard</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h3 id="ordered-lists">Ordered lists</h3>
|
||||
<p>Ordered lists work just like bulleted lists, except that the items begin with enumerators rather than bullets.</p>
|
||||
<p>In standard markdown, enumerators are decimal numbers followed by a period and a space. The numbers themselves are ignored, so there is no difference between this list:</p>
|
||||
<ol style="list-style-type: decimal">
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
</ol>
|
||||
<p>and this one:</p>
|
||||
<ol start="5" style="list-style-type: decimal">
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
</ol>
|
||||
<p>Unlike standard markdown, Pandoc allows ordered list items to be marked with uppercase and lowercase letters and roman numerals, in addition to arabic numerals. List markers may be enclosed in parentheses or followed by a single right-parentheses or period. They must be separated from the text that follows by at least one space, and, if the list marker is a capital letter with a period, by at least two spaces.</p>
|
||||
<p>Pandoc also pays attention to the type of list marker used, and to the starting number, and both of these are preserved where possible in the output format. Thus, the following yields a list with numbers followed by a single parenthesis, starting with 9, and a sublist with lowercase roman numerals:</p>
|
||||
<ol start="9" style="list-style-type: decimal">
|
||||
<li>Ninth</li>
|
||||
<li>Tenth</li>
|
||||
<li>Eleventh
|
||||
<ol style="list-style-type: lower-roman">
|
||||
<li>subone</li>
|
||||
<li>subtwo</li>
|
||||
<li>subthree</li>
|
||||
</ol></li>
|
||||
</ol>
|
||||
<p>Pandoc will start a new list each time a different type of list marker is used. So, the following will create three lists:</p>
|
||||
<ol start="2" style="list-style-type: decimal">
|
||||
<li>Two</li>
|
||||
<li>Three</li>
|
||||
</ol>
|
||||
<ol style="list-style-type: decimal">
|
||||
<li>Four</li>
|
||||
</ol>
|
||||
<ul>
|
||||
<li>Five</li>
|
||||
</ul>
|
||||
<p>If default list markers are desired, use <code>#.</code>:</p>
|
||||
<ol>
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
</ol>
|
||||
<h3 id="definition-lists">Definition lists</h3>
|
||||
<p>Pandoc supports definition lists:</p>
|
||||
<dl>
|
||||
<dt>Term 1</dt>
|
||||
<dd><p>Definition 1</p>
|
||||
</dd>
|
||||
<dt>Term 2 with <em>inline markup</em></dt>
|
||||
<dd><p>Definition 2</p>
|
||||
<pre><code>{ some code, part of Definition 2 }
|
||||
|
||||
Third paragraph of definition 2.</code></pre>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>Each term must fit on one line, which may optionally be followed by a blank line, and must be followed by one or more definitions. A definition begins with a colon or tilde, which may be indented one or two spaces. The body of the definition (including the first line, aside from the colon or tilde) should be indented four spaces. A term may have multiple definitions, and each definition may consist of one or more block elements (paragraph, code block, list, etc.), each indented four spaces or one tab stop.</p>
|
||||
<p>If you leave space after the definition (as in the example above), the blocks of the definitions will be considered paragraphs. In some output formats, this will mean greater spacing between term/definition pairs. For a compact definition list, do not leave space between the definition and the next term:</p>
|
||||
<pre><code>Term 1
|
||||
~ Definition 1
|
||||
Term 2
|
||||
~ Definition 2a
|
||||
~ Definition 2b</code></pre>
|
||||
<h3 id="numbered-example-lists">Numbered example lists</h3>
|
||||
<p>The special list marker <code>@</code> can be used for sequentially numbered examples. The first list item with a <code>@</code> marker will be numbered ‘1’, the next ‘2’, and so on, throughout the document. The numbered examples need not occur in a single list; each new list using <code>@</code> will take up where the last stopped. So, for example:</p>
|
||||
<pre><code>(@) My first example will be numbered (1).
|
||||
(@) My second example will be numbered (2).
|
||||
|
||||
Explanation of examples.
|
||||
|
||||
(@) My third example will be numbered (3).</code></pre>
|
||||
<p>Numbered examples can be labeled and referred to elsewhere in the document:</p>
|
||||
<pre><code>(@good) This is a good example.
|
||||
|
||||
As (@good) illustrates, ...</code></pre>
|
||||
<p>The label can be any string of alphanumeric characters, underscores, or hyphens.</p>
|
||||
<h3 id="ending-a-list">Ending a list</h3>
|
||||
<p>What if you want to put an indented code block after a list?</p>
|
||||
<pre><code>- item one
|
||||
- item two
|
||||
|
||||
{ my code block }</code></pre>
|
||||
<p>Trouble! Here pandoc (like other markdown implementations) will treat <code>{ my code block }</code> as the second paragraph of item two, and not as a code block.</p>
|
||||
<p>To “cut off” the list after item two, you can insert some non-indented content, like an HTML comment, which won’t produce visible output in any format:</p>
|
||||
<pre><code>- item one
|
||||
- item two
|
||||
|
||||
<!-- end of list -->
|
||||
|
||||
{ my code block }</code></pre>
|
||||
<p>You can use the same trick if you want two consecutive lists instead of one big list:</p>
|
||||
<pre><code>1. one
|
||||
2. two
|
||||
3. three
|
||||
|
||||
<!-- -->
|
||||
|
||||
1. uno
|
||||
2. dos
|
||||
3. tres</code></pre>
|
||||
<h3 id="horizontal-rules">Horizontal rules</h3>
|
||||
<p>A line containing a row of three or more <code>*</code>, <code>-</code>, or <code>_</code> characters (optionally separated by spaces) produces a horizontal rule:</p>
|
||||
<hr />
|
||||
<h3 id="title-block">Title block</h3>
|
||||
<p>If the file begins with a title block</p>
|
||||
<pre><code>% title
|
||||
% author(s) (separated by semicolons)
|
||||
% date</code></pre>
|
||||
<p>it will be parsed as bibliographic information, not regular text. The block may contain just a title, a title and an author, or all three elements. If you want to include an author but no title, or a title and a date but no author, you need a blank line:</p>
|
||||
<pre><code>%
|
||||
% Author</code></pre>
|
||||
<p>or</p>
|
||||
<pre><code>% My title
|
||||
%
|
||||
% June 15, 2006</code></pre>
|
||||
<p>If a document has multiple authors, the authors may be separated by semicolons.</p>
|
||||
<pre><code>% Author One; Author Two</code></pre>
|
||||
<p>All three metadata fields may contain standard inline formatting (italics, links, footnotes, etc.).</p>
|
||||
<h3 id="backslash-escapes">Backslash escapes</h3>
|
||||
<p>Except inside a code block or inline code, any punctuation or space character preceded by a backslash will be treated literally, even if it would normally indicate formatting.</p>
|
||||
<p>Thus, for example, if one writes</p>
|
||||
<pre><code>*\*hello\**</code></pre>
|
||||
<p>one will get</p>
|
||||
<pre><code><em>*hello*</em></code></pre>
|
||||
<p>instead of</p>
|
||||
<pre><code><strong>hello</strong></code></pre>
|
||||
<p>A backslash-escaped space is parsed as a nonbreaking space.</p>
|
||||
<p>A backslash-escaped newline (i.e. a backslash occurring at the end of a line) is parsed as a hard line break.</p>
|
||||
<p>Backslash escapes do not work in verbatim contexts.</p>
|
||||
<h3 id="smart-punctuation">Smart punctuation</h3>
|
||||
<p>Pandoc will produce typographically correct output, converting straight quotes to curly quotes, <code>---</code> to em-dashes, <code>--</code> to en-dashes, and <code>...</code> to ellipses. Nonbreaking spaces are inserted after certain abbreviations, such as “Mr.”</p>
|
||||
<h3 id="delimited-code-blocks">Delimited code blocks</h3>
|
||||
<p>In addition to standard indented code blocks, Pandoc supports <em>delimited</em> code blocks. These begin with a row of three or more tildes (<code>~</code>) or backticks (<code>`</code>) and end with a row of tildes or backticks that must be at least as long as the starting row. Everything between these lines is treated as code. No indentation is necessary:</p>
|
||||
<pre><code>~~~~~~~
|
||||
if (a > 3) {
|
||||
moveShip(5 * gravity, DOWN);
|
||||
}
|
||||
~~~~~~~</code></pre>
|
||||
<p>Like regular code blocks, delimited code blocks must be separated from surrounding text by blank lines.</p>
|
||||
<p>To specify the language of the code block:</p>
|
||||
<pre><code>```haskell
|
||||
qsort [] = []
|
||||
```</code></pre>
|
||||
<p>which yields:</p>
|
||||
<pre><code><pre id="mycode" class="haskell">
|
||||
<code>
|
||||
...
|
||||
</code>
|
||||
</pre></code></pre>
|
||||
<h3 id="verbatim">Verbatim</h3>
|
||||
<p>To make a short span of text verbatim, put it inside backticks:</p>
|
||||
<pre><code>What is the difference between `>>=` and `>>`?</code></pre>
|
||||
<p>If the verbatim text includes a backtick, use double backticks:</p>
|
||||
<pre><code>Here is a literal backtick `` ` ``.</code></pre>
|
||||
<p>(The spaces after the opening backticks and before the closing backticks will be ignored.)</p>
|
||||
<p>The general rule is that a verbatim span starts with a string of consecutive backticks (optionally followed by a space) and ends with a string of the same number of backticks (optionally preceded by a space).</p>
|
||||
<p>Note that backslash-escapes (and other markdown constructs) do not work in verbatim contexts:</p>
|
||||
<pre><code>This is a backslash followed by an asterisk: `\*`.</code></pre>
|
||||
<h3 id="superscripts-and-subscripts">Superscripts and subscripts</h3>
|
||||
<p>Superscripts may be written by surrounding the superscripted text by <code>^</code> characters; subscripts may be written by surrounding the subscripted text by <code>~</code> characters.</p>
|
||||
<p>Thus, for example,</p>
|
||||
<pre><code>H~2~O is a liquid. 2^10^ is 1024.</code></pre>
|
||||
<p>If the superscripted or subscripted text contains spaces, these spaces must be escaped with backslashes. (This is to prevent accidental superscripting and subscripting through the ordinary use of <code>~</code> and <code>^</code>.)</p>
|
||||
<p>Thus, if you want the letter P with ‘a cat’ in subscripts, use <code>P~a\ cat~</code>, not <code>P~a cat~</code>.</p>
|
||||
<h3 id="math">Math</h3>
|
||||
<p>Anything between two <code>$</code> characters will be treated as TeX math. The opening <code>$</code> must have a character immediately to its right, while the closing <code>$</code> must have a character immediately to its left. Thus, <code>$20,000 and $30,000</code> won’t parse as math. If for some reason you need to enclose text in literal <code>$</code> characters, backslash-escape them and they won’t be treated as math delimiters.</p>
|
||||
<p>TeX math will be printed in all output formats. How it is rendered depends on the output format:</p>
|
||||
<ul>
|
||||
<li>HTML: with (mathjax)[http://www.mathjax.org/]</li>
|
||||
<li>Latex: with Latex</li>
|
||||
</ul>
|
||||
<h3 id="raw-html">Raw HTML</h3>
|
||||
<p>Markdown allows you to insert raw HTML anywhere in a document (except verbatim contexts, where <code><</code>, <code>></code>, and <code>&</code> are interpreted literally).</p>
|
||||
<p>Standard markdown allows you to include HTML “blocks”: blocks of HTML between balanced tags that are separated from the surrounding text with blank lines, and start and end at the left margin.</p>
|
||||
<p>Within these blocks, everything is interpreted as HTML, not markdown; so (for example), <code>*</code> does not signify emphasis.</p>
|
||||
<p>Pandoc interprets material between HTML block tags as markdown. Thus, for example, Pandoc will turn</p>
|
||||
<pre><code><table>
|
||||
<tr>
|
||||
<td>*one*</td>
|
||||
<td>[a link](http://google.com)</td>
|
||||
</tr>
|
||||
</table></code></pre>
|
||||
<p>into</p>
|
||||
<pre><code><table>
|
||||
<tr>
|
||||
<td><em>one</em></td>
|
||||
<td><a href="http://google.com">a link</a></td>
|
||||
</tr>
|
||||
</table></code></pre>
|
||||
<p>There is one exception to this rule: text between <code><script></code> and <code><style></code> tags is not interpreted as markdown.</p>
|
||||
<h3 id="raw-tex">Raw TeX</h3>
|
||||
<p>In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be included in a document. Inline TeX commands will be preserved and passed unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to include BibTeX citations:</p>
|
||||
<pre><code>This result was proved in \cite{jones.1967}.</code></pre>
|
||||
<p>Note that in LaTeX environments, like</p>
|
||||
<pre><code>\begin{tabular}{|l|l|}\hline
|
||||
Age & Frequency \\ \hline
|
||||
18--25 & 15 \\
|
||||
26--35 & 33 \\
|
||||
36--45 & 22 \\ \hline
|
||||
\end{tabular}</code></pre>
|
||||
<p>the material between the begin and end tags will be interpreted as raw LaTeX, not as markdown.</p>
|
||||
<p>Inline LaTeX is ignored in output formats other than Markdown, LaTeX, and ConTeXt.</p>
|
||||
<h3 id="latex-macros">LaTeX macros</h3>
|
||||
<p>For output formats other than LaTeX, pandoc will parse LaTeX <code>\newcommand</code> and <code>\renewcommand</code> definitions and apply the resulting macros to all LaTeX math. So, for example, the following will work in all output formats, not just LaTeX:</p>
|
||||
<pre><code>\newcommand{\tuple}[1]{\langle #1 \rangle}
|
||||
|
||||
$\tuple{a, b, c}$</code></pre>
|
||||
<p>In LaTeX output, the <code>\newcommand</code> definition will simply be passed unchanged to the output.</p>
|
||||
<h3 id="links">Links</h3>
|
||||
<p>Markdown allows links to be specified in several ways.</p>
|
||||
<h4 id="automatic-links">Automatic links</h4>
|
||||
<p>If you enclose a URL or email address in pointy brackets, it will become a link:</p>
|
||||
<pre><code><http://google.com>
|
||||
<sam@green.eggs.ham></code></pre>
|
||||
<p>Pandoc will render autolinked URLs and email addresses as inline code.</p>
|
||||
<h4 id="inline-links">Inline links</h4>
|
||||
<p>An inline link consists of the link text in square brackets, followed by the URL in parentheses. (Optionally, the URL can be followed by a link title, in quotes.)</p>
|
||||
<pre><code>This is an [inline link](/url), and here's [one with
|
||||
a title](http://fsf.org "click here for a good time!").</code></pre>
|
||||
<p>There can be no space between the bracketed part and the parenthesized part. The link text can contain formatting (such as emphasis), but the title cannot.</p>
|
||||
<h3 id="reference-links">Reference links</h3>
|
||||
<p>An <em>explicit</em> reference link has two parts, the link itself and the link definition, which may occur elsewhere in the document (either before or after the link).</p>
|
||||
<p>The link consists of link text in square brackets, followed by a label in square brackets. (There can be space between the two.) The link definition must begin at the left margin or indented no more than three spaces. It consists of the bracketed label, followed by a colon and a space, followed by the URL, and optionally (after a space) a link title either in quotes or in parentheses.</p>
|
||||
<p>Here are some examples:</p>
|
||||
<pre><code>[my label 1]: /foo/bar.html "My title, optional"
|
||||
[my label 2]: /foo
|
||||
[my label 3]: http://fsf.org (The free software foundation)
|
||||
[my label 4]: /bar#special 'A title in single quotes'</code></pre>
|
||||
<p>The URL may optionally be surrounded by angle brackets:</p>
|
||||
<pre><code>[my label 5]: <http://foo.bar.baz></code></pre>
|
||||
<p>The title may go on the next line:</p>
|
||||
<pre><code>[my label 3]: http://fsf.org
|
||||
"The free software foundation"</code></pre>
|
||||
<p>Note that link labels are not case sensitive. So, this will work:</p>
|
||||
<pre><code>Here is [my link][FOO]
|
||||
|
||||
[Foo]: /bar/baz</code></pre>
|
||||
<p>In an <em>implicit</em> reference link, the second pair of brackets is empty, or omitted entirely:</p>
|
||||
<pre><code>See [my website][], or [my website].
|
||||
|
||||
[my website]: http://foo.bar.baz</code></pre>
|
||||
<h3 id="internal-links">Internal links</h3>
|
||||
<p>To link to another section of the same document, use the automatically generated identifier (see <a href="#header-identifiers-in-html-latex-and-context">Header identifiers in HTML, LaTeX, and ConTeXt</a>, below). For example:</p>
|
||||
<pre><code>See the [Introduction](#introduction).</code></pre>
|
||||
<p>or</p>
|
||||
<pre><code>See the [Introduction].
|
||||
|
||||
[Introduction]: #introduction</code></pre>
|
||||
<p>Internal links are currently supported for HTML formats (including HTML slide shows and EPUB), LaTeX, and ConTeXt.</p>
|
||||
<h3 id="images">Images</h3>
|
||||
<p>A link immediately preceded by a <code>!</code> will be treated as an image. The link text will be used as the image’s alt text:</p>
|
||||
<pre><code>![la lune](lalune.jpg "Voyage to the moon")
|
||||
|
||||
![movie reel]
|
||||
|
||||
[movie reel]: movie.gif</code></pre>
|
||||
<h3 id="pictures-with-captions">Pictures with captions</h3>
|
||||
<p>An image occurring by itself in a paragraph will be rendered as a figure with a caption.[^5] (In LaTeX, a figure environment will be used; in HTML, the image will be placed in a <code><div></code> with class <code>.figure</code>, together with a caption in a <code>p</code> with class <code>caption</code>.) The image’s alt text will be used as the caption.</p>
|
||||
<pre><code>![This is the caption](/url/of/image.png)</code></pre>
|
||||
<p>If you just want a regular inline image, just make sure it is not the only thing in the paragraph. One way to do this is to insert a nonbreaking space after the image:</p>
|
||||
<pre><code>![This image won't be a figure](/url/of/image.png)\</code></pre>
|
||||
<h3 id="footnotes">Footnotes</h3>
|
||||
<p>Pandoc’s markdown allows footnotes, using the following syntax:</p>
|
||||
<pre><code>Here is a footnote reference,[^1] and another.[^longnote]
|
||||
|
||||
[^1]: Here is the footnote.
|
||||
|
||||
[^longnote]: Here's one with multiple blocks.
|
||||
|
||||
Subsequent paragraphs are indented to show that they
|
||||
belong to the previous footnote.
|
||||
|
||||
{ some.code }
|
||||
|
||||
The whole paragraph can be indented, or just the first
|
||||
line. In this way, multi-paragraph footnotes work like
|
||||
multi-paragraph list items.
|
||||
|
||||
This paragraph won't be part of the note, because it
|
||||
isn't indented.</code></pre>
|
||||
<p>The identifiers in footnote references may not contain spaces, tabs, or newlines. These identifiers are used only to correlate the footnote reference with the note itself; in the output, footnotes will be numbered sequentially.</p>
|
||||
<p>The footnotes themselves need not be placed at the end of the document. They may appear anywhere except inside other block elements (lists, block quotes, tables, etc.).</p>
|
||||
<p>Inline footnotes are also allowed (though, unlike regular notes, they cannot contain multiple paragraphs).</p>
|
||||
<p>The syntax is as follows:</p>
|
||||
<pre><code>Here is an inline note.^[Inlines notes are easier to write, since you don't have to pick an identifier and move down to type the note.]</code></pre>
|
||||
<p>Inline and regular footnotes may be mixed freely.</p>
|
||||
<h2 id="authors-of-this-documentation">Authors of this documentation</h2>
|
||||
<p>© 2006-2012 John MacFarlane (jgm at berkeley dot edu). Released under the [GPL], version 2 or greater. This software carries no warranty of any kind. (See COPYRIGHT for full copyright and warranty notices.) Other contributors include Recai Oktaş, Paulo Tanimoto, Peter Wang, Andrea Rossato, Eric Kow, infinity0x, Luke Plant, shreevatsa.public, Puneeth Chaganti, Paul Rivier, rodja.trappe, Bradley Kuhn, thsutton, Nathan Gass, Jonathan Daugherty, Jérémy Bobbio, Justin Bogner, qerub, Christopher Sawicki, Kelsey Hightower, Masayoshi Takahashi, Antoine Latter, Ralf Stephan, Eric Seidel, B. Scott Michel, Gavin Beatty, Sergey Astanin.</p>
|
||||
<p>© Reworked for UberWriter: Wolf Vollprecht</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,610 @@
|
|||
% UberWriter & Pandoc User Guide
|
||||
% John MacFarlane, Wolf Vollprecht
|
||||
% 01.08.2012
|
||||
|
||||
## UberWriter's goals
|
||||
|
||||
UberWriter aims to make the writing process very easy and beautiful. The editor offers inline highlighting for a specific subset of markdown, which is used to do the formatting of your text.
|
||||
|
||||
A short explanation of the core markdown features you'll find below. Pandoc is used to generate PDF, HTML or RTF files from markdown. Please note that Pandoc's syntax offers many, many more features which are well documented on the (pandoc homepage)[http://johnmacfarlane.net/pandoc/README.html].
|
||||
However, please note that not all of the advanced features play well with inline highlighting of UberWriter.
|
||||
|
||||
But for a quick start, this will be sufficient.
|
||||
|
||||
## Pandoc's markdown
|
||||
|
||||
Pandoc understands an extended and slightly revised version of
|
||||
John Gruber's [markdown] syntax. This document explains the syntax, noting differences from standard markdown.
|
||||
|
||||
### Philosophy
|
||||
|
||||
Markdown is designed to be easy to write, and, even more importantly, easy to read:
|
||||
|
||||
> A Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions.
|
||||
> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
|
||||
|
||||
This principle has guided pandoc's decisions in finding syntax for
|
||||
tables, footnotes, and other extensions.
|
||||
|
||||
### Paragraphs
|
||||
|
||||
A paragraph is one or more lines of text followed by one or more blank line. Newlines are treated as spaces, so you can reflow your paragraphs as you like. If you need a hard line break, put two or more spaces at the end of a line.
|
||||
|
||||
A backslash followed by a newline is also a hard line break.
|
||||
|
||||
### Headers
|
||||
|
||||
An header consists of one to six `#` signs and a line of text, optionally followed by any number of `#` signs.
|
||||
The number of `#` signs at the beginning of the line is the header level:
|
||||
|
||||
## A level-two header
|
||||
|
||||
### A level-three header ###
|
||||
|
||||
As with setext-style headers, the header text can contain formatting:
|
||||
|
||||
# A level-one header with a [link](/url) and *emphasis*
|
||||
|
||||
Standard markdown syntax does not require a blank line before a header. Pandoc does require this (except, of course, at the beginning of the document).
|
||||
|
||||
### Inline formatting
|
||||
|
||||
To *emphasize* some text, surround it with `*`s or `_`, like this:
|
||||
|
||||
This text is _emphasized with underscores_, and this
|
||||
is *emphasized with asterisks*.
|
||||
|
||||
Double `*` or `_` produces **strong emphasis**:
|
||||
|
||||
This is **strong emphasis** and __with underscores__.
|
||||
|
||||
A `*` or `_` character surrounded by spaces, or backslash-escaped,
|
||||
will not trigger emphasis:
|
||||
|
||||
This is * not emphasized *, and \*neither is this\*.
|
||||
|
||||
Because `_` is sometimes used inside words and identifiers, pandoc does not interpret a `_` surrounded by alphanumeric characters as an emphasis marker. If you want to emphasize just part of a word, use `*`:
|
||||
|
||||
feas*ible*, not feas*able*.
|
||||
|
||||
### Strikeout
|
||||
|
||||
To strikeout a section of text with a horizontal line, begin and end it with `~~`. Thus, for example,
|
||||
|
||||
This ~~is deleted text.~~
|
||||
|
||||
### Block quotations
|
||||
|
||||
Markdown uses email conventions for quoting blocks of text.
|
||||
A block quotation is one or more paragraphs or other block elements (such as lists or headers), with each line preceded by a `>` character and a space.
|
||||
|
||||
> This is a block quote. This paragraph does indeed have more than one line.
|
||||
>
|
||||
> 1. This is a list inside a block quote.
|
||||
> 2. Second item.
|
||||
|
||||
Among the block elements that can be contained in a block quote are other block quotes. That is, block quotes can be nested:
|
||||
|
||||
> This is a block quote.
|
||||
>
|
||||
>> A block quote within a block quote.
|
||||
|
||||
**Standard markdown syntax does not require a blank line before a block quote. Pandoc does require this (except, of course, at the beginning of the document).**
|
||||
|
||||
The following does not produce a nested block quote in pandoc:
|
||||
|
||||
> This is a block quote.
|
||||
>> Nested.
|
||||
|
||||
|
||||
### Verbatim (code) blocks
|
||||
|
||||
### Indented code blocks
|
||||
|
||||
A block of text indented one tab is treated as verbatim text: that is, special characters do not trigger special formatting, and all spaces and line breaks are preserved. For example,
|
||||
|
||||
if (a > 3) {
|
||||
moveShip(5 * gravity, DOWN);
|
||||
}
|
||||
|
||||
The initial (four space or one tab) indentation is not considered part of the verbatim text, and is removed in the output.
|
||||
|
||||
Note: blank lines in the verbatim text need not begin with four spaces.
|
||||
|
||||
### Lists
|
||||
|
||||
### Bullet lists
|
||||
|
||||
A bullet list is a list of bulleted list items. A bulleted list
|
||||
item begins with a bullet (`*`, `+`, or `-`). Here is a simple
|
||||
example:
|
||||
|
||||
* one
|
||||
* two
|
||||
* three
|
||||
|
||||
### The four-space rule
|
||||
|
||||
A list item may contain multiple paragraphs and other block-level
|
||||
content. However, subsequent paragraphs must be preceded by a blank line and indented four spaces or a tab. The list will look better if the first paragraph is aligned with the rest:
|
||||
|
||||
* First paragraph.
|
||||
|
||||
Continued.
|
||||
|
||||
* Second paragraph. With a code block, which must be indented
|
||||
two tabs:
|
||||
|
||||
{ code }
|
||||
|
||||
List items may include other lists. In this case the preceding blank line is optional. The nested list must be indented one tab:
|
||||
|
||||
* fruits
|
||||
+ apples
|
||||
- macintosh
|
||||
- red delicious
|
||||
+ pears
|
||||
+ peaches
|
||||
* vegetables
|
||||
+ brocolli
|
||||
+ chard
|
||||
|
||||
### Ordered lists
|
||||
|
||||
Ordered lists work just like bulleted lists, except that the items begin with enumerators rather than bullets.
|
||||
|
||||
In standard markdown, enumerators are decimal numbers followed by a period and a space. The numbers themselves are ignored, so there is no difference between this list:
|
||||
|
||||
1. one
|
||||
2. two
|
||||
3. three
|
||||
|
||||
and this one:
|
||||
|
||||
5. one
|
||||
7. two
|
||||
1. three
|
||||
|
||||
Unlike standard markdown, Pandoc allows ordered list items to be marked with uppercase and lowercase letters and roman numerals, in addition to arabic numerals. List markers may be enclosed in parentheses or followed by a single right-parentheses or period. They must be separated from the text that follows by at least one space, and, if the list marker is a capital letter with a period, by at least two spaces.
|
||||
|
||||
Pandoc also pays attention to the type of list marker used, and to the starting number, and both of these are preserved where possible in the output format. Thus, the following yields a list with numbers followed by a single parenthesis, starting with 9, and a sublist with lowercase roman numerals:
|
||||
|
||||
9) Ninth
|
||||
10) Tenth
|
||||
11) Eleventh
|
||||
i. subone
|
||||
ii. subtwo
|
||||
iii. subthree
|
||||
|
||||
Pandoc will start a new list each time a different type of list marker is used. So, the following will create three lists:
|
||||
|
||||
2) Two
|
||||
5) Three
|
||||
1. Four
|
||||
* Five
|
||||
|
||||
If default list markers are desired, use `#.`:
|
||||
|
||||
#. one
|
||||
#. two
|
||||
#. three
|
||||
|
||||
|
||||
### Definition lists
|
||||
|
||||
Pandoc supports definition lists:
|
||||
|
||||
Term 1
|
||||
|
||||
: Definition 1
|
||||
|
||||
Term 2 with *inline markup*
|
||||
|
||||
: Definition 2
|
||||
|
||||
{ some code, part of Definition 2 }
|
||||
|
||||
Third paragraph of definition 2.
|
||||
|
||||
Each term must fit on one line, which may optionally be followed by a blank line, and must be followed by one or more definitions.
|
||||
A definition begins with a colon or tilde, which may be indented one or two spaces. The body of the definition (including the first line, aside from the colon or tilde) should be indented four spaces. A term may have multiple definitions, and each definition may consist of one or more block elements (paragraph, code block, list, etc.), each indented four spaces or one tab stop.
|
||||
|
||||
If you leave space after the definition (as in the example above),
|
||||
the blocks of the definitions will be considered paragraphs. In some output formats, this will mean greater spacing between term/definition pairs. For a compact definition list, do not leave space between the definition and the next term:
|
||||
|
||||
Term 1
|
||||
~ Definition 1
|
||||
Term 2
|
||||
~ Definition 2a
|
||||
~ Definition 2b
|
||||
|
||||
### Numbered example lists
|
||||
|
||||
The special list marker `@` can be used for sequentially numbered
|
||||
examples. The first list item with a `@` marker will be numbered '1', the next '2', and so on, throughout the document. The numbered examples need not occur in a single list; each new list using `@` will take up where the last stopped. So, for example:
|
||||
|
||||
(@) My first example will be numbered (1).
|
||||
(@) My second example will be numbered (2).
|
||||
|
||||
Explanation of examples.
|
||||
|
||||
(@) My third example will be numbered (3).
|
||||
|
||||
Numbered examples can be labeled and referred to elsewhere in the
|
||||
document:
|
||||
|
||||
(@good) This is a good example.
|
||||
|
||||
As (@good) illustrates, ...
|
||||
|
||||
The label can be any string of alphanumeric characters, underscores, or hyphens.
|
||||
|
||||
### Ending a list
|
||||
|
||||
What if you want to put an indented code block after a list?
|
||||
|
||||
- item one
|
||||
- item two
|
||||
|
||||
{ my code block }
|
||||
|
||||
Trouble! Here pandoc (like other markdown implementations) will treat `{ my code block }` as the second paragraph of item two, and not as a code block.
|
||||
|
||||
To "cut off" the list after item two, you can insert some non-indented content, like an HTML comment, which won't produce visible output in any format:
|
||||
|
||||
- item one
|
||||
- item two
|
||||
|
||||
<!-- end of list -->
|
||||
|
||||
{ my code block }
|
||||
|
||||
You can use the same trick if you want two consecutive lists instead of one big list:
|
||||
|
||||
1. one
|
||||
2. two
|
||||
3. three
|
||||
|
||||
<!-- -->
|
||||
|
||||
1. uno
|
||||
2. dos
|
||||
3. tres
|
||||
|
||||
### Horizontal rules
|
||||
|
||||
A line containing a row of three or more `*`, `-`, or `_` characters
|
||||
(optionally separated by spaces) produces a horizontal rule:
|
||||
|
||||
* * *
|
||||
|
||||
### Title block
|
||||
|
||||
If the file begins with a title block
|
||||
|
||||
% title
|
||||
% author(s) (separated by semicolons)
|
||||
% date
|
||||
|
||||
it will be parsed as bibliographic information, not regular text. The block may contain just a title, a title and an author, or all three elements. If you want to include an author but no title, or a title and a date but no author, you need a blank line:
|
||||
|
||||
%
|
||||
% Author
|
||||
|
||||
or
|
||||
|
||||
% My title
|
||||
%
|
||||
% June 15, 2006
|
||||
|
||||
If a document has multiple authors, the authors may be separated by semicolons.
|
||||
|
||||
% Author One; Author Two
|
||||
|
||||
All three metadata fields may contain standard inline formatting
|
||||
(italics, links, footnotes, etc.).
|
||||
|
||||
### Backslash escapes
|
||||
|
||||
Except inside a code block or inline code, any punctuation or space character preceded by a backslash will be treated literally, even if it would normally indicate formatting.
|
||||
|
||||
Thus, for example, if one writes
|
||||
|
||||
*\*hello\**
|
||||
|
||||
one will get
|
||||
|
||||
<em>*hello*</em>
|
||||
|
||||
instead of
|
||||
|
||||
<strong>hello</strong>
|
||||
|
||||
A backslash-escaped space is parsed as a nonbreaking space.
|
||||
|
||||
A backslash-escaped newline (i.e. a backslash occurring at the end of a line) is parsed as a hard line break.
|
||||
|
||||
Backslash escapes do not work in verbatim contexts.
|
||||
|
||||
### Smart punctuation
|
||||
|
||||
Pandoc will produce typographically correct output, converting straight quotes to curly quotes, `---` to em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces are inserted after certain abbreviations, such as "Mr."
|
||||
|
||||
### Delimited code blocks
|
||||
|
||||
In addition to standard indented code blocks, Pandoc supports
|
||||
*delimited* code blocks. These begin with a row of three or more
|
||||
tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or backticks that must be at least as long as the starting row. Everything between these lines is treated as code. No indentation is necessary:
|
||||
|
||||
~~~~~~~
|
||||
if (a > 3) {
|
||||
moveShip(5 * gravity, DOWN);
|
||||
}
|
||||
~~~~~~~
|
||||
|
||||
Like regular code blocks, delimited code blocks must be separated
|
||||
from surrounding text by blank lines.
|
||||
|
||||
To specify the language of the code block:
|
||||
|
||||
```haskell
|
||||
qsort [] = []
|
||||
```
|
||||
which yields:
|
||||
|
||||
<pre id="mycode" class="haskell">
|
||||
<code>
|
||||
...
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
### Verbatim
|
||||
|
||||
To make a short span of text verbatim, put it inside backticks:
|
||||
|
||||
What is the difference between `>>=` and `>>`?
|
||||
|
||||
If the verbatim text includes a backtick, use double backticks:
|
||||
|
||||
Here is a literal backtick `` ` ``.
|
||||
|
||||
(The spaces after the opening backticks and before the closing backticks will be ignored.)
|
||||
|
||||
The general rule is that a verbatim span starts with a string of consecutive backticks (optionally followed by a space) and ends with a string of the same number of backticks (optionally preceded by a space).
|
||||
|
||||
Note that backslash-escapes (and other markdown constructs) do not work in verbatim contexts:
|
||||
|
||||
This is a backslash followed by an asterisk: `\*`.
|
||||
|
||||
### Superscripts and subscripts
|
||||
|
||||
Superscripts may be written by surrounding the superscripted text by `^` characters; subscripts may be written by surrounding the subscripted text by `~` characters.
|
||||
|
||||
Thus, for example,
|
||||
|
||||
H~2~O is a liquid. 2^10^ is 1024.
|
||||
|
||||
If the superscripted or subscripted text contains spaces, these spaces must be escaped with backslashes. (This is to prevent accidental superscripting and subscripting through the ordinary use of `~` and `^`.)
|
||||
|
||||
Thus, if you want the letter P with 'a cat' in subscripts, use
|
||||
`P~a\ cat~`, not `P~a cat~`.
|
||||
|
||||
|
||||
### Math
|
||||
|
||||
Anything between two `$` characters will be treated as TeX math. The opening `$` must have a character immediately to its right, while the closing `$` must have a character immediately to its left. Thus, `$20,000 and $30,000` won't parse as math. If for some reason you need to enclose text in literal `$` characters, backslash-escape them and they won't be treated as math delimiters.
|
||||
|
||||
TeX math will be printed in all output formats. How it is rendered depends on the output format:
|
||||
|
||||
* HTML: with (mathjax)[http://www.mathjax.org/]
|
||||
* Latex: with Latex
|
||||
|
||||
### Raw HTML
|
||||
|
||||
Markdown allows you to insert raw HTML anywhere in a document (except verbatim contexts, where `<`, `>`, and `&` are interpreted literally).
|
||||
|
||||
Standard markdown allows you to include HTML "blocks": blocks
|
||||
of HTML between balanced tags that are separated from the surrounding text with blank lines, and start and end at the left margin.
|
||||
|
||||
Within these blocks, everything is interpreted as HTML, not markdown; so (for example), `*` does not signify emphasis.
|
||||
|
||||
Pandoc interprets material between HTML block tags as markdown.
|
||||
Thus, for example, Pandoc will turn
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>*one*</td>
|
||||
<td>[a link](http://google.com)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
into
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>one</em></td>
|
||||
<td><a href="http://google.com">a link</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
There is one exception to this rule: text between `<script>` and
|
||||
`<style>` tags is not interpreted as markdown.
|
||||
|
||||
### Raw TeX
|
||||
|
||||
In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be included in a document. Inline TeX commands will be preserved and passed unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to include BibTeX citations:
|
||||
|
||||
This result was proved in \cite{jones.1967}.
|
||||
|
||||
Note that in LaTeX environments, like
|
||||
|
||||
\begin{tabular}{|l|l|}\hline
|
||||
Age & Frequency \\ \hline
|
||||
18--25 & 15 \\
|
||||
26--35 & 33 \\
|
||||
36--45 & 22 \\ \hline
|
||||
\end{tabular}
|
||||
|
||||
the material between the begin and end tags will be interpreted as raw LaTeX, not as markdown.
|
||||
|
||||
Inline LaTeX is ignored in output formats other than Markdown, LaTeX, and ConTeXt.
|
||||
|
||||
### LaTeX macros
|
||||
|
||||
For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and `\renewcommand` definitions and apply the resulting macros to all LaTeX math. So, for example, the following will work in all output formats, not just LaTeX:
|
||||
|
||||
\newcommand{\tuple}[1]{\langle #1 \rangle}
|
||||
|
||||
$\tuple{a, b, c}$
|
||||
|
||||
In LaTeX output, the `\newcommand` definition will simply be passed unchanged to the output.
|
||||
|
||||
### Links
|
||||
|
||||
Markdown allows links to be specified in several ways.
|
||||
|
||||
#### Automatic links
|
||||
|
||||
If you enclose a URL or email address in pointy brackets, it
|
||||
will become a link:
|
||||
|
||||
<http://google.com>
|
||||
<sam@green.eggs.ham>
|
||||
|
||||
Pandoc will render autolinked URLs and email addresses as
|
||||
inline code.
|
||||
|
||||
#### Inline links
|
||||
|
||||
An inline link consists of the link text in square brackets,
|
||||
followed by the URL in parentheses. (Optionally, the URL can
|
||||
be followed by a link title, in quotes.)
|
||||
|
||||
This is an [inline link](/url), and here's [one with
|
||||
a title](http://fsf.org "click here for a good time!").
|
||||
|
||||
There can be no space between the bracketed part and the parenthesized part. The link text can contain formatting (such as emphasis), but the title cannot.
|
||||
|
||||
|
||||
#### Reference links
|
||||
|
||||
An *explicit* reference link has two parts, the link itself and the link definition, which may occur elsewhere in the document (either before or after the link).
|
||||
|
||||
The link consists of link text in square brackets, followed by a label in square brackets. (There can be space between the two.) The link definition must begin at the left margin or indented no more than three spaces. It consists of the bracketed label, followed by a colon and a space, followed by the URL, and optionally (after a space) a link title either in quotes or in
|
||||
parentheses.
|
||||
|
||||
Here are some examples:
|
||||
|
||||
[my label 1]: /foo/bar.html "My title, optional"
|
||||
[my label 2]: /foo
|
||||
[my label 3]: http://fsf.org (The free software foundation)
|
||||
[my label 4]: /bar#special 'A title in single quotes'
|
||||
|
||||
The URL may optionally be surrounded by angle brackets:
|
||||
|
||||
[my label 5]: <http://foo.bar.baz>
|
||||
|
||||
The title may go on the next line:
|
||||
|
||||
[my label 3]: http://fsf.org
|
||||
"The free software foundation"
|
||||
|
||||
Note that link labels are not case sensitive. So, this will work:
|
||||
|
||||
Here is [my link][FOO]
|
||||
|
||||
[Foo]: /bar/baz
|
||||
|
||||
In an *implicit* reference link, the second pair of brackets is
|
||||
empty, or omitted entirely:
|
||||
|
||||
See [my website][], or [my website].
|
||||
|
||||
[my website]: http://foo.bar.baz
|
||||
|
||||
#### Internal links
|
||||
|
||||
To link to another section of the same document, use the automatically
|
||||
generated identifier (see [Header identifiers in HTML, LaTeX, and
|
||||
ConTeXt](#header-identifiers-in-html-latex-and-context), below).
|
||||
For example:
|
||||
|
||||
See the [Introduction](#introduction).
|
||||
|
||||
or
|
||||
|
||||
See the [Introduction].
|
||||
|
||||
[Introduction]: #introduction
|
||||
|
||||
Internal links are currently supported for HTML formats (including
|
||||
HTML slide shows and EPUB), LaTeX, and ConTeXt.
|
||||
|
||||
### Images
|
||||
|
||||
A link immediately preceded by a `!` will be treated as an image.
|
||||
The link text will be used as the image's alt text:
|
||||
|
||||
![la lune](lalune.jpg "Voyage to the moon")
|
||||
|
||||
![movie reel]
|
||||
|
||||
[movie reel]: movie.gif
|
||||
|
||||
### Pictures with captions
|
||||
|
||||
An image occurring by itself in a paragraph will be rendered as
|
||||
a figure with a caption.[^5] (In LaTeX, a figure environment will be used; in HTML, the image will be placed in a `<div>` with class
|
||||
`.figure`, together with a caption in a `p` with class `caption`.)
|
||||
The image's alt text will be used as the caption.
|
||||
|
||||
![This is the caption](/url/of/image.png)
|
||||
|
||||
If you just want a regular inline image, just make sure it is not
|
||||
the only thing in the paragraph. One way to do this is to insert a
|
||||
nonbreaking space after the image:
|
||||
|
||||
![This image won't be a figure](/url/of/image.png)\
|
||||
|
||||
|
||||
### Footnotes
|
||||
|
||||
Pandoc's markdown allows footnotes, using the following syntax:
|
||||
|
||||
Here is a footnote reference,[^1] and another.[^longnote]
|
||||
|
||||
[^1]: Here is the footnote.
|
||||
|
||||
[^longnote]: Here's one with multiple blocks.
|
||||
|
||||
Subsequent paragraphs are indented to show that they
|
||||
belong to the previous footnote.
|
||||
|
||||
{ some.code }
|
||||
|
||||
The whole paragraph can be indented, or just the first
|
||||
line. In this way, multi-paragraph footnotes work like
|
||||
multi-paragraph list items.
|
||||
|
||||
This paragraph won't be part of the note, because it
|
||||
isn't indented.
|
||||
|
||||
The identifiers in footnote references may not contain spaces, tabs, or newlines. These identifiers are used only to correlate the footnote reference with the note itself; in the output, footnotes will be numbered sequentially.
|
||||
|
||||
The footnotes themselves need not be placed at the end of the
|
||||
document. They may appear anywhere except inside other block elements (lists, block quotes, tables, etc.).
|
||||
|
||||
Inline footnotes are also allowed (though, unlike regular notes,
|
||||
they cannot contain multiple paragraphs).
|
||||
|
||||
The syntax is as follows:
|
||||
|
||||
Here is an inline note.^[Inlines notes are easier to write, since you don't have to pick an identifier and move down to type the note.]
|
||||
|
||||
Inline and regular footnotes may be mixed freely.
|
||||
|
||||
## Authors of this documentation
|
||||
|
||||
© 2006-2012 John MacFarlane (jgm at berkeley dot edu). Released under the [GPL], version 2 or greater. This software carries no warranty of any kind. (See COPYRIGHT for full copyright and warranty notices.) Other contributors include Recai Oktaş, Paulo Tanimoto, Peter Wang, Andrea Rossato, Eric Kow, infinity0x, Luke Plant, shreevatsa.public, Puneeth Chaganti, Paul Rivier, rodja.trappe, Bradley Kuhn, thsutton, Nathan Gass, Jonathan Daugherty, Jérémy Bobbio, Justin Bogner, qerub, Christopher Sawicki, Kelsey Hightower, Masayoshi Takahashi, Antoine Latter, Ralf Stephan, Eric Seidel, B. Scott Michel, Gavin Beatty, Sergey Astanin.
|
||||
|
||||
© Reworked for UberWriter: Wolf Vollprecht
|
|
@ -0,0 +1,28 @@
|
|||
### This is Lorem Ipsum
|
||||
|
||||
$\frac{1}{2} + 1 12+2=14$ Testing more input whatt.
|
||||
|
||||
[](http://www.wolfvollprecht.de/)
|
||||
[](http://google.com)
|
||||
![Tolles Bild](file:///home/wolf/Pictures/2012/10/03/IMG_0322.JPG)
|
||||
|
||||
Lorem ipsum dolor sit amet, exerci mucius perpetua vix at, quo persius nostrum singulis ei, integre delicata ei vel. Cu eum dicant copiosae philosophia, nec ad vide insolens. His propriae pericula periculis at, mei et aeque commune efficiendi, eum ea quis consetetur. Ius ut iuvaret denique. Mei ea odio legere suscipit.
|
||||
|
||||
Ius ex timeam appetere[^1], mea id sumo partiendo, qui at viris patrioque gloriatur. Sit ferri oratio tamquam eu. Persius senserit ei his, an nec mundi ponderum dissentias. Placerat erroribus pri in, his te dolor diceret.
|
||||
|
||||
```javascript
|
||||
function(3) {
|
||||
exit();
|
||||
}
|
||||
```
|
||||
|
||||
In eos civibus tincidunt, paulo voluptatibus cum ei. Eu mei reprehendunt necessitatibus, ea mundi sententiae vix. Mel dico impetus te, pro an nihil epicurei phaedrum. Nulla labitur meliore no vel, soleat facilisi pro te, et aliquam suscipiantur reprehendunt vis. Duo minim explicari ei, lobortis scripserit ex eam. Eum ea nobis latine, ad mazim latine tritani cum, homero eruditi vivendo ex nam.
|
||||
|
||||
Esse inermis pri et, sea pericula petentium te, eum urbanitas signiferumque et. Tantas graece ad sed, pertinax erroribus no mei. Ei elitr melius antiopam est. In ius cetero inermis electram. Quot aliquid dolorem ne eos.
|
||||
[^2]
|
||||
Usu nostrud recteque ex, inani suscipiantur mea et, et sit graeco aeterno oporteat. Et partem iisque rationibus eos. Modus dicam sanctus at his, ad eos velit regione constituam. Ad tacimates conceptam persequeris est. No populo delicata duo, ut pro sumo euripidis. Oporteat assentior constituto sea ei, nam sint scaevola eu. Mel vidisse dolores neglegentur cu.
|
||||
|
||||
[^1]: This is my footnote, and I am very proud of it. Cool, right? not? I don't know, anyway.
|
||||
And a consecutive ressurection of the same footnote, anyway, great or not, I don't know.
|
||||
|
||||
[^2]: asda sdas dasd asdasasd
|
|
@ -0,0 +1,887 @@
|
|||
Markdown: Syntax
|
||||
================
|
||||
|
||||
<ul id="ProjectSubmenu">
|
||||
<li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
|
||||
<li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
|
||||
<li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
|
||||
<li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
|
||||
<li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
* [Overview](#overview)
|
||||
* [Philosophy](#philosophy)
|
||||
* [Inline HTML](#html)
|
||||
* [Automatic Escaping for Special Characters](#autoescape)
|
||||
* [Block Elements](#block)
|
||||
* [Paragraphs and Line Breaks](#p)
|
||||
* [Headers](#header)
|
||||
* [Blockquotes](#blockquote)
|
||||
* [Lists](#list)
|
||||
* [Code Blocks](#precode)
|
||||
* [Horizontal Rules](#hr)
|
||||
* [Span Elements](#span)
|
||||
* [Links](#link)
|
||||
* [Emphasis](#em)
|
||||
* [Code](#code)
|
||||
* [Images](#img)
|
||||
* [Miscellaneous](#misc)
|
||||
* [Backslash Escapes](#backslash)
|
||||
* [Automatic Links](#autolink)
|
||||
|
||||
|
||||
**Note:** This document is itself written using Markdown; you
|
||||
can [see the source for it by adding '.text' to the URL][src].
|
||||
|
||||
[src]: /projects/markdown/syntax.text
|
||||
|
||||
* * *
|
||||
|
||||
<h2 id="overview">Overview</h2>
|
||||
|
||||
<h3 id="philosophy">Philosophy</h3>
|
||||
|
||||
Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
|
||||
|
||||
Readability, however, is emphasized above all else. A Markdown-formatted
|
||||
document should be publishable as-is, as plain text, without looking
|
||||
like it's been marked up with tags or formatting instructions. While
|
||||
Markdown's syntax has been influenced by several existing text-to-HTML
|
||||
filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
|
||||
[Grutatext] [5], and [EtText] [6] -- the single biggest source of
|
||||
inspiration for Markdown's syntax is the format of plain text email.
|
||||
|
||||
[1]: http://docutils.sourceforge.net/mirror/setext.html
|
||||
[2]: http://www.aaronsw.com/2002/atx/
|
||||
[3]: http://textism.com/tools/textile/
|
||||
[4]: http://docutils.sourceforge.net/rst.html
|
||||
[5]: http://www.triptico.com/software/grutatxt.html
|
||||
[6]: http://ettext.taint.org/doc/
|
||||
|
||||
To this end, Markdown's syntax is comprised entirely of punctuation
|
||||
characters, which punctuation characters have been carefully chosen so
|
||||
as to look like what they mean. E.g., asterisks around a word actually
|
||||
look like \*emphasis\*. Markdown lists look like, well, lists. Even
|
||||
blockquotes look like quoted passages of text, assuming you've ever
|
||||
used email.
|
||||
|
||||
|
||||
|
||||
<h3 id="html">Inline HTML</h3>
|
||||
|
||||
Markdown's syntax is intended for one purpose: to be used as a
|
||||
format for *writing* for the web.
|
||||
|
||||
Markdown is not a replacement for HTML, or even close to it. Its
|
||||
syntax is very small, corresponding only to a very small subset of
|
||||
HTML tags. The idea is *not* to create a syntax that makes it easier
|
||||
to insert HTML tags. In my opinion, HTML tags are already easy to
|
||||
insert. The idea for Markdown is to make it easy to read, write, and
|
||||
edit prose. HTML is a *publishing* format; Markdown is a *writing*
|
||||
format. Thus, Markdown's formatting syntax only addresses issues that
|
||||
can be conveyed in plain text.
|
||||
|
||||
For any markup that is not covered by Markdown's syntax, you simply
|
||||
use HTML itself. There's no need to preface it or delimit it to
|
||||
indicate that you're switching from Markdown to HTML; you just use
|
||||
the tags.
|
||||
|
||||
The only restrictions are that block-level HTML elements -- e.g. `<div>`,
|
||||
`<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding
|
||||
content by blank lines, and the start and end tags of the block should
|
||||
not be indented with tabs or spaces. Markdown is smart enough not
|
||||
to add extra (unwanted) `<p>` tags around HTML block-level tags.
|
||||
|
||||
For example, to add an HTML table to a Markdown article:
|
||||
|
||||
This is a regular paragraph.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Foo</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
This is another regular paragraph.
|
||||
|
||||
Note that Markdown formatting syntax is not processed within block-level
|
||||
HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an
|
||||
HTML block.
|
||||
|
||||
Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be
|
||||
used anywhere in a Markdown paragraph, list item, or header. If you
|
||||
want, you can even use HTML tags instead of Markdown formatting; e.g. if
|
||||
you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's
|
||||
link or image syntax, go right ahead.
|
||||
|
||||
Unlike block-level HTML tags, Markdown syntax *is* processed within
|
||||
span-level tags.
|
||||
|
||||
|
||||
<h3 id="autoescape">Automatic Escaping for Special Characters</h3>
|
||||
|
||||
In HTML, there are two characters that demand special treatment: `<`
|
||||
and `&`. Left angle brackets are used to start tags; ampersands are
|
||||
used to denote HTML entities. If you want to use them as literal
|
||||
characters, you must escape them as entities, e.g. `<`, and
|
||||
`&`.
|
||||
|
||||
Ampersands in particular are bedeviling for web writers. If you want to
|
||||
write about 'AT&T', you need to write '`AT&T`'. You even need to
|
||||
escape ampersands within URLs. Thus, if you want to link to:
|
||||
|
||||
http://images.google.com/images?num=30&q=larry+bird
|
||||
|
||||
you need to encode the URL as:
|
||||
|
||||
http://images.google.com/images?num=30&q=larry+bird
|
||||
|
||||
in your anchor tag `href` attribute. Needless to say, this is easy to
|
||||
forget, and is probably the single most common source of HTML validation
|
||||
errors in otherwise well-marked-up web sites.
|
||||
|
||||
Markdown allows you to use these characters naturally, taking care of
|
||||
all the necessary escaping for you. If you use an ampersand as part of
|
||||
an HTML entity, it remains unchanged; otherwise it will be translated
|
||||
into `&`.
|
||||
|
||||
So, if you want to include a copyright symbol in your article, you can write:
|
||||
|
||||
©
|
||||
|
||||
and Markdown will leave it alone. But if you write:
|
||||
|
||||
AT&T
|
||||
|
||||
Markdown will translate it to:
|
||||
|
||||
AT&T
|
||||
|
||||
Similarly, because Markdown supports [inline HTML](#html), if you use
|
||||
angle brackets as delimiters for HTML tags, Markdown will treat them as
|
||||
such. But if you write:
|
||||
|
||||
4 < 5
|
||||
|
||||
Markdown will translate it to:
|
||||
|
||||
4 < 5
|
||||
|
||||
However, inside Markdown code spans and blocks, angle brackets and
|
||||
ampersands are *always* encoded automatically. This makes it easy to use
|
||||
Markdown to write about HTML code. (As opposed to raw HTML, which is a
|
||||
terrible format for writing about HTML syntax, because every single `<`
|
||||
and `&` in your example code needs to be escaped.)
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
|
||||
<h2 id="block">Block Elements</h2>
|
||||
|
||||
|
||||
<h3 id="p">Paragraphs and Line Breaks</h3>
|
||||
|
||||
A paragraph is simply one or more consecutive lines of text, separated
|
||||
by one or more blank lines. (A blank line is any line that looks like a
|
||||
blank line -- a line containing nothing but spaces or tabs is considered
|
||||
blank.) Normal paragraphs should not be intended with spaces or tabs.
|
||||
|
||||
The implication of the "one or more consecutive lines of text" rule is
|
||||
that Markdown supports "hard-wrapped" text paragraphs. This differs
|
||||
significantly from most other text-to-HTML formatters (including Movable
|
||||
Type's "Convert Line Breaks" option) which translate every line break
|
||||
character in a paragraph into a `<br />` tag.
|
||||
|
||||
When you *do* want to insert a `<br />` break tag using Markdown, you
|
||||
end a line with two or more spaces, then type return.
|
||||
|
||||
Yes, this takes a tad more effort to create a `<br />`, but a simplistic
|
||||
"every line break is a `<br />`" rule wouldn't work for Markdown.
|
||||
Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
|
||||
work best -- and look better -- when you format them with hard breaks.
|
||||
|
||||
[bq]: #blockquote
|
||||
[l]: #list
|
||||
|
||||
|
||||
|
||||
<h3 id="header">Headers</h3>
|
||||
|
||||
Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
|
||||
|
||||
Setext-style headers are "underlined" using equal signs (for first-level
|
||||
headers) and dashes (for second-level headers). For example:
|
||||
|
||||
This is an H1
|
||||
=============
|
||||
|
||||
This is an H2
|
||||
-------------
|
||||
|
||||
Any number of underlining `=`'s or `-`'s will work.
|
||||
|
||||
Atx-style headers use 1-6 hash characters at the start of the line,
|
||||
corresponding to header levels 1-6. For example:
|
||||
|
||||
# This is an H1
|
||||
|
||||
## This is an H2
|
||||
|
||||
###### This is an H6
|
||||
|
||||
Optionally, you may "close" atx-style headers. This is purely
|
||||
cosmetic -- you can use this if you think it looks better. The
|
||||
closing hashes don't even need to match the number of hashes
|
||||
used to open the header. (The number of opening hashes
|
||||
determines the header level.) :
|
||||
|
||||
# This is an H1 #
|
||||
|
||||
## This is an H2 ##
|
||||
|
||||
### This is an H3 ######
|
||||
|
||||
|
||||
<h3 id="blockquote">Blockquotes</h3>
|
||||
|
||||
Markdown uses email-style `>` characters for blockquoting. If you're
|
||||
familiar with quoting passages of text in an email message, then you
|
||||
know how to create a blockquote in Markdown. It looks best if you hard
|
||||
wrap the text and put a `>` before every line:
|
||||
|
||||
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
|
||||
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
|
||||
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
|
||||
>
|
||||
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
|
||||
> id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
Markdown allows you to be lazy and only put the `>` before the first
|
||||
line of a hard-wrapped paragraph:
|
||||
|
||||
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
|
||||
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
|
||||
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
|
||||
|
||||
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
|
||||
id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
|
||||
adding additional levels of `>`:
|
||||
|
||||
> This is the first level of quoting.
|
||||
>
|
||||
> > This is nested blockquote.
|
||||
>
|
||||
> Back to the first level.
|
||||
|
||||
Blockquotes can contain other Markdown elements, including headers, lists,
|
||||
and code blocks:
|
||||
|
||||
> ## This is a header.
|
||||
>
|
||||
> 1. This is the first list item.
|
||||
> 2. This is the second list item.
|
||||
>
|
||||
> Here's some example code:
|
||||
>
|
||||
> return shell_exec("echo $input | $markdown_script");
|
||||
|
||||
Any decent text editor should make email-style quoting easy. For
|
||||
example, with BBEdit, you can make a selection and choose Increase
|
||||
Quote Level from the Text menu.
|
||||
|
||||
|
||||
<h3 id="list">Lists</h3>
|
||||
|
||||
Markdown supports ordered (numbered) and unordered (bulleted) lists.
|
||||
|
||||
Unordered lists use asterisks, pluses, and hyphens -- interchangably
|
||||
-- as list markers:
|
||||
|
||||
* Red
|
||||
* Green
|
||||
* Blue
|
||||
|
||||
is equivalent to:
|
||||
|
||||
+ Red
|
||||
+ Green
|
||||
+ Blue
|
||||
|
||||
and:
|
||||
|
||||
- Red
|
||||
- Green
|
||||
- Blue
|
||||
|
||||
Ordered lists use numbers followed by periods:
|
||||
|
||||
1. Bird
|
||||
2. McHale
|
||||
3. Parish
|
||||
|
||||
It's important to note that the actual numbers you use to mark the
|
||||
list have no effect on the HTML output Markdown produces. The HTML
|
||||
Markdown produces from the above list is:
|
||||
|
||||
<ol>
|
||||
<li>Bird</li>
|
||||
<li>McHale</li>
|
||||
<li>Parish</li>
|
||||
</ol>
|
||||
|
||||
If you instead wrote the list in Markdown like this:
|
||||
|
||||
1. Bird
|
||||
1. McHale
|
||||
1. Parish
|
||||
|
||||
or even:
|
||||
|
||||
3. Bird
|
||||
1. McHale
|
||||
8. Parish
|
||||
|
||||
you'd get the exact same HTML output. The point is, if you want to,
|
||||
you can use ordinal numbers in your ordered Markdown lists, so that
|
||||
the numbers in your source match the numbers in your published HTML.
|
||||
But if you want to be lazy, you don't have to.
|
||||
|
||||
If you do use lazy list numbering, however, you should still start the
|
||||
list with the number 1. At some point in the future, Markdown may support
|
||||
starting ordered lists at an arbitrary number.
|
||||
|
||||
List markers typically start at the left margin, but may be indented by
|
||||
up to three spaces. List markers must be followed by one or more spaces
|
||||
or a tab.
|
||||
|
||||
To make lists look nice, you can wrap items with hanging indents:
|
||||
|
||||
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
|
||||
viverra nec, fringilla in, laoreet vitae, risus.
|
||||
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
|
||||
Suspendisse id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
But if you want to be lazy, you don't have to:
|
||||
|
||||
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
|
||||
viverra nec, fringilla in, laoreet vitae, risus.
|
||||
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
|
||||
Suspendisse id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
If list items are separated by blank lines, Markdown will wrap the
|
||||
items in `<p>` tags in the HTML output. For example, this input:
|
||||
|
||||
* Bird
|
||||
* Magic
|
||||
|
||||
will turn into:
|
||||
|
||||
<ul>
|
||||
<li>Bird</li>
|
||||
<li>Magic</li>
|
||||
</ul>
|
||||
|
||||
But this:
|
||||
|
||||
* Bird
|
||||
|
||||
* Magic
|
||||
|
||||
will turn into:
|
||||
|
||||
<ul>
|
||||
<li><p>Bird</p></li>
|
||||
<li><p>Magic</p></li>
|
||||
</ul>
|
||||
|
||||
List items may consist of multiple paragraphs. Each subsequent
|
||||
paragraph in a list item must be intended by either 4 spaces
|
||||
or one tab:
|
||||
|
||||
1. This is a list item with two paragraphs. Lorem ipsum dolor
|
||||
sit amet, consectetuer adipiscing elit. Aliquam hendrerit
|
||||
mi posuere lectus.
|
||||
|
||||
Vestibulum enim wisi, viverra nec, fringilla in, laoreet
|
||||
vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
|
||||
sit amet velit.
|
||||
|
||||
2. Suspendisse id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
It looks nice if you indent every line of the subsequent
|
||||
paragraphs, but here again, Markdown will allow you to be
|
||||
lazy:
|
||||
|
||||
* This is a list item with two paragraphs.
|
||||
|
||||
This is the second paragraph in the list item. You're
|
||||
only required to indent the first line. Lorem ipsum dolor
|
||||
sit amet, consectetuer adipiscing elit.
|
||||
|
||||
* Another item in the same list.
|
||||
|
||||
To put a blockquote within a list item, the blockquote's `>`
|
||||
delimiters need to be indented:
|
||||
|
||||
* A list item with a blockquote:
|
||||
|
||||
> This is a blockquote
|
||||
> inside a list item.
|
||||
|
||||
To put a code block within a list item, the code block needs
|
||||
to be indented *twice* -- 8 spaces or two tabs:
|
||||
|
||||
* A list item with a code block:
|
||||
|
||||
<code goes here>
|
||||
|
||||
|
||||
It's worth noting that it's possible to trigger an ordered list by
|
||||
accident, by writing something like this:
|
||||
|
||||
1986. What a great season.
|
||||
|
||||
In other words, a *number-period-space* sequence at the beginning of a
|
||||
line. To avoid this, you can backslash-escape the period:
|
||||
|
||||
1986\. What a great season.
|
||||
|
||||
|
||||
|
||||
<h3 id="precode">Code Blocks</h3>
|
||||
|
||||
Pre-formatted code blocks are used for writing about programming or
|
||||
markup source code. Rather than forming normal paragraphs, the lines
|
||||
of a code block are interpreted literally. Markdown wraps a code block
|
||||
in both `<pre>` and `<code>` tags.
|
||||
|
||||
To produce a code block in Markdown, simply indent every line of the
|
||||
block by at least 4 spaces or 1 tab. For example, given this input:
|
||||
|
||||
This is a normal paragraph:
|
||||
|
||||
This is a code block.
|
||||
|
||||
Markdown will generate:
|
||||
|
||||
<p>This is a normal paragraph:</p>
|
||||
|
||||
<pre><code>This is a code block.
|
||||
</code></pre>
|
||||
|
||||
One level of indentation -- 4 spaces or 1 tab -- is removed from each
|
||||
line of the code block. For example, this:
|
||||
|
||||
Here is an example of AppleScript:
|
||||
|
||||
tell application "Foo"
|
||||
beep
|
||||
end tell
|
||||
|
||||
will turn into:
|
||||
|
||||
<p>Here is an example of AppleScript:</p>
|
||||
|
||||
<pre><code>tell application "Foo"
|
||||
beep
|
||||
end tell
|
||||
</code></pre>
|
||||
|
||||
A code block continues until it reaches a line that is not indented
|
||||
(or the end of the article).
|
||||
|
||||
Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
|
||||
are automatically converted into HTML entities. This makes it very
|
||||
easy to include example HTML source code using Markdown -- just paste
|
||||
it and indent it, and Markdown will handle the hassle of encoding the
|
||||
ampersands and angle brackets. For example, this:
|
||||
|
||||
<div class="footer">
|
||||
© 2004 Foo Corporation
|
||||
</div>
|
||||
|
||||
will turn into:
|
||||
|
||||
<pre><code><div class="footer">
|
||||
&copy; 2004 Foo Corporation
|
||||
</div>
|
||||
</code></pre>
|
||||
|
||||
Regular Markdown syntax is not processed within code blocks. E.g.,
|
||||
asterisks are just literal asterisks within a code block. This means
|
||||
it's also easy to use Markdown to write about Markdown's own syntax.
|
||||
|
||||
|
||||
|
||||
<h3 id="hr">Horizontal Rules</h3>
|
||||
|
||||
You can produce a horizontal rule tag (`<hr />`) by placing three or
|
||||
more hyphens, asterisks, or underscores on a line by themselves. If you
|
||||
wish, you may use spaces between the hyphens or asterisks. Each of the
|
||||
following lines will produce a horizontal rule:
|
||||
|
||||
* * *
|
||||
|
||||
***
|
||||
|
||||
*****
|
||||
|
||||
- - -
|
||||
|
||||
---------------------------------------
|
||||
|
||||
_ _ _
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
<h2 id="span">Span Elements</h2>
|
||||
|
||||
<h3 id="link">Links</h3>
|
||||
|
||||
Markdown supports two style of links: *inline* and *reference*.
|
||||
|
||||
In both styles, the link text is delimited by [square brackets].
|
||||
|
||||
To create an inline link, use a set of regular parentheses immediately
|
||||
after the link text's closing square bracket. Inside the parentheses,
|
||||
put the URL where you want the link to point, along with an *optional*
|
||||
title for the link, surrounded in quotes. For example:
|
||||
|
||||
This is [an example](http://example.com/ "Title") inline link.
|
||||
|
||||
[This link](http://example.net/) has no title attribute.
|
||||
|
||||
Will produce:
|
||||
|
||||
<p>This is <a href="http://example.com/" title="Title">
|
||||
an example</a> inline link.</p>
|
||||
|
||||
<p><a href="http://example.net/">This link</a> has no
|
||||
title attribute.</p>
|
||||
|
||||
If you're referring to a local resource on the same server, you can
|
||||
use relative paths:
|
||||
|
||||
See my [About](/about/) page for details.
|
||||
|
||||
Reference-style links use a second set of square brackets, inside
|
||||
which you place a label of your choosing to identify the link:
|
||||
|
||||
This is [an example][id] reference-style link.
|
||||
|
||||
You can optionally use a space to separate the sets of brackets:
|
||||
|
||||
This is [an example] [id] reference-style link.
|
||||
|
||||
Then, anywhere in the document, you define your link label like this,
|
||||
on a line by itself:
|
||||
|
||||
[id]: http://example.com/ "Optional Title Here"
|
||||
|
||||
That is:
|
||||
|
||||
* Square brackets containing the link identifier (optionally
|
||||
indented from the left margin using up to three spaces);
|
||||
* followed by a colon;
|
||||
* followed by one or more spaces (or tabs);
|
||||
* followed by the URL for the link;
|
||||
* optionally followed by a title attribute for the link, enclosed
|
||||
in double or single quotes.
|
||||
|
||||
The link URL may, optionally, be surrounded by angle brackets:
|
||||
|
||||
[id]: <http://example.com/> "Optional Title Here"
|
||||
|
||||
You can put the title attribute on the next line and use extra spaces
|
||||
or tabs for padding, which tends to look better with longer URLs:
|
||||
|
||||
[id]: http://example.com/longish/path/to/resource/here
|
||||
"Optional Title Here"
|
||||
|
||||
Link definitions are only used for creating links during Markdown
|
||||
processing, and are stripped from your document in the HTML output.
|
||||
|
||||
Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links:
|
||||
|
||||
[link text][a]
|
||||
[link text][A]
|
||||
|
||||
are equivalent.
|
||||
|
||||
The *implicit link name* shortcut allows you to omit the name of the
|
||||
link, in which case the link text itself is used as the name.
|
||||
Just use an empty set of square brackets -- e.g., to link the word
|
||||
"Google" to the google.com web site, you could simply write:
|
||||
|
||||
[Google][]
|
||||
|
||||
And then define the link:
|
||||
|
||||
[Google]: http://google.com/
|
||||
|
||||
Because link names may contain spaces, this shortcut even works for
|
||||
multiple words in the link text:
|
||||
|
||||
Visit [Daring Fireball][] for more information.
|
||||
|
||||
And then define the link:
|
||||
|
||||
[Daring Fireball]: http://daringfireball.net/
|
||||
|
||||
Link definitions can be placed anywhere in your Markdown document. I
|
||||
tend to put them immediately after each paragraph in which they're
|
||||
used, but if you want, you can put them all at the end of your
|
||||
document, sort of like footnotes.
|
||||
|
||||
Here's an example of reference links in action:
|
||||
|
||||
I get 10 times more traffic from [Google] [1] than from
|
||||
[Yahoo] [2] or [MSN] [3].
|
||||
|
||||
[1]: http://google.com/ "Google"
|
||||
[2]: http://search.yahoo.com/ "Yahoo Search"
|
||||
[3]: http://search.msn.com/ "MSN Search"
|
||||
|
||||
Using the implicit link name shortcut, you could instead write:
|
||||
|
||||
I get 10 times more traffic from [Google][] than from
|
||||
[Yahoo][] or [MSN][].
|
||||
|
||||
[google]: http://google.com/ "Google"
|
||||
[yahoo]: http://search.yahoo.com/ "Yahoo Search"
|
||||
[msn]: http://search.msn.com/ "MSN Search"
|
||||
|
||||
Both of the above examples will produce the following HTML output:
|
||||
|
||||
<p>I get 10 times more traffic from <a href="http://google.com/"
|
||||
title="Google">Google</a> than from
|
||||
<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
|
||||
or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
|
||||
|
||||
For comparison, here is the same paragraph written using
|
||||
Markdown's inline link style:
|
||||
|
||||
I get 10 times more traffic from [Google](http://google.com/ "Google")
|
||||
than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
|
||||
[MSN](http://search.msn.com/ "MSN Search").
|
||||
|
||||
The point of reference-style links is not that they're easier to
|
||||
write. The point is that with reference-style links, your document
|
||||
source is vastly more readable. Compare the above examples: using
|
||||
reference-style links, the paragraph itself is only 81 characters
|
||||
long; with inline-style links, it's 176 characters; and as raw HTML,
|
||||
it's 234 characters. In the raw HTML, there's more markup than there
|
||||
is text.
|
||||
|
||||
With Markdown's reference-style links, a source document much more
|
||||
closely resembles the final output, as rendered in a browser. By
|
||||
allowing you to move the markup-related metadata out of the paragraph,
|
||||
you can add links without interrupting the narrative flow of your
|
||||
prose.
|
||||
|
||||
|
||||
<h3 id="em">Emphasis</h3>
|
||||
|
||||
Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
|
||||
emphasis. Text wrapped with one `*` or `_` will be wrapped with an
|
||||
HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
|
||||
`<strong>` tag. E.g., this input:
|
||||
|
||||
*single asterisks*
|
||||
|
||||
_single underscores_
|
||||
|
||||
**double asterisks**
|
||||
|
||||
__double underscores__
|
||||
|
||||
will produce:
|
||||
|
||||
<em>single asterisks</em>
|
||||
|
||||
<em>single underscores</em>
|
||||
|
||||
<strong>double asterisks</strong>
|
||||
|
||||
<strong>double underscores</strong>
|
||||
|
||||
You can use whichever style you prefer; the lone restriction is that
|
||||
the same character must be used to open and close an emphasis span.
|
||||
|
||||
Emphasis can be used in the middle of a word:
|
||||
|
||||
un*fucking*believable
|
||||
|
||||
But if you surround an `*` or `_` with spaces, it'll be treated as a
|
||||
literal asterisk or underscore.
|
||||
|
||||
To produce a literal asterisk or underscore at a position where it
|
||||
would otherwise be used as an emphasis delimiter, you can backslash
|
||||
escape it:
|
||||
|
||||
\*this text is surrounded by literal asterisks\*
|
||||
|
||||
|
||||
|
||||
<h3 id="code">Code</h3>
|
||||
|
||||
To indicate a span of code, wrap it with backtick quotes (`` ` ``).
|
||||
Unlike a pre-formatted code block, a code span indicates code within a
|
||||
normal paragraph. For example:
|
||||
|
||||
Use the `printf()` function.
|
||||
|
||||
will produce:
|
||||
|
||||
<p>Use the <code>printf()</code> function.</p>
|
||||
|
||||
To include a literal backtick character within a code span, you can use
|
||||
multiple backticks as the opening and closing delimiters:
|
||||
|
||||
``There is a literal backtick (`) here.``
|
||||
|
||||
which will produce this:
|
||||
|
||||
<p><code>There is a literal backtick (`) here.</code></p>
|
||||
|
||||
The backtick delimiters surrounding a code span may include spaces --
|
||||
one after the opening, one before the closing. This allows you to place
|
||||
literal backtick characters at the beginning or end of a code span:
|
||||
|
||||
A single backtick in a code span: `` ` ``
|
||||
|
||||
A backtick-delimited string in a code span: `` `foo` ``
|
||||
|
||||
will produce:
|
||||
|
||||
<p>A single backtick in a code span: <code>`</code></p>
|
||||
|
||||
<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
|
||||
|
||||
With a code span, ampersands and angle brackets are encoded as HTML
|
||||
entities automatically, which makes it easy to include example HTML
|
||||
tags. Markdown will turn this:
|
||||
|
||||
Please don't use any `<blink>` tags.
|
||||
|
||||
into:
|
||||
|
||||
<p>Please don't use any <code><blink></code> tags.</p>
|
||||
|
||||
You can write this:
|
||||
|
||||
`—` is the decimal-encoded equivalent of `—`.
|
||||
|
||||
to produce:
|
||||
|
||||
<p><code>&#8212;</code> is the decimal-encoded
|
||||
equivalent of <code>&mdash;</code>.</p>
|
||||
|
||||
|
||||
|
||||
<h3 id="img">Images</h3>
|
||||
|
||||
Admittedly, it's fairly difficult to devise a "natural" syntax for
|
||||
placing images into a plain text document format.
|
||||
|
||||
Markdown uses an image syntax that is intended to resemble the syntax
|
||||
for links, allowing for two styles: *inline* and *reference*.
|
||||
|
||||
Inline image syntax looks like this:
|
||||
|
||||
![Alt text](/path/to/img.jpg)
|
||||
|
||||
![Alt text](/path/to/img.jpg "Optional title")
|
||||
|
||||
That is:
|
||||
|
||||
* An exclamation mark: `!`;
|
||||
* followed by a set of square brackets, containing the `alt`
|
||||
attribute text for the image;
|
||||
* followed by a set of parentheses, containing the URL or path to
|
||||
the image, and an optional `title` attribute enclosed in double
|
||||
or single quotes.
|
||||
|
||||
Reference-style image syntax looks like this:
|
||||
|
||||
![Alt text][id]
|
||||
|
||||
Where "id" is the name of a defined image reference. Image references
|
||||
are defined using syntax identical to link references:
|
||||
|
||||
[id]: url/to/image "Optional title attribute"
|
||||
|
||||
As of this writing, Markdown has no syntax for specifying the
|
||||
dimensions of an image; if this is important to you, you can simply
|
||||
use regular HTML `<img>` tags.
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
|
||||
<h2 id="misc">Miscellaneous</h2>
|
||||
|
||||
<h3 id="autolink">Automatic Links</h3>
|
||||
|
||||
Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
|
||||
|
||||
<http://example.com/>
|
||||
|
||||
Markdown will turn this into:
|
||||
|
||||
<a href="http://example.com/">http://example.com/</a>
|
||||
|
||||
Automatic links for email addresses work similarly, except that
|
||||
Markdown will also perform a bit of randomized decimal and hex
|
||||
entity-encoding to help obscure your address from address-harvesting
|
||||
spambots. For example, Markdown will turn this:
|
||||
|
||||
<address@example.com>
|
||||
|
||||
into something like this:
|
||||
|
||||
<a href="mailto:addre
|
||||
ss@example.co
|
||||
m">address@exa
|
||||
mple.com</a>
|
||||
|
||||
which will render in a browser as a clickable link to "address@example.com".
|
||||
|
||||
(This sort of entity-encoding trick will indeed fool many, if not
|
||||
most, address-harvesting bots, but it definitely won't fool all of
|
||||
them. It's better than nothing, but an address published in this way
|
||||
will probably eventually start receiving spam.)
|
||||
|
||||
|
||||
|
||||
<h3 id="backslash">Backslash Escapes</h3>
|
||||
|
||||
Markdown allows you to use backslash escapes to generate literal
|
||||
characters which would otherwise have special meaning in Markdown's
|
||||
formatting syntax. For example, if you wanted to surround a word with
|
||||
literal asterisks (instead of an HTML `<em>` tag), you can backslashes
|
||||
before the asterisks, like this:
|
||||
|
||||
\*literal asterisks\*
|
||||
|
||||
Markdown provides backslash escapes for the following characters:
|
||||
|
||||
\ backslash
|
||||
` backtick
|
||||
* asterisk
|
||||
_ underscore
|
||||
{} curly braces
|
||||
[] square brackets
|
||||
() parentheses
|
||||
# hash mark
|
||||
+ plus sign
|
||||
- minus sign (hyphen)
|
||||
. dot
|
||||
! exclamation mark
|
|
@ -0,0 +1,373 @@
|
|||
# German translation for uberwriter
|
||||
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
|
||||
# This file is distributed under the same license as the uberwriter package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: uberwriter\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2012-10-01 15:02+0200\n"
|
||||
"PO-Revision-Date: 2012-10-02 11:34+0000\n"
|
||||
"Last-Translator: Christian A. <christian.alt@live.de>\n"
|
||||
"Language-Team: German <de@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2012-10-27 09:20+0000\n"
|
||||
"X-Generator: Launchpad (build 16194)\n"
|
||||
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:472
|
||||
msgid "(no suggestions)"
|
||||
msgstr "(keine Vorschläge)"
|
||||
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:494
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:497
|
||||
msgid "Add \"{}\" to Dictionary"
|
||||
msgstr "\"{}\" zum Wörterbuch hinzufügen"
|
||||
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:501
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:503
|
||||
msgid "Ignore All"
|
||||
msgstr "Alle Ignorieren"
|
||||
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:518
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:520
|
||||
msgid "Languages"
|
||||
msgstr "Sprachauswahl"
|
||||
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:536
|
||||
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:539
|
||||
msgid "Suggestions"
|
||||
msgstr "Vorschläge"
|
||||
|
||||
#: ../uberwriter.desktop.in.h:1
|
||||
msgid "UberWriter"
|
||||
msgstr "UberWriter"
|
||||
|
||||
#: ../uberwriter.desktop.in.h:2
|
||||
msgid "UberWriter, a simple and distraction free Markdown Editor"
|
||||
msgstr "UberWriter, ein einfacher und ablenkungsfreier Markdown-Editor"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:400
|
||||
msgid "Save your File"
|
||||
msgstr "Datei speichern"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:543
|
||||
msgid "You can not export to PDF."
|
||||
msgstr "PDF-Export nicht möglich"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:545
|
||||
msgid ""
|
||||
"Please install <a href=\"apt:texlive\">texlive</a> from the software center."
|
||||
msgstr ""
|
||||
"Bitte installieren Sie das Paket <a href=\"apt:texlive\">texlive</a> aus dem "
|
||||
"Software-Center"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:573
|
||||
msgid "MarkDown or Plain Text"
|
||||
msgstr "MarkDown oder unformatierter Text"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:576
|
||||
msgid "Open a .md-File"
|
||||
msgstr "Eine .md-Datei öffnen"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:598
|
||||
msgid "You have not saved your changes."
|
||||
msgstr "Sie haben Ihre Änderungen nicht gespeichert."
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:600
|
||||
msgid "Close without Saving"
|
||||
msgstr "Schließen, ohne zu speichern"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:601
|
||||
msgid "Cancel"
|
||||
msgstr "Abbrechen"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:602
|
||||
msgid "Save now"
|
||||
msgstr "Jetzt speichern"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:603
|
||||
msgid "Unsaved changes"
|
||||
msgstr "Ungespeicherte Änderungen"
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:660
|
||||
msgid "You can not enable the Spell Checker."
|
||||
msgstr "Die Rechtschreib-Korrektur konnte nicht aktiviert werden."
|
||||
|
||||
#: ../uberwriter/UberwriterWindow.py:662
|
||||
msgid ""
|
||||
"Please install 'hunspell' or 'aspell' dictionarys for your language from the "
|
||||
"software center."
|
||||
msgstr ""
|
||||
"Bitte installieren Sie die Pakete 'hunspell' oder 'aspell' für Ihre Sprache "
|
||||
"aus dem Software-Center."
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:1
|
||||
msgid "_File"
|
||||
msgstr "_Datei"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:2
|
||||
msgid "Open Recent File"
|
||||
msgstr "Zuletzt benutzte Datei öffnen"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:3
|
||||
msgid "Export as ODT"
|
||||
msgstr "Als ODT exportieren"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:4
|
||||
msgid "Advanced Export..."
|
||||
msgstr "Erweiterter Export"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:5
|
||||
msgid "Copy raw HTML to clipboard"
|
||||
msgstr "HTML in die Zwischenablage kopieren"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:6
|
||||
msgid "_Edit"
|
||||
msgstr "_Bearbeiten"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:7
|
||||
msgid "_View"
|
||||
msgstr "_Ansicht"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:8
|
||||
msgid "Light text on a dark background"
|
||||
msgstr "Heller Text vor dunklem Hintergrund"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:9
|
||||
msgid "Dark Mode"
|
||||
msgstr "Abgedunkelter Modus"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:10
|
||||
msgid "Auto _Spellcheck"
|
||||
msgstr "Rechtschreibkorrektur"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:11
|
||||
msgid "F_ormat"
|
||||
msgstr "_Format"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:12
|
||||
msgid "Unordered List Item"
|
||||
msgstr "Ungeordnetes Listenelement"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:13
|
||||
msgid "Horizontal Rule"
|
||||
msgstr "Horizontale Linie"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:14 ../uberwriter/FormatShortcuts.py:182
|
||||
msgid "Heading"
|
||||
msgstr "Überschrift"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:15
|
||||
msgid "_Help"
|
||||
msgstr "_Hilfe"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:16
|
||||
msgid "Contents"
|
||||
msgstr "Inhalte"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:17
|
||||
msgid "Get Help Online..."
|
||||
msgstr "Online Hilfe erhalten …"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:18
|
||||
msgid "Translate This Application..."
|
||||
msgstr "Diese Anwendung übersetzen..."
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:19
|
||||
msgid "Focus Mode"
|
||||
msgstr "Fokusmodus"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:20
|
||||
msgid "Go into focus mode"
|
||||
msgstr "In Fokusmodus wechseln"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:21
|
||||
msgid "Fullscreen"
|
||||
msgstr "Vollbildmodus"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:22
|
||||
msgid "Go into fullscreen mode"
|
||||
msgstr "In Vollbildmodus wechseln"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:23
|
||||
msgid "Words:"
|
||||
msgstr "Wörter:"
|
||||
|
||||
#: ../data/ui/UberwriterWindow.ui.h:24
|
||||
msgid "Characters:"
|
||||
msgstr "Zeichen:"
|
||||
|
||||
#: ../uberwriter/__init__.py:34
|
||||
msgid "Show debug messages (-vv debugs uberwriter_lib also)"
|
||||
msgstr "Debugnachrichten anzeigen"
|
||||
|
||||
#: ../uberwriter/FormatShortcuts.py:85
|
||||
msgid "emphasized text"
|
||||
msgstr "kursiv"
|
||||
|
||||
#: ../uberwriter/FormatShortcuts.py:87
|
||||
msgid "strong text"
|
||||
msgstr "fettgedruckt"
|
||||
|
||||
#: ../uberwriter/FormatShortcuts.py:101
|
||||
msgid "List item"
|
||||
msgstr "Listeneintrag"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:1
|
||||
msgid "Export"
|
||||
msgstr "_Exportieren"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:2
|
||||
msgid "Smart"
|
||||
msgstr "Intelligent"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:3
|
||||
msgid "Pandoc can automatically make \"--\" to a long dash and more"
|
||||
msgstr ""
|
||||
"Pandoc kann \"--\" automatisch zu einem langen Strich machen und mehr"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:4
|
||||
msgid "Normalize"
|
||||
msgstr "Normalisieren"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:5
|
||||
msgid ""
|
||||
"Removes things like double spaces or spaces at the beginning of a paragraph"
|
||||
msgstr ""
|
||||
"Enfernt doppelte Leerzeichen oder Leerzeichen am Anfang eines Paragraphs"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:6
|
||||
msgid "Table of Contents"
|
||||
msgstr "Inhaltsverzeichnis"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:7
|
||||
msgid "Standalone"
|
||||
msgstr "Eigenständig"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:8
|
||||
msgid ""
|
||||
"Use a header and footer to include things like stylesheets and meta "
|
||||
"information"
|
||||
msgstr ""
|
||||
"Meta-Informationen können durch einen Kopf- und Fußteil hinzugefügt werden"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:9
|
||||
msgid "Number Sections"
|
||||
msgstr "Abschnitte nummerieren"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:10
|
||||
msgid "Strict Markdown"
|
||||
msgstr "Striktes Markdown"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:11
|
||||
msgid "Use \"strict\" markdown instead of \"pandoc\" markdown"
|
||||
msgstr "\"Striktes\" Markdown statt \"pandoc\"-Markdown benutzen"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:12
|
||||
msgid "Slideshow incremental bullets"
|
||||
msgstr "Slideshow (Ein Punkt nach dem anderen)"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:13
|
||||
msgid "Show one bullet point after another in a slideshow"
|
||||
msgstr "Einen Listenpunkt nach dem anderen zeigen"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:14
|
||||
msgid "<b>General Options</b>"
|
||||
msgstr "<b>Allgemeine Optionen</b>"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:15
|
||||
msgid "Highlight syntax"
|
||||
msgstr "Syntax hervorheben"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:16
|
||||
msgid "Choose a color theme for syntax highlighting"
|
||||
msgstr "Ein Farbschema zur Hervorhebung der Syntax wählen"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:17
|
||||
msgid "Highlight style "
|
||||
msgstr "Stil der Hervorhebung "
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:18
|
||||
msgid "<b>Syntax highlighting</b> (HTML, LaTeX)"
|
||||
msgstr "<b>Syntax-Hervorhebung</b> (HTML, LaTeX)"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:19
|
||||
msgid "Self Contained"
|
||||
msgstr "Als Container"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:20
|
||||
msgid ""
|
||||
"Produces a HTML that has no external dependencies (all images and "
|
||||
"stylesheets are included)"
|
||||
msgstr "Erzeugt ein HTML-Dokument, das alle Bilder und Stylesheets enthält"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:21
|
||||
msgid "HTML 5"
|
||||
msgstr "HTML 5"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:22
|
||||
msgid "Use HTML 5 syntax"
|
||||
msgstr "HTML-5-Syntax benutzen"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:23
|
||||
msgid "Choose a CSS File that you want to use"
|
||||
msgstr "Wählen Sie eine CSS-Datei, die Sie verwenden möchten"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:24
|
||||
msgid "CSS File"
|
||||
msgstr "CSS-Datei"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:25
|
||||
msgid "<b>HTML Options</b>"
|
||||
msgstr "<b>HTML-Einstellungen</b>"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:26
|
||||
msgid "<b>Bibliography File</b>"
|
||||
msgstr "<b>Literaturverzeichnis</b>"
|
||||
|
||||
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:27
|
||||
msgid "Commandline Reference"
|
||||
msgstr "Befehlszeilenargumente"
|
||||
|
||||
#: ../data/ui/AboutUberwriterDialog.ui.h:1
|
||||
msgid ""
|
||||
"# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>\n"
|
||||
"# This program is free software: you can redistribute it and/or modify it \n"
|
||||
"# under the terms of the GNU General Public License version 3, as published "
|
||||
"\n"
|
||||
"# by the Free Software Foundation.\n"
|
||||
"# \n"
|
||||
"# This program is distributed in the hope that it will be useful, but \n"
|
||||
"# WITHOUT ANY WARRANTY; without even the implied warranties of \n"
|
||||
"# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR \n"
|
||||
"# PURPOSE. See the GNU General Public License for more details.\n"
|
||||
"# \n"
|
||||
"# You should have received a copy of the GNU General Public License along \n"
|
||||
"# with this program. If not, see <http://www.gnu.org/licenses/>.\n"
|
||||
msgstr ""
|
||||
"# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>\n"
|
||||
"#Dieses Programm ist freie Software. Sie können es unter den Bedingungen der "
|
||||
"\n"
|
||||
"#GNU General Public License in der Version 3, wie von der Free Software "
|
||||
"Foundation veröffentlicht, \n"
|
||||
"#weitergeben und/oder modifizieren. \n"
|
||||
"# \n"
|
||||
"#Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, dass es "
|
||||
"Ihnen \n"
|
||||
"#von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die "
|
||||
"implizite \n"
|
||||
"#Garantie der MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. "
|
||||
"\n"
|
||||
"#Details finden Sie in der GNU General Public License.\n"
|
||||
"#\n"
|
||||
"#Sie sollten ein Exemplar der GNU General Public License zusammen mit "
|
||||
"diesem\n"
|
||||
"#Programm erhalten haben. Falls nicht, siehe "
|
||||
"<http://www.gnu.org/licenses/>.\n"
|
||||
|
||||
#: ../data/ui/AboutUberwriterDialog.ui.h:14
|
||||
msgid "Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>"
|
||||
msgstr "Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>"
|