Skip to content

Commit

Permalink
CSS/documentation updates.
Browse files Browse the repository at this point in the history
* Closes #206.
  • Loading branch information
h3rald committed Jul 22, 2012
1 parent 2fe3a51 commit 0f18952
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 79 deletions.
12 changes: 12 additions & 0 deletions book/compile_web
@@ -0,0 +1,12 @@
#!/usr/bin/env ruby

Dir.chdir '../styles'

system 'sh "generate"'

Dir.chdir '../book'

require_relative '../lib/glyph.rb'
require_relative '../lib/glyph/commands.rb'

GLI.run ["-d", "compile", '-f', 'h3rald']
10 changes: 5 additions & 5 deletions book/document.glyph
Expand Up @@ -51,7 +51,7 @@ book[
chapter[
@title[Authoring Documents]
section[
@title[.glyph files]
@title[code[.glyph] files]
@src[text_editing/glyph_files]
]
section[
Expand Down Expand Up @@ -296,22 +296,22 @@ book[
@title[Configuration Reference]
@id[cfg_ref]
section[
@title[document.*]
@title[code[document.*]]
@id[cfg_document]
@src[config/document]
]
section[
@title[filters.*]
@title[code[filters.*]]
@id[cfg_filters]
@src[config/filters]
]
section[
@title[options.*]
@title[code[options.*]]
@id[cfg_options]
@src[config/options]
]
section[
@title[output.*]
@title[code[output.*]]
@id[cfg_output]
@src[config/output]
]
Expand Down
2 changes: 1 addition & 1 deletion book/lib/layouts/bookpage.glyph
Expand Up @@ -100,7 +100,7 @@
<nav>
<a href="/about/">ABOUT</a>\|<a href="/contact/">CONTACT</a>
</nav>
<p>H3RALD Web Site v8.1.2 &copy; 2004 &mdash; 2011 <em>Fabio Cevasco</em></p>
<p>H3RALD Web Site v8.1.2 &copy; 2004 &mdash; 2012 <em>Fabio Cevasco</em></p>
</section>
</footer>
</section><!-- #container end -->
Expand Down
16 changes: 4 additions & 12 deletions book/lib/macros/reference.rb
Expand Up @@ -90,24 +90,16 @@

macro :block_example do
interpret %{
div[@class[example]
p[strong[Example]]
section[
@title[Example]
@notoc[true]
highlight[=html|
#{value}
=]
]
}
end

macro :examples do
%{
<div class="examples">
<p><strong>Examples:</strong></p>
#{value.split("\n").map{|i| "<code>#{i}</code><br />"}.to_s}
</div>
}
end

macro :aliases do
%{<strong>Aliases:</strong> <code>#{value}</code>}
end
Expand All @@ -130,7 +122,7 @@
]} if raw_attr(:remarks)
interpret %{
section[
@title[#{m_name}]
@title[code[#{m_name}]]
@id[m_#{m_name.gsub(/[^a-z0-1_-]/, '_')}]
txt[
#{m_value}
Expand Down
7 changes: 0 additions & 7 deletions book/text/introduction.glyph
@@ -1,13 +1,6 @@
.[
&:[prince|=>[http://www.princexml.com/|Prince]]
&:[wkhtml|=>[http://code.google.com/p/wkhtmltopdf/|wkhtmltopdf]]
macro:[=?txt|
if Glyph.lite? then
interpret "section[#{raw_value}]"
else
interpret "txt[#{raw_value}]"
end
=]
]section[txt[Glyph is a _Rapid Document Authoring Framework_.

With Glyph, creating and maintaining any kind of document becomes as easy as... _programming_. Glyph enables you to minimize text duplication, focus on content rather than presentation, manage references seamlessly and automate tedious tasks through a simple but effective macro language, specifically geared towards customization and extensibility.]
Expand Down
50 changes: 29 additions & 21 deletions book/text/ref_commands.glyph
Expand Up @@ -21,7 +21,7 @@ section[
]
]
section[
@title[add]
@title[code[add]]
@id[c_add]
p[Creates a new text file in the code[text/] folder.]
example[glyph add introduction.textile]
Expand All @@ -30,7 +30,7 @@ section[
]
]
section[
@title[compile]
@title[code[compile]]
@id[c_compile]
p[Compiles a Glyph document into an output file. If no options are specified, the code[document.glyph] file is used as source to produce a standalone HTML file.]
example[glyph compile -f pdf]
Expand All @@ -54,12 +54,14 @@ If specified, enable =>[#auto_regeneration|auto regeneration] (requires the =>[h
]
]
section[
@title[config]
@title[code[config]]
@id[c_config]
Gets or sets a configuration setting in the project or global configuration file (\/fmi[configuration files|#cfg]).
examples[
glyph config document.filename
glyph config -g document.author "Fabio Cevasco"
§[
@title[Examples]
@notoc[true]
p[code[glyph config document.filename]]
p[code[glyph config -g document.author "Fabio Cevasco"]]
]
options[
-o[global|
Expand All @@ -73,25 +75,27 @@ If specified, the global configuration file is processed instead of the project
]
]
section[
@title[help]
@title[code[help]]
@id[c_help]
Prints information about all Glyph commands or about one specific command.
examples[
glyph help
glyph help compile
§[
@title[Examples]
@notoc[true]
p[code[glyph help]]
p[code[glyph help compile]]
]
parameters[
-p[em[command]|A valid Glyph command.]
]
]
section[
@title[init]
@title[code[init]]
@id[c_init]
Creates a new Glyph project in the current directory (if empty).
example[glyph init]
]
section[
@title[outline]
@title[code[outline]]
@id[c_outline]
Display an outline of the current document.
options[
Expand All @@ -108,21 +112,25 @@ Display file names.
Display section titles.
]
]
examples[
glyph outline -it -l 1
glyph outline -l 2
glyph outline -f
§[
@title[Examples]
@notoc[true]
p[code[glyph outline -it -l 1]]
p[code[glyph outline -l 2]]
p[code[glyph outline -f]]
]
]
section[
@title[stats]
@title[code[stats]]
@id[c_stats]
def:[stats_option|-o[{{0}}|If specified, general statistics about {{0}} are displayed (see =>[#stats_{{0}}]).]]
def:[stats_long_option|long_option[{{0}}|Display detailed statistics about the specified {{0}}.]]
p[Displays project statistics (\/fmi[this command|#stats]).]
examples[
glyph stats -m
glyph stats --link=h3rald.com
§[
@title[Examples]
@notoc[true]
p[code[glyph stats -m]]
p[code[glyph stats --link=h3rald.com]]
]
options[
stats_option[bookmarks]
Expand All @@ -137,7 +145,7 @@ glyph stats --link=h3rald.com
]
]
section[
@title[todo]
@title[code[todo]]
@id[c_todo]
Prints all the todo items saved using the %>[todo].
example[glyph todo]
Expand Down
4 changes: 2 additions & 2 deletions macros/block.rb
Expand Up @@ -92,15 +92,15 @@
# Get the previous topic
previous_topic = @node[:document].topics.last
if previous_topic then
@data[:previous] = render :link, :target => "#{base_url}#{previous_topic[:src].gsub(/\..+$/, '.html')}", :title => previous_topic[:title]
@data[:previous] = render :link, :target => "#{base_url}#{previous_topic[:src].gsub(/\..+$/, '.html')}", :title => "← "+previous_topic[:title]
else
@data[:previous] = ""
end
# The next topic is not going to be available yet, use a placeholder
@data[:next] = placeholder do |document|
current_topic = document.topics.select{|t| t[:id] == topic_id}[0] rescue nil
next_topic = document.topics[document.topics.index(current_topic)+1] rescue nil
render :link, :title => next_topic[:title], :target => "#{base_url}#{next_topic[:src].gsub(/\..+$/, '.html')}" if next_topic
render :link, :title => next_topic[:title]+" →", :target => "#{base_url}#{next_topic[:src].gsub(/\..+$/, '.html')}" if next_topic
end
render
end
Expand Down
7 changes: 4 additions & 3 deletions macros/reps/html.rb
Expand Up @@ -171,9 +171,10 @@
end

rep :section do |data|
css_class = data[:name].to_s.match(/[a-z0-9_-]/i) ? data[:name] : "section"
title = data[:title] ? %{<h#{data[:level]} id="#{data[:id]}">#{data[:title]}</h#{data[:level]}>\n} : ""
%{<div class="#{css_class}">
sec_class = data[:name].to_s.match(/[a-z0-9_-]/i) ? data[:name] : "section"
hd_class = data[:toc] ? "toc" : "notoc"
title = data[:title] ? %{<h#{data[:level]} id="#{data[:id]}" class="#{hd_class}">#{data[:title]}</h#{data[:level]}>\n} : ""
%{<div class="#{sec_class}">
#{title}#{data[:content]}
</div>}
Expand Down
7 changes: 4 additions & 3 deletions macros/reps/html5.rb
Expand Up @@ -91,9 +91,10 @@
end

rep :section do |data|
css_class = data[:name].to_s.match(/[a-z0-9_-]/i) ? data[:name] : "section"
title = data[:title] ? %{<header><h1 id="#{data[:id]}">#{data[:title]}</h1></header>\n} : ""
%{<section class="#{css_class}">
sec_class = data[:name].to_s.match(/[a-z0-9_-]/i) ? data[:name] : "section"
hd_class = data[:toc] ? "toc" : "notoc"
title = data[:title] ? %{<header><h1 id="#{data[:id]}" class="#{hd_class}">#{data[:title]}</h1></header>\n} : ""
%{<section class="#{sec_class}">
#{title}#{data[:content]}
</section>}
Expand Down
27 changes: 15 additions & 12 deletions styles/pagination.css
Expand Up @@ -8,6 +8,9 @@
@bottom {
content: counter(page, decimal); } }

.bodymatter > :nth-child(1) {
counter-reset: page 1; }

@page frontmatter {
@bottom {
content: counter(page, lower-roman); } }
Expand Down Expand Up @@ -110,23 +113,23 @@ div.backmatter {
.bodymatter h3::before, .bodymatter section h1:before {
content: counter(h2) "." counter(h3) " "; }

.backmatter h3::before {
.backmatter h3.toc::before {
content: counter(a2, upper-latin) "." counter(h3) " "; }

.bodymatter section section h1:before {
.bodymatter section section h1.toc:before {
content: counter(a2, upper-latin) "." counter(h3) " "; }
.bodymatter h4::before, .bodymatter section section h1:before {
.bodymatter h4.toc::before, .bodymatter section section h1.toc:before {
content: counter(h2) "." counter(h3) "." counter(h4) " "; }

.backmatter h4::before {
.backmatter h4.toc::before {
content: counter(a2, upper-latin) "." counter(h3) "." counter(h4) " "; }

.bodymatter section section section h2:before {
.bodymatter section section section h2.toc:before {
content: counter(a2, upper-latin) "." counter(h3) "." counter(h4) " "; }
.bodymatter h5::before, .bodymatter section section section section h2:before {
.bodymatter h5.toc::before, .bodymatter section section section section h2.toc:before {
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) " "; }

.backmatter h5::before, .bodymatter section section section section h2:before {
.backmatter h5.toc::before, .bodymatter section section section section h2.toc:before {
content: counter(a2, upper-latin) "." counter(h3) "." counter(h4) "." counter(h5) " "; }

h2, section h1 {
Expand All @@ -137,23 +140,23 @@ h2, section h1 {
.halftitlepage h2, .titlepage h2 {
page-break-before: avoid; }

.chapter {
.bodymatter .chapter {
counter-increment: h2;
counter-reset: h3; }

.appendix {
.backmatter .appendix {
counter-increment: a2;
counter-reset: h3; }

.bodymatter h3, .backmatter h3, .bodymatter section h1, .backmatter section h1 {
.bodymatter h3.toc, .backmatter h3.toc, .bodymatter section h1.toc, .backmatter section h1.toc {
counter-increment: h3;
counter-reset: h4; }

.bodymatter h4, .backmatter h4, .bodymatter section section h1, .backmatter section section h1 {
.bodymatter h4.toc, .backmatter h4.toc, .bodymatter section section h1.toc, .backmatter section section h1.toc {
counter-increment: h4;
counter-reset: h5; }

.bodymatter h5, .backmatter h5, .bodymatter section section section h1, .backmatter section section section h1 {
.bodymatter h5.toc, .backmatter h5.toc, .bodymatter section section section h1.toc, .backmatter section section section h1.toc {
counter-increment: h5; }

h1, h2, h3, h4, h5 {
Expand Down

0 comments on commit 0f18952

Please sign in to comment.