[doconce] push by h...@simula.no - Bugfixes and other fixes. on 2013-08-11 07:11 GMT

2 views
Skip to first unread message

doc...@googlecode.com

unread,
Aug 11, 2013, 3:11:26 AM8/11/13
to docon...@googlegroups.com
Revision: c3d786d8b1cc
Branch: default
Author: "Hans Petter Langtangen <h...@simula.no>"
Date: Sun Aug 11 00:11:16 2013
Log: Bugfixes and other fixes.
http://code.google.com/p/doconce/source/detail?r=c3d786d8b1cc

Modified:
/doc/tutorial/doconce2anything.do.txt
/lib/doconce/doconce.py
/lib/doconce/html.py
/lib/doconce/latex.py

=======================================
--- /doc/tutorial/doconce2anything.do.txt Sat Aug 10 23:22:34 2013
+++ /doc/tutorial/doconce2anything.do.txt Sun Aug 11 00:11:16 2013
@@ -390,6 +390,9 @@
An option `--device=paper` makes some adjustments for documents
aimed at being printed. For example, links to web resources are
associated with a footnote listing the complete web address (URL).
+(Very long URLs in footnotes can be shortened using services such
+as URL: "http://goo.gl/", URL: "http://tinyurl.com/", and
+URL: "https://bitly.com/".)
The default, `--device=screen`, creates a PDF file for reading
on a screen where links are just clickable.

=======================================
--- /lib/doconce/doconce.py Sun Aug 4 11:57:04 2013
+++ /lib/doconce/doconce.py Sun Aug 11 00:11:16 2013
@@ -2312,7 +2312,15 @@
In addition, the preprocessor option FORMAT (=format) is
always defined.
"""
- device = 'paper' if option('device=', '') == 'paper' else 'screen'
+ device = None
+ # Is DEVICE set as command-line option?
+ for arg in sys.argv[1:]:
+ if arg.startswith('-DDEVICE='):
+ device = arg.split('-DDEVICE=')[1]
+ elif arg.startswith('DEVICE='):
+ device = arg.split('DEVICE=')[1]
+ if device is None:
+ device = 'paper' if option('device=', '') == 'paper' else 'screen'

f = open(filename, 'r'); filestr = f.read(); f.close()
if filestr.strip() == '':
=======================================
--- /lib/doconce/html.py Sat Aug 10 23:04:17 2013
+++ /lib/doconce/html.py Sun Aug 11 00:11:16 2013
@@ -110,6 +110,7 @@
# alt: background-image: url(data:image/png;base64,iVBORw0KGgoAAAAN...);

css_solarized = """\
+ /* solarized style */
body {
margin:5;
padding:0;
@@ -150,6 +151,8 @@
"""

css_blueish = """\
+ /* blueish style */
+
/* Color definitions: http://www.december.com/html/spec/color0.html
CSS examples: http://www.w3schools.com/css/css_examples.asp */

@@ -172,6 +175,8 @@
"""

css_blueish2 = """\
+ /* blueish2 style */
+
/* Color definitions: http://www.december.com/html/spec/color0.html
CSS examples: http://www.w3schools.com/css/css_examples.asp */

@@ -203,6 +208,8 @@
"""

css_bloodish = """\
+ /* bloodish style */
+
body {
font-family: Helvetica, Verdana, Arial, Sans-serif;
color: #404040;
@@ -1054,6 +1061,17 @@

admons = 'notice', 'summary', 'warning', 'question', 'block'
global admon_css_vars # set in define
+global html_admon_style # set below
+
+html_admon_style = option('html_admon=', None)
+if html_admon_style is None:
+ # Set sensible default value
+ if option('html_style=') == 'solarized':
+ html_admon_style = 'apricot'
+ elif option('html_style=') == 'blueish2':
+ html_admon_style = 'yellow'
+ else:
+ html_admon_style = 'gray'

for _admon in admons:
_Admon = _admon.capitalize() # upper first char
@@ -1076,16 +1094,8 @@
keep_pygm_bg = option('keep_pygments_html_bg')
pygments_pattern = r'"background: .+?">'

- html_admon = option('html_admon=', None)
- if html_admon is None:
- # Set sensible default value
- if option('html_style=') == 'solarized':
- html_admon = 'apricot'
- elif option('html_style=') == 'blueish2':
- html_admon = 'yellow'
- else:
- html_admon = 'gray'
- if html_admon == 'colors':
+ # html_admon_style is global variable
+ if html_admon_style == 'colors':
if not keep_pygm_bg:
block = re.sub(pygments_pattern, r'"background: %%s">' %%

admon_css_vars['colors']['background_%(_admon)s'], block)
@@ -1095,17 +1105,17 @@
""" %% (text_size, title, block)
return janko

- elif html_admon in ('gray', 'yellow', 'apricot') or
option('html_style=') == 'vagrant':
+ elif html_admon_style in ('gray', 'yellow', 'apricot') or
option('html_style=') == 'vagrant':
if not keep_pygm_bg:
block = re.sub(pygments_pattern, r'"background: %%s">' %%
- admon_css_vars[html_admon]['background'], block)
+ admon_css_vars[html_admon_style]['background'],
block)
vagrant = """<div class="alert alert-block alert-%(_admon)s
alert-text-%%s"><b>%%s</b>
%%s
</div>
""" %% (text_size, title, block)
return vagrant

- elif html_admon == 'lyx':
+ elif html_admon_style == 'lyx':
block = '<div class="alert-text-%%s">%%s</div>' %% (text_size,
block)
if '%(_admon)s' != 'block':
lyx = """
@@ -1327,15 +1337,14 @@
icon_question='Knob_Forward.png',
icon_block='',
)
- html_admon = option('html_admon=', 'gray')
- # Need to add admon_styles?
+ # Need to add admon_styles? (html_admon_style is global)
for admon in admons:
if '!b'+admon in filestr and '!e'+admon in filestr:
- if html_admon == 'colors':
- css += (admon_styles1 % admon_css_vars[html_admon])
- elif html_admon in ('gray', 'yellow', 'apricot'):
- css += (admon_styles2 % admon_css_vars[html_admon])
- elif html_admon in ('lyx', 'paragraph'):
+ if html_admon_style == 'colors':
+ css += (admon_styles1 % admon_css_vars[html_admon_style])
+ elif html_admon_style in ('gray', 'yellow', 'apricot'):
+ css += (admon_styles2 % admon_css_vars[html_admon_style])
+ elif html_admon_style in ('lyx', 'paragraph'):
css += admon_styles_text
break

=======================================
--- /lib/doconce/latex.py Thu Jul 18 20:58:04 2013
+++ /lib/doconce/latex.py Sun Aug 11 00:11:16 2013
@@ -156,7 +156,7 @@
if not ('ftp:' in text or 'http' in text):
# The link text does not display the URL so we include it
# in a footnote (\nolinkurl{} indicates URL: "...")
- texttt_url =
url.replace('_', '\\_').replace('#', '\\#').replace('%', '\\%')
+ texttt_url =
url.replace('_', '\\_').replace('#', '\\#').replace('%', '\\%').replace('&', '\\&')
return '\\href{{%s}}{%s}' % (url, text) + \
'\\footnote{\\texttt{%s}}' % texttt_url
else: # no substitution, URL is in the link text
Reply all
Reply to author
Forward
0 new messages