Browse Source

doc update

wangweimin 4 years ago
parent
commit
2e0a90e924
3 changed files with 15 additions and 14 deletions
  1. 1 1
      README.md
  2. 10 10
      docs/guide.rst
  3. 4 3
      pywebio/output.py

+ 1 - 1
README.md

@@ -311,5 +311,5 @@ if __name__ == "__main__":
 
 ## Document
 
-使用手册和实现文档见 [https://pywebio.readthedocs.io](https://pywebio.readthedocs.io)
+使用手册和实现文档见 [https://pywebio.readthedocs.io](https://pywebio.readthedocs.io/zh_CN/latest/)
 

+ 10 - 10
docs/guide.rst

@@ -261,18 +261,18 @@ When using combination output, if you want to dynamically update the ``put_xxx()
     :name: output
     :summary: Output placeholder——`output()`
 
-     hobby = output('Coding')  # equal to output(put_text('Coding'))
-     put_table([
+    hobby = output('Coding')  # equal to output(put_text('Coding'))
+    put_table([
         ['Name', 'Hobbies'],
         ['Wang', hobby]      # hobby is initialized to Coding
-     ])
-     ## ----
-
-     hobby.reset('Movie')  # hobby is reset to Movie
-     ## ----
-     hobby.append('Music', put_text('Drama'))   # append Music, Drama to hobby
-     ## ----
-     hobby.insert(0, put_markdown('**Coding**'))  # insert the Coding into the top of the hobby
+    ])
+    ## ----
+
+    hobby.reset('Movie')  # hobby is reset to Movie
+    ## ----
+    hobby.append('Music', put_text('Drama'))   # append Music, Drama to hobby
+    ## ----
+    hobby.insert(0, put_markdown('**Coding**'))  # insert the Coding into the top of the hobby
 
 
 Callback

+ 4 - 3
pywebio/output.py

@@ -475,7 +475,7 @@ def put_table(tdata, header=None, scope=Scope.Current, position=OutputPosition.B
             ['html', put_html('X<sup>2</sup>')],
             ['text', '<hr/>'],
             ['buttons', put_buttons(['A', 'B'], onclick=...)],  # ..doc-only
-            ['buttons', put_buttons(['A', 'B'], onclick=ut_text)],  # ..demo-only
+            ['buttons', put_buttons(['A', 'B'], onclick=put_text)],  # ..demo-only
             ['markdown', put_markdown('`Awesome PyWebIO!`')],
             ['file', put_file('hello.text', b'hello world')],
             ['table', put_table([['A', 'B'], ['C', 'D']])]
@@ -991,7 +991,7 @@ def put_widget(template, data, scope=Scope.Current, position=OutputPosition.BOTT
         :summary: Use `put_widget()`to output your own widget
 
         tpl = '''
-        <details>
+        <details {{#open}}open{{/open}}>
             <summary>{{title}}</summary>
             {{#contents}}
                 {{& pywebio_output_parse}}
@@ -1000,10 +1000,11 @@ def put_widget(template, data, scope=Scope.Current, position=OutputPosition.BOTT
         '''
 
         put_widget(tpl, {
+            "open": True,
             "title": 'More content',
             "contents": [
                 'text',
-                put_markdown('~~Strikethrough~~')
+                put_markdown('~~Strikethrough~~'),
                 put_table([
                     ['Commodity', 'Price'],
                     ['Apple', '5.5'],