Bug fixed (lib_gen_main_tex.rb).

This commit is contained in:
Toshio Sekiya 2021-06-30 23:52:33 +09:00
parent 3db40bc7db
commit 7423bec0bd
19 changed files with 52 additions and 43 deletions

View file

@ -156,7 +156,11 @@ file_table.each do |tbl|
file tbl[3] => [tbl[0]] + tbl[0].c_files do
tex_md = "latex/" + tbl[0].to_md
src2md tbl[0], tex_md, file_table, "latex"
sh "pandoc --listings -o #{tbl[3]} #{tex_md}"
if tbl[0] == "src/Readme_for_developers.src.md"
sh "pandoc -o #{tbl[3]} #{tex_md}"
else
sh "pandoc --listings -o #{tbl[3]} #{tex_md}"
end
File.delete(tex_md)
end
end

View file

@ -223,9 +223,9 @@ This command is similar to "#if", "#elif", #else" and "#endif" directives in C p
For example,
@@@if gfm
Refer to [tfetextview API reference](tfetextview_doc.md)
Refer to [tfetextview API reference](../src/tfetextview_doc.md)
@@@elif html
Refer to [tfetextview API reference](tfetextview_doc.html)
Refer to [tfetextview API reference](../src/tfetextview_doc.html)
@@@elif latex
Refer to tfetextview API reference in appendix.
@@@end
@ -397,10 +397,10 @@ So the size is removed in the conversion.
If a .src.md file has relative URL link, it will be changed by conversion.
Because .src.md files are located under `src` directory and GFM files are located under `gfm` directory, base URL of GFM files is different from base URL of .src.md files.
For example, `[src/sample.c](sample.c)` is translated to `[src/sample.c](../src/sample.c)`.
For example, `[src/sample.c](../src/sample.c)` is translated to `[src/sample.c](../src/sample.c)`.
If a link points another .src.md file, then the target filename will be changed to .md file.
For example, `[Section 5](sec5.md)` is translated to `[Section 5](sec5.md)`.
For example, `[Section 5](sec5.md)` is translated to `[Section 5](../src/sec5.md)`.
If you want to clean the directory, that means remove all the generated markdown files, type `rake clean`.

View file

@ -6,7 +6,7 @@ A new version of the text file editor (`tfe`) will be made in this section and t
It is `tfe5`.
There are many changes from the prior version.
All the sources are listed in [Section 16](sec16.md).
They are located in two directories, [src/tfe5](tfe5) and [src/tfetextview](tfetextview).
They are located in two directories, [src/tfe5](../src/tfe5) and [src/tfetextview](../src/tfetextview).
## Encapsulation

View file

@ -442,11 +442,11 @@ See [Gio reference manual](https://developer.gnome.org/gio/stable/GFile.html#g-f
## The API document and source file of tfetextview.c
Refer [API document of TfeTextView](../gfm/tfetextview_doc.md).
Refer [API document of TfeTextView](tfetextview_doc.md).
It is under the directory `src/tfetextview`.
All the source files are listed in [Section 16](sec16.md).
You can find them under [src/tfe5](tfe5) and [src/tfetextview](tfetextview) directories.
You can find them under [src/tfe5](../src/tfe5) and [src/tfetextview](../src/tfetextview) directories.
Up: [Readme.md](../Readme.md), Prev: [Section 12](sec12.md), Next: [Section 14](sec14.md)

View file

@ -319,6 +319,6 @@ If you use git, run the terminal and type the following.
$ git clone https://github.com/ToshioCP/Gtk4-tutorial.git
The source files are under [`/src/tfe5`](tfe5) directory.
The source files are under [`/src/tfe5`](../src/tfe5) directory.
Up: [Readme.md](../Readme.md), Prev: [Section 14](sec14.md), Next: [Section 16](sec16.md)

View file

@ -1231,7 +1231,7 @@ The following is `meson.build`.
16
~~~
Source files of `tfe` is under [src/tfe6](tfe6) directory.
Source files of `tfe` is under [src/tfe6](../src/tfe6) directory.
Copy them to your temporary directory and try to compile and install.
~~~

View file

@ -842,7 +842,7 @@ $ ninja -C _build
$ ninja -C _build install # or 'sudo ninja -C _build install'
~~~
Source files are in [src/tfe7](tfe7) directory.
Source files are in [src/tfe7](../src/tfe7) directory.
We made a very small text editor.
You can add features to this editor.

View file

@ -116,7 +116,7 @@ To compile this, type the following.
$ gcc `pkg-config --cflags cairo` cairo.c `pkg-config --libs cairo`
![rectangle.png](misc/rectangle.png)
![rectangle.png](../image/rectangle.png)
There are lots of documentations in [Cairo's website](https://www.cairographics.org/).
If you aren't familiar with Cairo, it is strongly recommended to read the [tutorial](https://www.cairographics.org/tutorial/) in the website.

View file

@ -6,7 +6,7 @@ A program `turtle` is an example with the combination of TfeTextView and GtkDraw
It is a very small interpreter but it provides a tool to draw fractal curves.
The following diagram is a Koch curve, which is a famous example of fractal curves.
![Koch curve](turtle/image/turtle_koch.png)
![Koch curve](../src/turtle/image/turtle_koch.png)
This program uses flex and bison.
Flex is a lexical analyzer.
@ -42,7 +42,7 @@ The side of the square is 100 pixels long.
In the same way, you can draw other curves.
The documentation above shows some fractal curves such as tree, snow and square-koch.
The source code in turtle language is located at [src/turtle/example](turtle/example) directory.
The source code in turtle language is located at [src/turtle/example](../src/turtle/example) directory.
You can read these files into `turtle` editor by clicking on the `Open` button.
## Combination of TfeTextView and GtkDrawingArea objects
@ -129,7 +129,7 @@ Its size is the same as the surface of the GtkDrawingArea instance.
Other part of `turtleapplication.c` is almost same as the codes of `colorapplication.c` in the previous section.
The codes of `turtleapplication.c` is in the [turtle directory](turtle).
The codes of `turtleapplication.c` is in the [turtle directory](../src/turtle).
## What does the interpreter do?

View file

@ -199,7 +199,7 @@ GtkNoSelection is used, so user can't select any item.
79
~~~
The file `list1.c` is located under the directory [src/misc](misc).
The file `list1.c` is located under the directory [src/misc](../src/misc).
Make a shell script below and save it to your bin directory.
(If you've installed Gtk4 from the source to $HOME/local, then your bin directory is $Home/local/bin.
Otherwise, $Home/bin is your private bin directory.)
@ -268,7 +268,7 @@ Therefore, GtkListItem instance is used as the `this` object of the lookup tag w
`this` object will be explained in [section 27](sec27.md).
The C source code is as follows.
Its name is `list2.c` and located under [src/misc](misc) directory.
Its name is `list2.c` and located under [src/misc](../src/misc) directory.
~~~C
1 #include <gtk/gtk.h>
@ -427,7 +427,7 @@ Because it can be NULL when GListItem `item` is unbound.
If its GFileInfo, then return the filename (copy of the filename).
The whole program (`list3.c`) is as follows.
The program is located in [src/misc](misc) directory.
The program is located in [src/misc](../src/misc) directory.
~~~C
1 #include <gtk/gtk.h>

View file

@ -482,7 +482,7 @@ Such functionality comes from desktop.
## Compilation and execution
The source files are located in [src/list4](list4) directory.
The source files are located in [src/list4](../src/list4) directory.
To compile and execute list4, type as follows.
~~~
@ -566,7 +566,7 @@ This method decreases the number of ui files.
But, the new ui file is a bit complicated especially for the beginners.
If you feel some difficulty, it is better for you to separate the ui file.
A directory [src/list5](list5) includes the ui file above.
A directory [src/list5](../src/list5) includes the ui file above.
Up: [Readme.md](../Readme.md), Prev: [Section 25](sec25.md), Next: [Section 27](sec27.md)

View file

@ -23,7 +23,7 @@ Evaluation is like a calculation.
A value is got by evaluating the expression.
First, I want to show you the C file of the example for GtkExpression.
Its name is `exp.c` and located under [src/expression](expression) directory.
Its name is `exp.c` and located under [src/expression](../src/expression) directory.
You don't need to understand the details now, just look at it.
It will be explained in the next subsection.
@ -637,7 +637,7 @@ It will be used in the next section to build GtkListItem in GtkColumnView, which
## Compilation and execution
All the sources are in [src/expression](expression) directory.
All the sources are in [src/expression](../src/expression) directory.
Change your current directory to the directory and run meson and ninja.
Then, execute the application.

View file

@ -490,7 +490,7 @@ These are almost same as the functions in section 25 and 26.
## Compilation and execution.
All the source files are in [src/column](column) directory.
All the source files are in [src/column](../src/column) directory.
Change your current directory to the directory and type the following.
~~~

View file

@ -3,23 +3,23 @@
TfeTextView -- Child object of GtkTextView. It holds GFile which the contents of GtkTextBuffer correponds to.
## Functions
- GFile *[tfe_text_view_get_file ()](#tfe_text_view_get_file)
- void [tfe_text_view_open ()](#tfe_text_view_open)
- void [tfe_text_view_save ()](#tfe_text_view_save)
- void [tfe_text_view_saveas ()](#tfe_text_view_saveas)
- GtkWidget *[tfe_text_view_new_with_file ()](#tfe_text_view_new_with_file)
- GtkWidget *[tfe_text_view_new ()](#tfe_text_view_new)
- GFile *[tfe_text_view_get_file ()](../src/tfetextview/#tfe_text_view_get_file)
- void [tfe_text_view_open ()](../src/tfetextview/#tfe_text_view_open)
- void [tfe_text_view_save ()](../src/tfetextview/#tfe_text_view_save)
- void [tfe_text_view_saveas ()](../src/tfetextview/#tfe_text_view_saveas)
- GtkWidget *[tfe_text_view_new_with_file ()](../src/tfetextview/#tfe_text_view_new_with_file)
- GtkWidget *[tfe_text_view_new ()](../src/tfetextview/#tfe_text_view_new)
## Signals
- void [change-file](#change-file)
- void [open-response](#open-response)
- void [change-file](../src/tfetextview/#change-file)
- void [open-response](../src/tfetextview/#open-response)
## Types and Values
- [TfeTextView](#tfetextview-1)
- [TfeTextViewClass](#tfetextviewclass)
- [TfeTextViewOpenResponseType](#enum-tfetextviewopenresponsetype)
- [TfeTextView](../src/tfetextview/#tfetextview-1)
- [TfeTextViewClass](../src/tfetextview/#tfetextviewclass)
- [TfeTextViewOpenResponseType](../src/tfetextview/#enum-tfetextviewopenresponsetype)
## Object Hierarchy

View file

@ -27,14 +27,14 @@ Type the following command then turtle shows the following window.
$ turtle
~~~
![Screenshot just after it's executed](image/turtle1.png)
![Screenshot just after it's executed](../src/turtle/image/turtle1.png)
The left half is a text editor and the right half is a surface.
Surface is like a canvas to draw shapes.
Write turtle language in the text editor and click on `run` button, then the program will be executed and it draws shapes on the surface.
![Tree](image/turtle_tree.png)
![Tree](../src/turtle/image/turtle_tree.png)
If you add the following line in `turtle.h`, then codes to inform the status will also be compiled.
However, the speed will be quite slow because of the output messages.
@ -86,7 +86,7 @@ Therefore, `tr 90` means "Turn right by 90 degrees".
If you click on the `run`button, then two line segments appears.
One is vertical and the other is horizontal.
![Two line segments on the surface](image/turtle2.png)
![Two line segments on the surface](../src/turtle/image/turtle2.png)
## Background and foreground color
@ -113,7 +113,7 @@ This command changes the pen color.
The prior shapes on the surface aren't affected.
After this command, the turtle draws lines with the new color.
![Change the foreground color](image/turtle3.png)
![Change the foreground color](../src/turtle/image/turtle3.png)
## Other simple commands
@ -307,7 +307,7 @@ Recursive call can be applied to draw fractal curves.
Fractal curves appear when a procedure is applied to it repeatedly.
The procedure replaces a part of the curve with the contracted curve.
![Tree](image/turtle_tree.png)
![Tree](../src/turtle/image/turtle_tree.png)
This shape is called tree.
The basic pattern of this shape is a line segment.
@ -321,9 +321,9 @@ This repeating is programmed by recursive call.
Two more examples are shown here.
They are Koch curve and Square Koch curve.
![Koch curve](image/turtle_koch.png)
![Koch curve](../src/turtle/image/turtle_koch.png)
![Square Koch curve](image/turtle_square_koch.png)
![Square Koch curve](../src/turtle/image/turtle_square_koch.png)
## Tokens and punctuations

BIN
image/rectangle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View file

@ -87,11 +87,13 @@ main = <<'EOS'
EOS
texfilenames.each do |filename|
filename = filename.sub(/^#{directory}\//, "")
main += " \\input{#{filename}}\n"
end
main += "\\newpage\n"
main += "\\appendix\n"
appendixfilenames.each do |filename|
filename = filename.sub(/^#{directory}\//, "")
main += " \\input{#{filename}}\n"
end
main += "\\end{document}\n"

View file

@ -274,15 +274,18 @@ def change_rel_link line, org_dir, new_dir, file_table=nil, type="gfm"
right = $'
name = $1
link = $2
converted = false
if file_table
file_table.each do |tbl|
if tbl[0] == "#{org_dir}/#{link}"
p_link = Pathname.new tbl[i]
link = p_link.relative_path_from(p_new_dir).to_s
converted = true
break
end
end
elsif ! (link =~ /^(http|\/)/)
end
if ! converted && ! (link =~ /^(http|\/)/)
p_link = Pathname.new "#{org_dir}/#{link}"
link = p_link.relative_path_from(p_new_dir).to_s
end

View file

@ -83,7 +83,7 @@ To compile this, type the following.
$ gcc `pkg-config --cflags cairo` cairo.c `pkg-config --libs cairo`
![rectangle.png](misc/rectangle.png)
![rectangle.png](../image/rectangle.png)
There are lots of documentations in [Cairo's website](https://www.cairographics.org/).
If you aren't familiar with Cairo, it is strongly recommended to read the [tutorial](https://www.cairographics.org/tutorial/) in the website.